Y軸とX軸のチャートラベルの色を白に変更しようとしました。私はここで他のスレッドからのfontColourを使ってコードを追加しようとしましたが、うまく動作しません。ここでラベルの色を変更するY軸とX軸chart.js
は私のコードです:
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : ['January','February','March','April','May','June','July'],
datasets : [
{
label: 'My First dataset',
fontColor : '#fff' ,
backgroundColor : 'rgba(220,220,220,0.2)',
borderColor : 'rgba(220,220,220,1)',
pointBackgroundColor : 'rgba(220,220,220,1)',
pointBorderColor : '#fff',
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
}
]
}
var options = {
maintainAspectRatio: false,
legend: {
fontColor: "white",
},
scales: {
xAxes: [{
ticks: {
fontColor: "white",
}
}],
yAxes: [{
ticks: {
fontColor: "white",
beginAtZero: true,
maxTicksLimit: 5,
stepSize: Math.ceil(250/5),
max: 250
}
}]
}
};
var ctx = document.getElementById('canvas-1');
var chart = new Chart(ctx, {
type: 'line',
data: lineChartData,
options: {
responsive: true
}
});
あなた 'options'ブロックはOKに見えるとラベルの色を変更する必要がありますが、あなたのチャート – Smittey
感謝を設定するときは、実際にそれを含めていません! :Dは働いた – 9minday