How can I show the tooltip regardless of the mouse's Y position?

« 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 Aximili on 15th November 2012
I am starting to like RGraph, the sample codes lack comments so it's very hard to get started, but it's pretty powerful once you get it.

Is there anyway you can make the tooltip to popup like it is on Google Analytics?
ie. To make the tooltip shown as long as your mouse vertically-aligned with the point, so you don't have to put the mouse exactly on the point, which is a lot harder.

If this can be done, then tooltip should also disappear once the mouse is out of the canvas, just like Google Analytics.
Posted by RGraph support on 16th November 2012
Hi there,

You can make the tooltips appear using the X coordinate only by setting this property to true:


And hide the tooltip when you move the mouse away from the canvas with this:

line.canvas.onmouseout = function (e)
Posted by Aximili on 18th November 2012
Perfect! Very nice!

Is there anyway making the y-position above the graph?

You can't just do this
.RGraph_tooltip { top: 0px !important; }
because the tooltip is not positioned relative to the canvas.
Posted by RGraph support on 19th November 2012

You could do that with script - using the .ontooltip custom event along with the RGraph.getCanvasXY(canvas) API method - like this:

line.ontooltip = function (obj)
    var canvasXY = RGraph.getCanvasXY(obj.canvas);
Posted by Aximili on 19th November 2012
And to make it work

     line.ontooltip = function (obj) {
       var canvasXY = RGraph.getCanvasXY(obj.canvas);
       $('.RGraph_tooltip').css('top', (canvasXY[1] - $('.RGraph_tooltip').height() + 20) + 'px');

Now the graph is responding really well.
Posted by Nilabja on 28th January 2013
Does RGraph tooltip work with jquery flippy.js?
Posted by RGraph support on 28th January 2013

Can't say I've ever tried it.


Richard, RGraph Support
Posted by Sumit Mathur on 29th March 2013
How can we fix the position of a tooltip on bar chart ? When we scroll the window, the tooltip also moves with that! I want to keep it fixed at the top of the bar... how can I do that ?
Posted by RGraph support on 29th March 2013
Hi there,

If you're talking about a canvas with fixed positioning - there is a change in the current beta tht allows this.

It won't work in Firefox though.

Posted by Enter your name... on 15th November 2013
hi ,

i want tooltips to be displayed by getting dynamic values for line and multiline charts ....
is it possible?
Posted by RGraph support on 15th November 2013
Hi there,

You can use the override option to specify a function that you can use to fetch the dynamic data and create a tooltip.

Also, instead of using a string for tooltips you can specify a function which fetches and returns the tooltip text (just the text). Like this:

Richard, RGraph Support
Posted by Enter your name... on 15th November 2013
thanks richard,

for multiline charts, will be having different values for each lines based on y-axis value like

  40|________ |
    | | ________|
  30| ||
    | || |
  10|_________________________ x-axis
        jan feb mar

line 1 values jan=20,feb=30,mar=40
line 2 values jan=40,feb=20,mar=50

lines i ve drawn may not be clear but on mouseover to those lines it should show their corresponding y-axis values....
Posted by RGraph support on 15th November 2013
Hi there,

By the sounds of it you will need to use the API. Add a mousemove event listener to the canvas and then in that you can use the line charts obj.getValue(e) method. That gives you the relevant value. If you wanta line too you could use crosshairs with just the horizontal line showing.

Richard, RGraph Support

Add a reply

« Back to message list