有什么办法可以在jqplot图形中为刻度线着色 [英] Is there a way I can color my ticks in my jqplot graph

查看:78
本文介绍了有什么办法可以在jqplot图形中为刻度线着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个堆积的条形图,我想在图上给刻度线上色.

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:

因此,我想将Aava设为绿色,将Acer设为红色.有没有一种方法可以给每个标签上色?我知道我可以为所有颜色上色,但是我可以选择一种颜色吗?

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?

我的第一个尝试是使用jquery选择标签并应用我自己的CSS,如下所示:

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

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

但是,这什么也没选择

推荐答案

尝试类似的方法:

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

我不确定是否可以使用,但是似乎在这里更改了x标签的字体颜色:

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

当我跑步时:

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

您需要确保此操作在DOM准备就绪并创建图形之后运行.

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

这篇关于有什么办法可以在jqplot图形中为刻度线着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆