How to remove labels from Pie Chart and the tooltip still th


Topic: How to remove labels from Pie Chart and the tooltip still there

Just for Fun asked 3 years ago

Hi, Can you guys help me? I want my pie chart without the labels, but when i removed the labels, the tooltip remind undefined. Here is the javascript //pie var ctxP = document.getElementById("pieChart").getContext('2d'); var myPieChart = new Chart(ctxP, { type: 'pie', data: { labels: ["Tagihan Selesai", "Tagihan Telat Bayar", "Total Tagihan"], datasets: [ { data: [300, 50, 120], backgroundColor: ["#F7464A", "#46BFBD", "#4D5360"], hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#616774"] } ] }, options: { responsive: true, labels: false } });

Jakub Strebeyko staff answered 3 years ago

Hi there Just For Fun,

The easiest way to have no labels would be to modify global options for the chart legend, which are defined in Chart.defaults.global.legend as seen here. For this and other fun chart options I recommend visiting official chart.js documentation.

With Best Regards, Kuba
Please insert min. 20 characters.
Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: Other
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No