Display value at any point along a Line chart on mouseover?

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Jeff on 18th February 2013
How would one show the value on a line graph at any point by hovering over the line. For example the elevation at any point along a graph of an elevation profile? Also how would one show a dot on the line at any given point while doing the same?
Posted by RGraph support on 19th February 2013
Hi there,

For that I you would need a Scatter chart with a connecting line and also with ceosshairs - like this:

www.rgraph.net/docs/misc.html#crosshairs

PS Could you link to the RGraph website - thanks.

Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
Posted by RGraph support on 19th February 2013
Hi there,

You've managed to get me interested now - so here's a demo that I've made showing how you can do it:

dev.rgraph.net/demos/scatter04.html


Richard, RGraph Support

1 Year Premium Support now reduced to £299:
   www.rgraph.net/support
Posted by Jeff on 19th February 2013
Thank you for the reply (and yes I will link to RGraph). Crosshairs look promising. Take a look at the graphs on this link particularly the mouseover events. I am trying to produce something similar in RGraph.

connect.garmin.com/activity/266527645

Posted by RGraph support on 19th February 2013
Hi there,

It may help if you set these:

obj.Set('chart.tooltips.event', 'onmousemove');
obj.Set('chart.tooltips.effect', 'none');

It looks like you might be able to do it with a Line chart - but with a lot of data so the points are close together.

Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
Posted by Jeff H on 22nd February 2013
No luck trying to solve this problem as of yet. Is there a way to access the x / y values outside of crosshairs on a scatter plot? I see these two exist but only apply to a scatter plot.

var x = obj.canvas.__crosshairs_x__;
var y = obj.canvas.__crosshairs_y__;

I would like to know the y value on a line when the mouse is at position x on a line chart.

Posted by Enter your name... on 24th February 2013
Hi there,

You can't do that with a Line chart as there is no X scale. You can get the Y value with obj.getValue(e). For a X scale you will need to use the Scatter chart with a connecting line.

I'm in the process of adding a "snap" option to crosshairs and there's a demo of it so far here:

dev.rgraph.net/tests/2013-02-28/crosshairs.html

Richard, RGraph support
RGraph - HTML5 and Javascript charts
www.rgraph.net
Posted by Enter your name... on 24th February 2013
Hi there,

You can't do that with a Line chart as there is no X scale. You can get the Y value with obj.getValue(e). For a X scale you will need to use the Scatter chart with a connecting line.

I'm in the process of adding a "snap" option to crosshairs and there's a demo of it so far here:

dev.rgraph.net/tests/2013-02-28/crosshairs.html

Richard, RGraph support
RGraph - HTML5 and Javascript charts
www.rgraph.net

Add a reply




« Back to message list