Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different colour bars in a flot bar graph, is this possible?

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 ?

like image 809
NimChimpsky Avatar asked Nov 11 '10 09:11

NimChimpsky


2 Answers

There 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.

like image 164
iRyanBell Avatar answered Sep 21 '22 13:09

iRyanBell


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.com/subhrajitroy/Flot-plugin/blob/master/jquery.flot.threshold.multiple.js

like image 25
DarrellNorton Avatar answered Sep 19 '22 13:09

DarrellNorton