Tooltip behavior when drawing lines


« 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 Massimo Sansalone on 11th December 2013
Hi, I am using IBM Genero (4gl language) environment for triggering to display one Rgraph.Line() at the time selecting different pools of data. The code flow is the following for the function in charge to drawn the graph:

gICAPI.onProperty = function(dt) {
var myObject = eval('(' + dt + ')');
...
document.getElementById("generoChart").innerHTML="<canvas id='rgraph' width='640px' height='480px'>[No canvas support]</canvas>";
var intValues = [];
var intValues1 = []

... (fill values for intValues,intValues1)

var foo = new RGraph.Line('rgraph',intValues,intValues1);
RGraph.Clear(foo.canvas);
var tooltipValues = [];
... (fill tooltipValues)
foo.Set('tooltips', tooltipValues);
foo.Set('chart.labels', myObject.labels);
... (other foo.Set() calls)
foo.Draw();

By the graphs point of view the code is working fine (every new graph is displayed correctly), but after the first graph was displayed, the next one shows the tooltips for both the current and the previous graph (also when a tooltip of the previous graph is shown then it stay displayed forever).
I tried to replace RGraph.Clear(foo.canvas) with RGraph.Reset(foo.canvas) but in this way the tooltips are not working at all.

thank you in advance

Massimo
}
Posted by RGraph support on 11th December 2013
Hi there,

You could try setting the tooltips to nothing before you change the chart:

obj.Set('tooltips', null);


PS The dimensions on your canvas tag should not have the px suffix, eg:

width="640"





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 Massimo Sansalone on 11th December 2013
Hi , I added the call

foo.Set('tooltips', null)

Before (or after) RGraph.Clear(foo.canvas); but the behaviour remains the same.
Posted by RGraph support on 11th December 2013
Hi there,

Well I don't have the IBM system to test with I'm afraid. You could try clearing the ObjectRegistry with:

RGraph.ObjectRegistry.Clear();

Then to show the next chart you will need to create it from scratch (as opposed to reusing the same object over and over again). You could also try removing the old canvas from the DOM.




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 Massimo Sansalone on 11th December 2013
Ok! Now it is working.
 
Thank you for the help

Add a reply

 




« Back to message list
RGraph on social media