From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sat, 26 Oct 2019 16:48:48 +0000 (-0700) Subject: Fix horizontalBar deprecation warnings (#6603) X-Git-Tag: v3.0.0-alpha~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21da5be3c63e69a4edfc364d040e270471d8234d;p=thirdparty%2FChart.js.git Fix horizontalBar deprecation warnings (#6603) Fix horizontalBar deprecation warnings --- diff --git a/src/controllers/controller.horizontalBar.js b/src/controllers/controller.horizontalBar.js index ebfc6d84a..7b11bcc66 100644 --- a/src/controllers/controller.horizontalBar.js +++ b/src/controllers/controller.horizontalBar.js @@ -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; } }); - diff --git a/test/specs/controller.bar.tests.js b/test/specs/controller.bar.tests.js index 3874c3325..e52c9340f 100644 --- a/test/specs/controller.bar.tests.js +++ b/test/specs/controller.bar.tests.js @@ -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;