Looks like the clear function is not working for ajax request

Share RGraph:   Share or Like RGraph on Facebook!

« 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 May on 1st August 2013
Looks like the clear function is not working for ajax request. I have the following in success body of my ajax, and my result does not clear and another chart draw on it again and again.

function MovePie(obj) {
                         RGraph.Effects.Animate(obj, { 'chart.radius': 30, 'chart.centerx': 60, 'chart.centery': 60, 'frames': 5 });
                     }
                     RGraph.Clear(document.getElementById('canvasLast24'));
                     var line = new RGraph.Line('canvasLast24', mvOrder, hbOrder, allOrder)
                 .Set('curvy', true)
                 .Set('curvy.tickmarks.fill', null)
                 .Set('linewidth', 2)
                 .Set('chart.gutter.left', 30)
                 .Set('hmargin', 5)
                 .Set('labels', label)
                 .Set('tooltips', label)
                    
                 //.Set('tickmarks', 'circle')
                     //RGraph.Effects.Line.jQuery.Trace(line);
                     //RGraph.Clear(document.getElementById('canvasLast24'));
                     RGraph.Clear(document.getElementById('canvasLast24'));
                  var pie = new RGraph.Pie('canvasLast24', [oneWeekMV, oneWeekHB])
                 .Set('centerx', 300)
                 .Set('centery', 150)
                 .Set('radius', 125)
                 .Set('exploded', [5])
                 .Set('strokestyle', 'rgba(0,0,0,0)')
                 .Set('shadow', true)
                     RGraph.Effects.Pie.RoundRobin(pie, null, MovePie);




Posted by Arnaud on 1st August 2013
Try :

RGraph.ObjectRegistry.Clear(canvasId);
RGraph.Redraw();

It works for me.
Posted by RGraph support on 2nd August 2013
Hi there,


It sounds like you need to clear the object registry. As Arnaud said you can use the ObjectRegistry clear function passing it the canvas ID or the canvas itself (as retrieved from document.getElementById() ) or you may also find that resetting the canvas works:

RGraph.Reset(canvas);



Richard, RGraph Support

Add a reply




« Back to message list