高光条件下的条件标记颜色 [英] conditional marker colors in highcharts
本文介绍了高光条件下的条件标记颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Highcharts,我想用不同的颜色填充折线图中的标记。例如:当变量a为1时,用红色填充标记,否则用绿色填充。是否有可能这样做?
I'm using Highcharts and I want to fill markers in line chart with different colors. For example: when variable "a" is 1 then fill marker with red else fill with green. Is it possible to do that?
以下是代码: http ://jsfiddle.net/EnyCJ/1/
我试图用格式化程序来做到这一点,但它不起作用。任何建议?
I was trying to do that with formatter but it doesn't work. Any suggestions?
var a=1;
plotOptions: {
series: {
marker: {
fillColor: {
formatter: function () {
if (a == 1) {
return 'red'
} else {
return 'green'
}
}
},
lineWidth: 2,
}
}
},
推荐答案
试试:
Try:
fillColor: a==1 ? "#ff0000" : "#00ff00"
等。
这篇关于高光条件下的条件标记颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文