]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Added the global datasets defaults for new extended chart type (#6649)
authorstockiNail <stocki.nail@gmail.com>
Wed, 30 Oct 2019 22:42:15 +0000 (23:42 +0100)
committerEvert Timberg <evert.timberg+github@gmail.com>
Wed, 30 Oct 2019 22:42:15 +0000 (18:42 -0400)
Added documentation to create a global datasets default for new extended chart type.
This is currently mandatory for BAR/HORIZONTALBAR charts (see issue [#6636](https://github.com/chartjs/Chart.js/issues/6636))

docs/developers/charts.md

index bf63b5f02938db77c921c6e27fc42931e2cb4b7d..e3949b064cb9926267cfa9cb7bacb42718eed9d1 100644 (file)
@@ -67,6 +67,7 @@ Extending or replacing an existing controller type is easy. Simply replace the c
 The built in controller types are:
 * `Chart.controllers.line`
 * `Chart.controllers.bar`
+* `Chart.controllers.horizontalBar`
 * `Chart.controllers.radar`
 * `Chart.controllers.doughnut`
 * `Chart.controllers.polarArea`
@@ -80,6 +81,10 @@ For example, to derive a new chart type that extends from a bubble chart, you wo
 // It looks like a bug exists when the defaults don't exist
 Chart.defaults.derivedBubble = Chart.defaults.bubble;
 
+// Sets the default dataset config for 'derivedBubble' to be the same as the bubble dataset defaults.
+// It looks like a bug exists when the dataset defaults don't exist
+Chart.defaults.global.datasets.derivedBubble = Chart.defaults.global.datasets.bubble;
+
 // I think the recommend using Chart.controllers.bubble.extend({ extensions here });
 var custom = Chart.controllers.bubble.extend({
     draw: function(ease) {