Export to GitHub

flot - issue #769

"offset" parameter for bar charts


Posted on May 16, 2014 by Grumpy Elephant

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

Status: New

Labels:
Type-Defect Priority-Medium