dhammucool / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

"offset" parameter for bar charts #769

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I had a need for multiple series with overlapping X axis values, and wanted 
control over how they displayed next to each other.  The "align" parameter 
allowed for two series to sit next to each other fairly easily, but any more 
than two was problematic.  I made a small patch to allow for an "offset" 
parameter that would assign a particular series offset from the center line on 
the X axis.  Now my PHP code calculates the offset (and the bar width) based on 
the number of series expected to plot, and lines them all up next to each 
other, the group of which is centered.

Here is the diff for jquery.flot.js, version 0.8.3:

2693,2694d2692
<                       barLeft += series.bars.offset ? series.bars.offset : 0;
< 
2899d2896
<                                       barLeft += s.bars.offset ? 
s.bars.offset : 0;
3111d3107
<                       barLeft += series.bars.offset ? series.bars.offset : 0;

Cheers,

Jeff LaCoursiere

Original issue reported on code.google.com by j...@stratustalk.com on 16 May 2014 at 7:00