Skip to content

Commit

Permalink
Fix horizontalBar deprecation warnings (#6603)
Browse files Browse the repository at this point in the history
Fix horizontalBar deprecation warnings
  • Loading branch information
benmccann authored and etimberg committed Oct 26, 2019
1 parent ea100d4 commit 21da5be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/controllers/controller.horizontalBar.js
Expand Up @@ -18,8 +18,6 @@ defaults._set('horizontalBar', {
yAxes: [{
type: 'category',
position: 'left',
categoryPercentage: 0.8,
barPercentage: 0.9,
offset: true,
gridLines: {
offsetGridLines: true
Expand All @@ -39,6 +37,15 @@ defaults._set('horizontalBar', {
}
});

defaults._set('global', {
datasets: {
horizontalBar: {
categoryPercentage: 0.8,
barPercentage: 0.9
}
}
});

module.exports = BarController.extend({
/**
* @private
Expand All @@ -54,4 +61,3 @@ module.exports = BarController.extend({
return this.getMeta().yAxisID;
}
});

5 changes: 3 additions & 2 deletions test/specs/controller.bar.tests.js
Expand Up @@ -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;
Expand Down

0 comments on commit 21da5be

Please sign in to comment.