[Chartjs]-Hovering over chart.js values in Meteor onRendered function causes chart axis shift

2👍

Seems like a hovering issue with charts which is bringing back the data of old chart.

make myBarBothDaily variable global and bind it with the context of template and initialise it with null before the Tracker.autorun() block

this.myBarBothDaily = null

now inside autorun block, before instantiating your chart, destroy the data of previous chart by calling destroy() function of chart.js.

if(this.myBarBothDaily) {
   this.myBarBothDaily.destroy();
}
this.myBarBothDaily = new Chart(ctxtwo).Bar(data, options);

this should fix your issue.

Leave a comment