If there is case where it is necessary to distinguish data based on color e.g if data is below specified number it should be in red color and above it in green color. In that case data to the highcharts should be with color code.
1 2 3 4 5 6 7 8 |
ArrayList values1 = new ArrayList(); chartObj C = new chartObj() { y= 1500, name = "Jan", color = getColor1(y) }; values1.add(c); |
In method getColor1(int a), you can specify the condition to get specific color code:
1 2 3 4 5 6 7 8 9 10 11 |
private string getColor1(int a) { switch (a) { case 0 < a < 1000 : return "#FF0000"; case 1000 < a: return "#008000"; } return "#008000"; } |
Finally, set highcharts series value to values1.ToArray()