Closed team-moeller closed 6 months ago
This is the generated code, the problematic lines are commented out
var myChart = new Chart(ctx, {
type: 'pie',
data: {
labels: ['Berlin','London','Paris','Rome','Lisbon','Madrid',],
datasets: [
{label: 'Data' ,
data: [2,13,7,9,12,5],
borderWidth: 1}
]
},
options: {
aspectRatio: 1.6,
plugins: {
title: {
display: true,
position: 'top',
text: 'I love Better Access Charts'
},
subtitle: {
display: false,
},
legend: {
display: true,
position: 'right'
},
datalabels: {
<!--color: (context) => {-->
<!--const x = context.chart.scales.x;-->
<!--if (context.dataIndex >= x.min && context.dataIndex <= x.max) {-->
<!--return ;-->
<!--} else {-->
<!--return 'transparent';-->
<!--}-->
<!--}-->
},
autocolors: {
mode: 'data'
}
}
}
});
Chart types Radar, Doughnut and PolarArea are also affected
Released with version 4.20.01
When you choose a pie chart and activate datalabels the chart is not drawn