最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Different colour bars in a flot bar graph, is this possible? - Stack Overflow

programmeradmin3浏览0评论

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 badges
Add a ment  | 

3 Answers 3

Reset to default 8

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.

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

发布评论

评论列表(0)

  1. 暂无评论