我不知道如何将文本颜色更改为白色。我想更改 x、y 轴和图表顶部的标签。我看过有关堆栈溢出的其他帖子,我觉得这些帖子已经过时并且适用于旧版本的 Chart.js。
ChartJS 版本:3.3.2
代码:
<canvas id="myChart" width="1000px" height="1000px"></canvas>
<script>
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
<?php
echo "labels: [";
for ($i = 1; $i < $monthdays; $i++) {
echo "'" . $i . "'" . ",";
}
echo "],";
?>
//labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
color: 'rgb(255,255,255)',
label: 'net volume of sales',
data: [12, 19, 3, 5, 2, 3, 12, 19, 3, 5, 2, 3, …Run Code Online (Sandbox Code Playgroud)