Chartjs-ChartJS showing wrong dataset following visibility property toggle

0👍

So, I don’t know if there’s a bug with chart JS or a correct determine which chart to update but I discovered that the render method works. This updates the chart following the visibility toggle loads the correct data back in when made visible. I thought it might be my use of the ‘this’ command but it works fine with the render method.

I just updated the toggle function like so,

function ToggleDatasetVisibility() {

   this.chart.getDatasetMeta(1).hidden = !this.chart.getDatasetMeta(1).hidden;
   this.chart.render();

}

Leave a comment