Topic: How to remove labels from Pie Chart and the tooltip still there
Just for Fun free asked 7 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
}
});
Add comment
Jakub Strebeyko staff answered 7 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
With Best Regards, Kuba
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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Resolved
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: Other
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Tags