Chartjs-How to show/hide animation when legend clicked chart js

0๐Ÿ‘

I think this works.

               this.data.datasets.forEach(function (dataset, i) {         

                var meta = chartInstance.controller.getDatasetMeta(i);

                if (!meta.hidden) {

                    meta.data.forEach(function (bar, index) {

                         var data = dataset.data[index];
                         formatM(data);
                         ctx.fillText(data_M, bar._model.x, bar._model.y - 5);
                    });
                }
                
            });

-1๐Ÿ‘

i found the answer for this. just remove the animation, and used plugin datalabel chart js.

Leave a comment