How to change the color of the graph above and below the storyline in Highcharts

In a HighCharts line chart, how to set the color of a series line depending on its value relative to the storyline value.

For example, if I have a storyline y = 15 , how can I make a series of colors green when y < 15 and red if y > 15

http://jsfiddle.net/adamtsiopani/YBMny/

 $('#container').highcharts('StockChart', { rangeSelector: { selected: 1 }, title: { text: 'KPN Year View' }, yAxis: { plotLines: [{ label: { text: 'Baseline', x: 25 }, color: 'orange', width: 2, value: 15, dashStyle: 'longdashdot' }], }, series: [{ name: 'KPN12345', data: [ [1327881600000, 11], [1327968000000, 18], [1328054400000, 12], [1328140800000, 5], [1328227200000, 11], [1328486400000, 17], [1328572800000, 10], [1328659200000, 10], [1328745600000, 15], [1328832000000, 10], [1329091200000, 11] ] }] }); 
+7
source share
1 answer

You can do this with a combination of threshold and negativeColor .

  series: [{ name: 'KPN12345', data: [ [1327881600000, 11], etc... ], threshold: 15, negativeColor: 'green', color: 'red', tooltip: { valueDecimals: 2 } }] 

Fiddle here .

enter image description here

+19
source

All Articles