P51DAce Report post Posted September 15, 2012 (edited) Is there a way to turn off animation from JQuery/JS? I noticed that I can turn it off in my json by adding "animation":"0" to chart. But, I'd like to turn animation from javascript or JQuery off before I do a refresh, so I'm trying something like: function updateChart() { $("#chartContainer").attrFusionCharts({"animation":"0"}); $("#chartContainer").updateFusionCharts({dataSource: 'data.json', dataFormat: "jsonurl"}); } but it still is animating. Any thoughts? Thanks! Edited September 15, 2012 by P51DAce Share this post Link to post Share on other sites
Guest Sumedh Report post Posted September 18, 2012 Hi, Updating chart attributes without refreshing the chart is not possible. You can explicitly apply "animation":"0" in the JSON. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted September 21, 2012 Is there a way to turn off animation from JQuery/JS? I noticed that I can turn it off in my json by adding "animation":"0" to chart. But, I'd like to turn animation from javascript or JQuery off before I do a refresh, so I'm trying something like: function updateChart() { $("#chartContainer").attrFusionCharts({"animation":"0"}); $("#chartContainer").updateFusionCharts({dataSource: 'data.json', dataFormat: "jsonurl"}); } but it still is animating. Any thoughts? Thanks! Hi, I have just created a small code snippet for you to disable chart animation when a chart is updated. /* INFO: Rendered event is raised only once when the chart is rendered for the first time and not when chart data is updated The statement below binds the "rendered" event and the code inside the event-listener binds "BeforeDataUpdate" event. The "BeforeDataUpdate" even-listener disables animation for all subsequent updates. This works in 2 steps: STEP 1 - It checks if the updated data contains any attribute to control animation. If found, it changes the attribute's value to 0 i.e., disable animation. STEP 2 - If it does not find "animation" attribute in the data, it adds animation="0" . */ $("#chartContainer").bind( "fusionchartsrendered", function (e, args) { $("#chartContainer").bind( "fusionchartsbeforedataupdate", function (e, args) { // stop on error if (args.error) { return; } // search for animation attribute and replace it's value with 0 (disabled) // Note: This statement force-disable animation even if the data contains settings to enable animation // In case, one needs to stop this behaviour, comment this statement args.data = args.data.replace(/(\<chart[^>]+? animation[\s\r\n\t]*=[\s\r\n\t]*)(['"])[^'"]+?['"]/i, "$1$20$2"); // when the "animation" attribute is not present in the data, add animation="0" if (args.data.search (/(\<chart[^>]+? animation[\s\r\n\t]*=[\s\r\n\t]*)(['"])/i) < 0) { args.data = args.data.replace(/(\<chart)/, '$1 animation="0"'); } }); }); Share this post Link to post Share on other sites