Override tooltip content

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 Chitrangada on 13th December 2012
Hi,

I am using this library and drawing a line graph containing three different lines with different color. I am using tooltip feature to display the x and y value on the tickmark. Currently, I have passed the X-axis data array to enable the tooltip feature but I want to display the combination of X-axis and Y-axis values together.

I have applied this property :

myGraph.Set('chart.tooltips.override', tooltip_override);
function tooltip_override (canvas, text, x, y, idx)
{
  alert('In tooltip override function...');
}
But, found no reflexion by it.

Please suggest.

Thanks
Posted by RGraph support on 13th December 2012
Hi,

"reflexion"?

You could simply use Javascript to go through your data building the tooltips as appropriate. Eg:

data1 = [4,6,3,5,8]
data2 = [8,9,1,4,1]
tooltips = [];

for (var i=0; i<data1.length; ++i) {
     tooltips.push(data1[i] + ', ' + data2[i]);
}

And then finally set them normally:

obj.Set('chart.tooltips', tooltips);
Posted by Chitrangada on 14th December 2012
Thanks for your response.

But I guess, I had asked you wrong question :P .. sorry for that.
Let me be precise, I want to show X-axis & Y-axis value when user hovers on any tickmark of graph.
Because I think tooltips only work for the line which is near to x-axis, but not for all the lines drawn on the same graph( as I have multiple lines on the same graph ).

Thanks
Chitrangada
Posted by RGraph support on 14th December 2012
Hi,

There's no option for when your mouse cursor is in the gutter. When the mouse is in the graph area you can use crosshairs: www.rgraph.net/docs/misc.html#crosshairs

But crosshairs will only work when your mouse is in the chart area.
Posted by Chitrangada on 14th December 2012
Okay, thanks for your response.

By the way, the tooltip sometimes work on FF and sometimes not. Is there any JS script which I am missing to include in the document?

I found this option from net:
pieId.Set('chart.tooltips.event', 'onmousemove');

Thanks
Posted by RGraph support on 14th December 2012
Hi,

What event the tooltips use depends on what chart you're using - for example the Bar uses the click event while the Line and Scatter charts use the mousemove event. Feel free to post a link to an example.
Posted by Chitrangada on 14th December 2012
Hi,

I am drawing line and pie chart on the same page but in different canvases. These graphs are displaying perfectly in Google Chrome but tooltip is not working in Mozilla firefox.

Is there any sequence issue in including these JS files :

RGraph.common.core.js, RGraph.common.dynamic.js, RGraph.common.tooltips.js, RGraph.pie.js, RGraph.common.key.js, RGraph.common.effects.js

?
Posted by RGraph support on 14th December 2012
Hi,

No there's no issue with sequence. Try testing your charts on multiple browsers.

Add a reply




« Back to message list