问题
I have a problem with my highchart my series is populated dynamically by looping my model. What if I also need to change the color of my highchart base on the value of my series.
Here is my code
series: [{
name: 'Flag',
showInLegend: false,
pointWidth:24,
pointPadding:0,
groupPadding:0,
data: (function()
{
var data = [];
@{
var itemSumaryListData = Model;
int subordinateCount = itemSumaryListData.subordinateCount;
if(itemSumaryListData.employeeteamlevelsummarylist.Count > 0){
foreach (var employee in itemSumaryListData.employeeteamlevelsummarylist) {
<text>data.push(@employee.TotalFlag );</text>
}
}
}
return data;
})()
}]
回答1:
You can set color parameter:
http://jsfiddle.net/x8JVj/
series: [{
name: 'Tokyo',
color:'yellow',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
}]
回答2:
You could try something similar to this JSFiddle and set the MaxValue from your chart data.
Then use this in series.zones:
[{value: ($.MaxValue )*0.5, color: '#00ffff'},...]
来源:https://stackoverflow.com/questions/14767540/how-to-change-the-highchart-color-dynamically