开发者

howto change color on jqPlot datapoint labels

I have a graph generated by jqPlot. Data Point Labels are used the show additional info开发者_如何学运维rmation on the graph, like in this example: http://www.jqplot.com/tests/point-labels.php

As you can see, the color of the data point labels is always black. But I would like to change the color of the data point labels to the same color as the graph is (by the way: I don't talk about the legend or the tick-label).

Searching trough the options page (http://www.jqplot.com/docs/files/jqPlotOptions-txt.html) I found no option to change this color.

So the question is: Is there a (other) way to change the color of the data point labels?

Thank you.


You can do that with CSS. By targeting the class .jqplot-point-label. See the example provided on the page


In addition to the .jqplot-series-$i class, reading the source reveals that the .jqplot-data-label class is also applied to these label items.


You can do this without CSS.

for series set

pointLabels:{ 
  show:true,
  escapeHTML:false
}

and

var label = '<span style="color:red">MyLabel</span>';
var seriesData = [[1,2,label], [3,4,label]];

Of course you can add a span in JavaScript loop.


I was using a donut chat and this is how i changed the target and label color

.jqplot-target{
     color: #ffffff !important ;

 }
.jqplot-table-legend{
    color: #666666 !important ;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜