javascript - How do I reset Highcharts bar color back to it's original color? -
i have highcharts version 4.1.10
i have bar chart change color of bar when value exceeds threshold.
//timeout calls @ regular interval function mytimeoutfunction() { var xmlrequest = $.ajax({ datatype: "json", url: applicationpath + 'mywebapi/valuestomeasure', cache: false, success: myfunctiononsuccess, error: myfunctiononerror }); } function myfunctiononsuccess(mydata) { if (mydata.value > 500000000) { myseriesdataarray.data.push({ y: mydata.value, color: "rgb(255, 0, 0)" }); } else { myseriesdataarray.data.push({ y: mydata.value); } //... myseries.setdata(myseriesdataarray.data,true); }
the series data updated on interval using timeout.
when value exceeds threshold works expected , colors bar red.
but when value goes below threshold bar stays red. assume color style gets held onto.
is there way tell highcharts reset color original color highcharts automatically picked series in first place?
have tried solution below?
myseriesdataarray.data.push({ y: mydata.value, color: null });
i mean, remove color
property.
if won't help, can use:
myseriesdataarray.data.push({ y: mydata.value, color: myseries.color }); // re-apply color
Comments
Post a Comment