Beta
Beta

Reputation: 11

HighCharts Plotlines with Multiple Y-Axis

I have been able to generate a HighCharts chart with multiple y-axis like this chart with multiple y-axis and I have been able to generate a chart with a single y-axis and plot line like this chart with plot lines and single y-axis. Is it possible to combine the two so that I can have multiple y-axis and at least one plot line? I am not exactly sure where to start.

Thanks in advance,

Upvotes: 0

Views: 4636

Answers (1)

Raein Hashemi
Raein Hashemi

Reputation: 3384

It is. You should simply combine the code of each chart options. Include plotLines in the axis you want the plotLines on:

{ // Secondary yAxis
        plotLines: [{
            value: 50,
            color: 'green',
            dashStyle: 'shortdash',
            width: 2,
            zIndex: 10,
            label: {
                text: 'Minimum'
            }
        }, {
            value: 150,
            color: 'red',
            dashStyle: 'shortdash',
            width: 2,
            zIndex: 10,
            label: {
                text: 'Maximum'
            }
        }],

        ...
}

Here's the DEMO

Upvotes: 9

Related Questions