diff --git a/src/charts/chart.bar.js b/src/charts/chart.bar.js index 9b0e2f524..cfada7c59 100644 --- a/src/charts/chart.bar.js +++ b/src/charts/chart.bar.js @@ -8,8 +8,6 @@ var defaultConfig = { stacked: false, - valueSpacing: 5, - datasetSpacing: 1, hover: { mode: "label" @@ -22,6 +20,9 @@ position: "bottom", id: "x-axis-1", // need an ID so datasets can reference the scale + categorySpacing: 10, + spacing: 1, + // grid line settings gridLines: { show: true, @@ -50,6 +51,8 @@ position: "left", id: "y-axis-1", + spacing: 1, + // grid line settings gridLines: { show: true, @@ -284,11 +287,11 @@ this.max = this.labels.length; }, calculateBaseWidth: function() { - return (this.getPixelForValue(null, 1, true) - this.getPixelForValue(null, 0, true)) - (2 * self.options.valueSpacing); + return (this.getPixelForValue(null, 1, true) - this.getPixelForValue(null, 0, true)) - (2 * this.options.categorySpacing); }, 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.datasetSpacing); + var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * this.options.spacing); if (self.options.stacked) { return baseWidth; @@ -304,7 +307,7 @@ return xAbsolute + barWidth / 2; } - return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * self.options.datasetSpacing) + barWidth / 2; + return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * this.options.spacing) + barWidth / 2; }, }); this.scales[xScale.id] = xScale;