Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts vertical line (crosshair) logic

Tags:

highcharts

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.

like image 278
user1350024 Avatar asked Apr 22 '12 20:04

user1350024


1 Answers

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.

like image 97
Ricardo Alvaro Lohmann Avatar answered Nov 01 '22 17:11

Ricardo Alvaro Lohmann