我为标签指定了三种不同的颜色,但颜色点始终显示为蓝色、绿色和黄色。我很确定我做错了什么。
我写的代码是:
var pieSimpleChart = {
chart: {
height: 350,
type: 'pie',
},
legend: {
position: 'bottom'
},
labels: ["IT", "Product Development", "Sales"],
series: [2, 2, 6],
fill: {
colors: ["#447b40", "#cc7870", "#e74ce4"]
}
}
var chart = new ApexCharts(document.querySelector("#task-pie-chart"), pieSimpleChart);
chart.render();
Run Code Online (Sandbox Code Playgroud)
如何将标签与我选择的颜色相匹配?
Ana*_*hra 10
我通过删除“填充”选项来修复它。现在代码如下:
var pieSimpleChart =
{
chart:
{
height: 350,
type: 'pie',
},
legend:
{
position: 'bottom'
},
labels: ["IT", "Product Development", "Sales"],
series: [2, 2, 6],
colors: ["#447b40", "#cc7870", "#e74ce4"]
}
Run Code Online (Sandbox Code Playgroud)