Answers for "chart js hide legend"

1

chart js hide legend

var myChart = new Chart(ctx, {
   type: 'line',
   data: data,
   options: {
      legend: {
         display: false //This will do the task
      }
   }
});
Posted by: Guest on July-13-2021
1

legend on click use default chartjs

// How to implement a custom behaviour when clicking on a legend element
var original = Chart.defaults.global.legend.onClick;
Chart.defaults.global.legend.onClick = function(e, legendItem) {
  /* do custom stuff here */
  original.call(this, e, legendItem);
};
Posted by: Guest on November-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language