Show tooltip regardless of 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:

chart.tooltips.hotspot.xonly

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

line.canvas.onmouseout = function (e)
{
     RGraph.RedrawCanvas(e.target);
     RGraph.HideTooltip();
}
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
Hi,

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
Hi,

Can't say I've ever tried it.


1 Year Premium Support now reduced to £299:
   www.rgraph.net/support

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 and there's a demo of it here:

dev.rgraph.net/tests/_monthly/2013-03-31_fixed-positioning.html

It won't work in Firefox though.



Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
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:

www.rgraph.net/fiddle/view/new-rgraph-example-using-a-dynamic-tooltip





Richard, RGraph Support
Please remember to link to the RGraph website

Help support RGraph - single site license only £99
    www.rgraph.net/license#single-site
Posted by Enter your name... on 15th November 2013
hi
thanks richard,

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

   y-axis
  50
    |
  40|________ |
    | | ________|
  30| ||
    | || |
  20|________|/_________|
    |
  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.


www.rgraph.net/fiddle/view/a-line-chart-with-crosshairs





Richard, RGraph Support
Please remember to link to the RGraph website

Help support RGraph - single site license only £99
    www.rgraph.net/license#single-site

Add a reply

 




« Back to message list
RGraph on social media