Skip to content
Advertisement

Highcharts diffent color @ Temperature Line

I have a question about highcharts: How can I display my temperature line in red above 0°C and blue below 0°C ? My code currently looks like this:

        Highcharts.chart('temperature', {
            title: {
                text: ''
            },
              chart: {
                type: 'combo-multi-axes',
                alignTicks: false,
                zoomType: 'x',
                animation: true,
                events: {
                  load: function() {
                    fetchLatestData(this);
                  }
                }
              },

                   yAxis: 1,
                    name: 'Temperatur',
                    color: '#de1312',
                    type: 'spline',
                    zIndex: 10,
    
            ],

Advertisement

Answer

Use color and negativeColor properties:

    series: [{
        ...,
        color: 'red',
        negativeColor: 'blue'
    }]

Live demo: http://jsfiddle.net/BlackLabel/9hnef5x2/

API Reference:

https://api.highcharts.com/highcharts/series.line.negativeColor

https://api.highcharts.com/highcharts/series.line.color

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement