Stacked Y axes - One above the other - Is it possible with Flot?

109 views
Skip to first unread message

stepand76

unread,
Feb 25, 2015, 5:59:23 PM2/25/15
to flot-...@googlegroups.com
Hi, I need to setup chart with two (or more) line series. Each series will have separate Y axis. This can be easily done in Flot. Perfect. But additionally I would like to ensure the series lines will never cross. It means the Y axes must be stacked (one each other). The X axis will be shared for all series.
Is it possible to do it with one instance of Flot?
I just played with setTransformationHelpers method where this I can (maybe) hardcode it, but I'm looking for quite legal way :-)
Any suggestion?
Thanks.



stepand76

unread,
Feb 26, 2015, 7:45:38 AM2/26/15
to flot-...@googlegroups.com
Sorry, instead of "one each other" there should be "one above each other".

Ced

unread,
Feb 27, 2015, 3:57:33 AM2/27/15
to flot-...@googlegroups.com
You can set the min/max range of each Y axis to add an offset.  Hide all Y axes except one and set the ticks explicitly on that axis.
Here's an example:
http://jsfiddle.net/bzkz6h83/

I've used this method to plot multiple boolean values and it works well enough.  However, it could get messy if you have multiple series with varying ranges.
Message has been deleted

stepand76

unread,
Mar 2, 2015, 4:26:17 AM3/2/15
to flot-...@googlegroups.com

Thanks Ced for your solution. I need to have different range on each axes and also would like to use other flot features like interacting with series data which is not possible with your workaround.
I finally decided to change the Flot source code to get the features I need. See the picture attached. I would like to share my changes with community so I have to commit to GitHub. I'm not not sure which branch I have commit to. Currently my changes are against 0.8.3. The 0.9 branch (which is intended to adding new features) is much different to 0.8.3, but it has lack of activity...


Ced

unread,
Mar 2, 2015, 4:52:00 PM3/2/15
to flot-...@googlegroups.com
Cool!
Would it be possible to implement this as a plugin instead?  That way you wouldn't need to have your changes merged into flot.

stepand76

unread,
Mar 2, 2015, 5:32:08 PM3/2/15
to flot-...@googlegroups.com
I don't think that it is possible create a Flot plugin to get this.

stepand76

unread,
Mar 4, 2015, 10:08:17 AM3/4/15
to flot-...@googlegroups.com
Hi, I just forked it on GitHub and add the feature to both branches so you can try it: https://github.com/stepand76/flot
I also created a pull request to merge: https://github.com/flot/flot/pull/1413
Reply all
Reply to author
Forward
0 new messages