Re: Google Charts with crosshair

739 views
Skip to first unread message

asgallant

unread,
Jul 23, 2012, 11:53:07 AM7/23/12
to google-visua...@googlegroups.com
What, exactly, are you referring to in the charts?  I don't see anything that I recognize as a "crosshair".

On Monday, July 23, 2012 5:15:14 AM UTC-4, Tomasz Rybicki wrote:
Hi!

I have a simple question - is there any efficient way to add crosshair function to google charts?
Like these on highcharts:

Tomasz Rybicki

unread,
Jul 24, 2012, 2:34:41 AM7/24/12
to google-visua...@googlegroups.com
Vertical line that is following the mouse cursor, and activate the nearest point on the chart. 

asgallant

unread,
Jul 24, 2012, 11:34:43 AM7/24/12
to google-visua...@googlegroups.com
There is no way I know of to duplicate that exactly, but you can get one of the two effects (line or tooltip).  Drawing the line is technically inefficient, as you actually redraw the chart every time there is a 'onmouseover' event thrown for a data point, but I haven't noticed any performance problems when I tested it (see http://jsfiddle.net/asgallant/xwrVV/4/).  The tooltips don't work there because redrawing the chart causes the chart to lose the mouseover info, so it doesn't know to create a new tooltip (though I added code to help you roll your own).

If you want tooltips without the line, you can get that effect just by setting the "focusTarget" option to "category" (see http://jsfiddle.net/asgallant/xwrVV/2/).
Reply all
Reply to author
Forward
0 new messages