Highlighting negative values and raising the base level

Sometimes, we may want to highlight both positive and negative regions in different colors. In such cases, we can specify the series color for negative values with the series option, negativeColor. Let's create a simple example with inflation data, containing both positive and negative data. Here is the series configuration:

    plotOptions: {
        line: {
            negativeColor: 'red'
        }
    },
    series: [{
        type: 'line',
        color: '#0D3377',
        marker: {
             enabled: false
        },
        pointStart: 2004, 
        data:[ 2.9, 2.8, 2.4, 3.3, 4.7, 
               2.3, 1.1, 1.0, -0.3, -2.1
        ]
    }]

We assign the color red for negative inflation values and disable the markers in the line series. The line series color is defined by another color, blue, which is used for ...

Get Learning Highcharts 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.