我做了很多搜索,但我尝试的任何方法都无法更改轴文本颜色。但是,我可以将网格颜色更改为白色scales.yAxes.grid.color。这就是我现在所拥有的:
render(){
return (
<div className = "chart">
<Line
data = {this.state.chartData}
options= {{
maintainAspectRatio: false,
scales: {
yAxes:{
grid: {
drawBorder: true,
color: '#FFFFFF',
},
ticks:{
beginAtZero: true,
fontColor: 'white'
}
},
xAxes: {
grid: {
drawBorder: true,
color: '#FFFFFF',
},
ticks:{
beginAtZero: true,
fontColor: 'white'
}
},
}
}}
width = {20}
height = {200}
/>
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud)