diff --git a/src/Chart.Bar.js b/src/Chart.Bar.js index 6cc891b4a..541528723 100644 --- a/src/Chart.Bar.js +++ b/src/Chart.Bar.js @@ -75,17 +75,16 @@ }], }, - //Number - Pixel width of the bar border - barBorderWidth: 2, + bars: { + //Number - Pixel width of the bar border + borderWidth: 2, - //Number - Spacing between each of the X value sets - barValueSpacing: 5, + //Number - Spacing between each of the X value sets + valueSpacing: 5, - //Number - Spacing between data sets within X values - barDatasetSpacing: 1, - - //Boolean - Whether bars should be rendered on a percentage base - relativeBars: false, + //Number - Spacing between data sets within X values + datasetSpacing: 1, + } //String - A legend template legendTemplate: "" @@ -375,11 +374,11 @@ this.max = this.labels.length; }, calculateBaseWidth: function() { - return (this.getPixelForValue(null, 1, true) - this.getPixelForValue(null, 0, true)) - (2 * self.options.barValueSpacing); + return (this.getPixelForValue(null, 1, true) - this.getPixelForValue(null, 0, true)) - (2 * self.options.bars.valueSpacing); }, calculateBarWidth: function(datasetCount) { //The padding between datasets is to the right of each bar, providing that there are more than 1 dataset - var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * self.options.barDatasetSpacing); + var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * self.options.bars.datasetSpacing); if (self.options.stacked) { return baseWidth; @@ -395,7 +394,7 @@ return xAbsolute + barWidth / 2; } - return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * self.options.barDatasetSpacing) + barWidth / 2; + return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * self.options.bars.datasetSpacing) + barWidth / 2; }, }); this.scales[xScale.id] = xScale; @@ -464,10 +463,6 @@ return this.getPixelForValue(sumPos + value); } - /*if (options.relativeBars) { - offset = offset / sum * 100; - }*/ - return this.getPixelForValue(0); }