You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Will it ever be possible for the update function to update the options of the chart as well?Β #2060
i'm looking to switch between a regular bar chart and a stacked bar chart on the fly. At the moment this is only possible by destroying and re-creating the chart but this causes a flicker when doing so (as the chart is essentially being removed and put back onto the web page). I thought it would be much more efficient to be able to update the options seeing as we are only looking to toggle stacked and the title of the chart. Just wondering if this will ever be possible?
@dibsyjr1 this is not currently supported in either version 1 or version 2. It should be possible, the most annoying thing would be the performance decrease caused by re-merging the config with the global config.
I understand that it would cause a performance decrease. Was just thinking you could have a prototype method (hardUpdate for example) that people can choose to call as an alternative to the update function, which would as a result update the entire chart, including options. Kind of like how when update is called, render is subsequently called, but instead it'd be hardUpdate, calling update which in turn calls render (so hardUpdate would only contain the required code to update the options). Just so the functionality is there if someone were to require it without forcing the performance decrease on everyone who wanted to call update.
Why not just add another function for this? And don't use update() as God-function, but divide it by steps, or even remove it leaving something like updateConfig(), updateData() and render().
Activity
etimberg commentedon Feb 26, 2016
@dibsyjr1 this is not currently supported in either version 1 or version 2. It should be possible, the most annoying thing would be the performance decrease caused by re-merging the config with the global config.
dibsyjr1 commentedon Feb 26, 2016
Hi, thanks for the reply.
I understand that it would cause a performance decrease. Was just thinking you could have a prototype method (hardUpdate for example) that people can choose to call as an alternative to the update function, which would as a result update the entire chart, including options. Kind of like how when update is called, render is subsequently called, but instead it'd be hardUpdate, calling update which in turn calls render (so hardUpdate would only contain the required code to update the options). Just so the functionality is there if someone were to require it without forcing the performance decrease on everyone who wanted to call update.
Thanks again :)
etimberg commentedon Feb 26, 2016
Yup, I think we can provide this functionality though it won't make the 2.0.0 release
dibsyjr1 commentedon Feb 26, 2016
Okay that's cool, thanks very much
pavlus commentedon Mar 8, 2016
Why not just add another function for this? And don't use update() as God-function, but divide it by steps, or even remove it leaving something like updateConfig(), updateData() and render().