Flot Dynamic Bar Width
This is the code i used to use for bars bars: { show: true, barWidth: 12 * 24 * 60 * 60 * 300, that width works with me when the min and max
Solution 1:
To my knowledge, flot
won't auto-scale the bars. The default barWidth: 1, // in units of the x axis
, of course, isn't going to cut it for large-scale time plots. So here's my attempt for a simple algorithm which leaves equal sized bars and white space in between bars:
calcBarWidth = function(numBars, minTime, maxTime){
// assuming an even distributionvar totWidth = maxTime - minTime;
// totalWidth = (numBars * barSize) + ((1 + numBars) * barSize), solved for barSizereturn (totWidth / ((2 * numBars) + 1));
}
Untested code...
Post a Comment for "Flot Dynamic Bar Width"