score:0

i find a work way, try it.

add

legend : {

                }

into option

var donutoptions     = {
                maintainaspectratio : false,
                responsive : true,
                animation: {
                    animatescale: true,
                    animaterotate: true
                },
                tooltips: {
                    intersect: false,
                    callbacks: {
                        label: function (tooltipitem, data) {
                            ...
                        }
                    },
                },
                plugins: {
                    datalabels: {
                        ...
                        },
                    },
                },
                legend : {

                }

            };

and use this


donutchart.chart.getdatasetmeta(0).data[index].hidden = true;

donutchart.update();

enter image description here


Related Query