Issue
I have this ChartJS Doughnut and added an extra Label which will show another value without displaying it on the doughnut. The problem is, ChartJS strikes through labels which are "hidden". Is there a possibilty to change the Strike-Through with a color?
This is my Chart:
I want it to look like this Chart:
This is the Source Code:
function donutChart(){
var ctx = document.getElementById('can');
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Misc'],
datasets: [{
label: '# of Votes',
data: [30, 10, 20],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(126, 214, 223, 0.2)',
'rgba(255, 206, 86, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(126, 214, 223, 1)',
'rgba(255, 206, 86, 1)'
],
borderWidth: 1
}]
},
options: {
legend : {
display: true,
position: 'bottom'
}
}
});
}
Solution
@jordanwillis answer at a similar question solved my problem. Thanks to @jordanwillis and @uminder
The Question: change legend item style when dataset is hidden
Answered By - Sanako-yan Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.