About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 15 years old) and has a wealth of features making it an ideal choice to show charts on your website.

More »

 

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

More »

 

Download
Get the latest version of RGraph (version 6.16) from the download page. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

More »

How do I change a property after the animation ends?


Posted by AKN at 13:27 on Friday 3rd February 2023 [link]
Hey, how can I make it so when the initial grow animation labelsAbove is set to false and when animation finishes labelsAbove is true? I've tried like this but didn't seem to work.

const chart = new RGraph.Bipolar({
    id: tempCVSID,
    left: leftArr,
    right: rightArr,
    options: {
        labelsAbove: false,
    }
}).grow({ frames: 100 }).animate({
    labelsAbove: true,
})

Posted by Richard at 17:41 on Friday 3rd February 2023 [link]
For that you can use the callback function which, from memory, looks like this:

const chart = new RGraph.Bipolar({
    id: tempCVSID,
    left: leftArr,
    right: rightArr,
    options: {
        labelsAbove: false,
    }
}).grow({ frames: 100}, function (obj)
{
    obj.set('labelsAbove', true);
    RGraph.redraw();
})

Posted by AKN at 17:47 on Friday 3rd February 2023 [link]
It worked thank you!

[Replies are now closed]