Highchart - 仅更改一个x轴标签的颜色 [英] Highchart - change color of one x-axis label only
本文介绍了Highchart - 仅更改一个x轴标签的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我知道如何更改Highchart中x轴标签的颜色,这里将对此进行介绍。
http://jsfiddle.net/gh/get/jquery/ 1.7.1 / highslide-software / highcharts.com / tree / master / samples / highcharts / xaxis / labels-style /
但是如果我想要改变一个标签的颜色,而不是所有的标签?如何将样式应用于单个标签?
解决方案
您也可以使用label-formatter来设置样式。 jsfiddle 的完整示例:
labels:{
formatter:function(){
if('Jun'=== this.value){
return'< span style =fill:red ;>'+ this.value +'< / span>';
} else {
return this.value;
code $
$ p
So I know how to change the color of x-axis labels in Highchart, which is described here.
But what if I want to change the color of just ONE label, not all the labels? How do I apply style to individual labels?
解决方案 You can also use the label-formatter to set the style. Full example on jsfiddle:
labels: {
formatter: function () {
if ('Jun' === this.value) {
return '<span style="fill: red;">' + this.value + '</span>';
} else {
return this.value;
}
}
}
这篇关于Highchart - 仅更改一个x轴标签的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文