I have looked through the documentation and the only reference I can find is for different colour series. However I have only one data series and would like points/bars on that series different colours.
I could use multiple series and make points set to zero, which would have the same effect.
Is there a supported mechanism for having different colour bars in a bar graph using flot ?
I have looked through the documentation and the only reference I can find is for different colour series. However I have only one data series and would like points/bars on that series different colours.
I could use multiple series and make points set to zero, which would have the same effect.
Is there a supported mechanism for having different colour bars in a bar graph using flot ?
Share Improve this question asked Nov 11, 2010 at 9:54 NimChimpskyNimChimpsky 47.3k60 gold badges201 silver badges315 bronze badges3 Answers
Reset to default 8There isn't built in support for using multiple colors in a single series.
Flot only allows specifying colors of the dots at the dataseries level, meaning each color must be its own dataseries. With this in mind, the solution is to make a single dataseries for each color.
There is a Flot plugin that allows you to set the color based on threshold values that you set. You can get the plugin code here: https://github./subhrajitroy/Flot-plugin/blob/master/jquery.flot.threshold.multiple.js
Flot is now shipped with a plugin that does just that.
Internally it splits a series into several series and assign a different color to each.
The plugin is in flot's github page here:
https://github./flot/flot/blob/master/jquery.flot.threshold.js