我使用chart.js创建条形图,似乎无法更改标签颜色或图例颜色。我想出了如何改变勾号的颜色,但我不确定把'scaleFontColor'放在哪里,如果这确实是我需要使用的。Chart.js标签颜色
下面是它现在的样子的链接。 http://imgur.com/nxaH1mk
这里是我的代码:
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
scaleFontColor: "white",
type: "bar",
data: {
labels: <?php echo json_encode($timeSlice); ?>,
datasets: [{
label: "A Label",
backgroundColor: "rgba(159,170,174,0.8)",
borderWidth: 1,
hoverBackgroundColor: "rgba(232,105,90,0.8)",
hoverBorderColor: "orange",
scaleStepWidth: 1,
data: <?php echo json_encode($myCount); ?>
}]
},
options: {
legend: {
fontColor: "white"
},
scales: {
yAxes: [{
ticks: {
fontColor: "white",
stepSize: 1,
beginAtZero: true
}
}]
}
}
});
任何帮助将不胜感激。
https://stackoverflow.com/a/48580585/7186739 – Super