TheBigDoubleA
TheBigDoubleA

Reputation: 452

How to add vertical lines to graph with HighStocks or HighCharts?

I have successfully created a chart with HighChart's HighStock. I'm trying to add vertical lines to the chart. I've searched everywhere in HighStock's docs, Stackoverflow and Google on how to do this, but to no avail. I tried HighStock's "flags" but can't create vertical lines with them.

I basically want to turn this chart... Charts with no lines

... into something like this: enter image description here

Is this even possible? If yes, how? Thanks!

Upvotes: 1

Views: 2640

Answers (1)

wergeld
wergeld

Reputation: 14442

Yes, These are called plotLines and are easily added like:

xAxis: {
    plotLines: [{
        value: Date.UTC(2015, 3, 15),
        width: 1,
        color: 'green',
        dashStyle: 'dash',
        label: {
            text: 'Latest value',
            align: 'right',
            y: 12,
            x: 0
        }
    }]
},

Upvotes: 3

Related Questions