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?
Here is the code: 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"
etc.
You also use zones:
$(function () {
$('#container').highcharts({
series: [{
data: [-10, -5, 0, 5, 10, 15, 10, 10, 5, 0, -5],
zones: [
{
value: 0,
color: '#f7a35c'
},
{
color: '#90ed7d'
}
]
}]
});
});
Try it in jsfiddle.net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With