作者:Melix7 | 来源:互联网 | 2023-05-19 00:53
I just need to align the Chart Legend so it don't look too messy as the default shows, here is an example what I'm trying to achieve:
我只需要对齐图表图例,使它看起来不像默认显示那样太乱,这里是我想要实现的一个例子:
Please give some code suggestions: https://jsfiddle.net/holp/68wf75r8/
new Chart(document.getElementById("field-0"), {
type: 'pie',
data: {
labels: ["Chat", "Prospeção", "Whatsapp", "Trial", "Site", "Telefone", "E-mail", "Evento"],
datasets: [{
data: [700, 400, 200, 150, 80, 50, 20, 10],
borderWidth: 2,
hoverBorderWidth: 10,
backgroundColor: pieColors,
hoverBackgroundColor: pieColors,
hoverBorderColor: pieColors,
borderColor: pieColors
}]
},
options: {
legend: {
labels: {
padding: 20
}
}
}
});
2 个解决方案