问题
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