编写一个简单的示例:
// full code in https://jsfiddle.net/alexandr2006/1bgxmdu7/1/
var options = {
type: 'bar',
scaleFontColor: "red",
scaleLineColor: "red",
data: {
labels: ["1. Red", "2. Blue", "3. Yellow", "4. Green", "5. Purple", "6. Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'red',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
};
var myChart = new Chart($("#myChart"), options);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<canvas id="myChart"></canvas>
是否可以使X轴上的签名部分(以及如何)具有不同的字体粗细/颜色,例如: 1。红色, 2。蓝色