小编enj*_*Man的帖子

react-chartjs-2 更改轴文本颜色

我做了很多搜索,但我尝试的任何方法都无法更改轴文本颜色。但是,我可以将网格颜色更改为白色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)

charts styling reactjs

2
推荐指数
1
解决办法
4207
查看次数

标签 统计

charts ×1

reactjs ×1

styling ×1