How to keep the bar width consistent when there is more than one bar?
For example in this fiddle:
var testing = $.plot($("#example-section15 #flotcontainer"), dataset, options);
testing.getOptions().series.barWidth = 5;
The bar width is always consistent in term of x-axis units. So you have to make sure, the total width of the chart in x-axis units is also fixed. You can do this by setting the
max options for the x-axis so that the difference is always the same.
If for example you have a maximum of 5 bars you could that the total width to 6 units. To always center the existing bars in the chart set the
max options so that the center of the bars is at the center of the chart:
min: -2, max: 4
min: -1.5, max: 4.5(fiddle example)
min: 0, max: 6