Is there a way I can color my ticks in my jqplot graph

扶醉桌前 提交于 2019-12-11 21:24:46

问题


I have a stacked bar graph and I want to color my ticks on my graph.

In the graph below I'd like to color the customers in red or green based on their status:

So I would want to color Aava green maybe and Acer red. Is there a way to color each label? I know I'm able to color all of them a color but can I select a specific one?

My first attempts have been to select the label using jquery and apply my own css like this:

$("div:contains('Aava')" ).css( "color", "red" );

However, this doesn't select anything


回答1:


Try something like:

 $("div.jqplot-xaxis-tick:contains('Aava')").css("color", "red");

I'm not sure if it'll work, but it seemed to change the font color of the x labels here: http://www.jqplot.com/tests/line-charts.php

When I ran:

$("div.jqplot-xaxis-tick:contains('2')").css("color", "red");

You'll need to be sure this is ran after the DOM is ready and the graph has been created.



来源:https://stackoverflow.com/questions/23304935/is-there-a-way-i-can-color-my-ticks-in-my-jqplot-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!