user1350024
user1350024

Reputation: 111

Highcharts vertical line (crosshair) logic

I was wondering if it possible to activate the vertical line that appears and highlights points when hovering over the graph?

For example in this graph: http://www.highcharts.com/stock/demo/compare -> When hovering over the graph lines, the suitable point in each series is highlighted and a vertical line connects between them. I need an event to trigger this line and highlight the points for a specific x value.

Upvotes: 11

Views: 17718

Answers (1)

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

This vertical line appears by default on highstock but on highcharts it's null by default. You can enable it setting tooltip crosshairs like here.
To highlight all your series on the same y value you have to set shared as true like here.
Code:

tooltip: {
    crosshairs: {
        color: 'green',
        dashStyle: 'solid'
    },
    shared: true
}

You can style your crosshairs looking the following reference.

Upvotes: 24

Related Questions