enj*_*Man 2 charts styling reactjs
我做了很多搜索,但我尝试的任何方法都无法更改轴文本颜色。但是,我可以将网格颜色更改为白色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)
小智 7
字体颜色可以通过“color”而不是“fontColor”设置
render(){
return (
<div className = "chart">
<Line
data = {this.state.chartData}
options= {{
maintainAspectRatio: false,
scales: {
yAxes:{
grid: {
drawBorder: true,
color: '#FFFFFF',
},
ticks:{
beginAtZero: true,
color: 'white',
fontSize: 12,
}
},
xAxes: {
grid: {
drawBorder: true,
color: '#FFFFFF',
},
ticks:{
beginAtZero: true,
color: 'white',
fontSize: 12,
}
},
}
}}
width = {20}
height = {200}
/>
</div>
)
}
}Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4207 次 |
| 最近记录: |