ChartJS resets on data update

Hey everyone,

Facing an issue with ChartJS that whenever the dataset is updated, the charts reset the values to 0 and then re-renders. I’ve heard this has been a known issue in the past with ChartJS and there have been some solutions, however they are not applicable to WeWeb from what I’ve noticed (e.g the use of chart.update)

Setting animation under options doesn’t change anything either, and I was wondering whether anyone faced this issue before and have managed to overcome that hurdle.

Hey @jagai ! That’s a problem that can happen. We already have plans to expose the Chart.js instance so that native functions can be called if needed.

Meanwhile, you can reset the chart by re-rendering it. You can do this by binding conditional rendering to a variable we’ll call ‘isRendered’ for this example. When there’s a change in your data and you want to force an update, set this variable to false, then set it back immediately to true.

1 Like

Thanks @Kevin, really appreciate you taking the time to look into that 🫶🏼