MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 18 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

Version 7.20
Version 7.20 (released in June 2026) is the latest version of RGraph and the major change in this version is an update to the default values of properties making for better looking charts without having to set any properties. Read more about this and other changes in the changelog.

Download »

 

Download
Get the latest version of RGraph (version 7.20, 9th June 2026) from the download page. You can read the changelog here. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

Download »

 

Latest forum posts
These are the latest support forum posts that have been posted or updated.


16th June, Rachel
I have a question about the 3D Bar chart
12th June, Marco
Should I use SVG or canvas for the charts on my website?
9th June, Richard
New version of RGraph: version 7.20
3rd June, Patrick
Question about installing RGraph
1st June, Ouja
How do I add a click event to a bar in my Bar chart?


Support forum »

 

License
RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£129) commercial license available.

More »

Performance issues if I change the data in the middle of an animation


Posted by AKN at 14:18 on Tuesday 24th January 2023 [link]
Hey, during the initial chart animation where bars animate, if I change the data or any appearance setting animation starts over but stutters a lot. This problem does not occur when I change the data or any appearance settings after the animation ended. What can I do to solve this problem so that during animation if I change anything it does not stutter?

Posted by Richard at 18:45 on Tuesday 24th January 2023 [link]
Hmmmm. Why are you changing settings in the middle of the animation? I'm guessing that because the frames all initiated immediately with an increasing delay for each frame - the remaining frames are drawing when you start the new animation.

There's no way to cancel the remaining frames currently.

Now I think about it - it might actually not be that at all.

Is it possible to delay your update until the current animation has finished? Maybe with setTimeout or perhaps with the animation callback function.

eg The animation callback could check a variable to see if it contains any new properties and if it does set them on the object.

Posted by Richard at 22:59 on Tuesday 24th January 2023 [link]
OK, after a bit of experimentation, it's looking like I might be able to add a stop() function that might look something like this:

obj = new RGraph.Bar({
    idx: 'cvs',
    data: [1,6,3,5,8,4,9],
    options: {
    }
}).wave(); // This effect takes two seconds by default (IIRC)

// Call this half-way through the wave() effect
setTimeout(function ()
{
    obj.wave.stop();
}, 1000);

Something like that - or perhaps one of these:

obj.stop();
obj.stopEffect();
RGraph.Effects.stop();

Or maybe all of them! Keep in mind it's still just a maybe at this point.

Posted by Richard at 11:28 on Thursday 26th January 2023 [link]
What chart type and effect are you using btw? The Bar chart?

Posted by AKN at 12:08 on Thursday 26th January 2023 [link]
I'm using bipolar chart. I've tried to add stop functions but my browser keep crashed after that not sure why. After changing data or filters without waiting 1-2 seconds causing stuttering. So I have a appearance tab that changes the color of the bars and that sets the title position etc. When I change any settings the chart redraws from zero, plays the animation and all. I've tried to set animation frames to 1 so that it'd be kinda instant .grow({ frames: 1 }) or .wave({ frames: 1 }) still same problem occurred. So I'm kinda lost, what's the problem here.

Posted by Richard at 16:31 on Thursday 26th January 2023 [link]
I'm currently trying to add a stop() function which will exactly that - stop the animation so that you can start another.

I've added one to the Bar chart successfully but I'm now thinking of another way which might be a little better so that you could do this:

myBipolar.grow.stop();

And it would stop the grow effect.

Posted by AKN at 17:53 on Thursday 26th January 2023 [link]
I'm not even sure if the growing animation causing the stuttering at this point. But please let me know if you got something.

Posted by Richard at 18:09 on Thursday 26th January 2023 [link]
OK, I've made a stop() animation function.

[LINK REMOVED]

Posted by AKN at 12:32 on Friday 27th January 2023 [link]
myBipolar.grow.stop(); is this how I use it?

Posted by AKN at 12:58 on Friday 27th January 2023 [link]
.grow.stop(); is this how I use it? Or maybe .stopAnimation(); ?

Posted by AKN at 13:10 on Friday 27th January 2023 [link]
Btw any line of code I write after the draw() function doesn't work. Why do you think that is? Here's an example js code https://i.imgur.com/shTSId7.png

Posted by AKN at 13:52 on Friday 27th January 2023 [link]
Nvm I figured it out... Thank you dude. I've added a toggle animation button, when disabled I change any setting I want and then enable the animation. Seems like the stuttering is kind of gone. It just stutters a tiny bit.

Posted by Richard at 16:42 on Friday 27th January 2023 [link]
> Nvm I figured it out... Thank you dude. I've added a toggle
> animation button, when disabled I change any setting I want and
> then enable the animation. Seems like the stuttering is kind of
> gone. It just stutters a tiny bit.

Marvellous. Did the obj.stopAnimation() function help at all?

Posted by AKN at 19:06 on Friday 27th January 2023 [link]
Yep it was exactly what I needed :)

[Replies are closed]