]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix horizontalBar deprecation warnings (#6603)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Sat, 26 Oct 2019 16:48:48 +0000 (09:48 -0700)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 26 Oct 2019 16:48:48 +0000 (12:48 -0400)
Fix horizontalBar deprecation warnings

src/controllers/controller.horizontalBar.js
test/specs/controller.bar.tests.js

index ebfc6d84ae1efe12fd280582436feafedc45e981..7b11bcc6627f68f7f4befbab37232d1abdb4cd21 100644 (file)
@@ -18,8 +18,6 @@ defaults._set('horizontalBar', {
                yAxes: [{
                        type: 'category',
                        position: 'left',
-                       categoryPercentage: 0.8,
-                       barPercentage: 0.9,
                        offset: true,
                        gridLines: {
                                offsetGridLines: true
@@ -39,6 +37,15 @@ defaults._set('horizontalBar', {
        }
 });
 
+defaults._set('global', {
+       datasets: {
+               horizontalBar: {
+                       categoryPercentage: 0.8,
+                       barPercentage: 0.9
+               }
+       }
+});
+
 module.exports = BarController.extend({
        /**
         * @private
@@ -54,4 +61,3 @@ module.exports = BarController.extend({
                return this.getMeta().yAxisID;
        }
 });
-
index 3874c3325df88295d2512b6ddfa50402935f1bc9..e52c9340fc1b191fec370d859364564df1b72532 100644 (file)
@@ -1593,8 +1593,9 @@ describe('Chart.controllers.bar', function() {
                        var meta = chart.getDatasetMeta(0);
                        var yScale = chart.scales[meta.yAxisID];
 
-                       var categoryPercentage = yScale.options.categoryPercentage;
-                       var barPercentage = yScale.options.barPercentage;
+                       var config = meta.controller._config;
+                       var categoryPercentage = config.categoryPercentage;
+                       var barPercentage = config.barPercentage;
                        var stacked = yScale.options.stacked;
 
                        var totalBarHeight = 0;