Automatically display a specific tooltip


« 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 Mat on 26th April 2013
I have a bar graph configured with tooltip's. When the graph is first drawn I want to be able to specify that the highest bar is already displaying it's tooltip so I need a javascript function to trigger this event.

On a separate but related note, I could use the same function on a timer to loop through displaying all tooltip's on a chart.

Many thanks
Posted by RGraph support on 26th April 2013
Hi there,

There's no RGraph function to do that - you'll need to write one and use the RGraph.Tooltip() (and possibly other API functions) function:

www.rgraph.net/docs/api.html#functions.other

And yes you could do the loop as well.



Richard, RGraph Support

5 developer license with Priority support for £299:
   www.rgraph.net/license#five-developer
Posted by Mat on 26th April 2013
Thanks for pointing me in the right direction. I can achieve the tooltip on startup with the following

var bar = new RGraph.Bar('barChart', [8, 20, 15]);
bar.Set('tooltips', ['A', 'B', 'C']);
bar.Draw();
RGraph.Tooltip(bar, tooltips[1], 0, 0, 1, null);

the only thing this is missing is when you click on a bar to display a tooltip, the bar also fades using (I think) RGraph.Bar.prototype.Highlight, which accepts a shape parameter. Is there a way to find the shape of a bar object without an event so I can make it fade?
Posted by RGraph support on 26th April 2013
Hi there,

All of the coordinates for the bars are kept in obj.coords:

obj.coords[0] // First bar
obj.coords[1] // Second bar
obj.coords[2] // Third bar

Each element is itself an array consisting of the x/y/w/h coordinates. So using those you can draw a rectangle on the canvas to highlight your bar.




Richard, RGraph Support

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

Add a reply

 




« Back to message list
RGraph on social media