<BarChart
isAnimationActive={false}
width={400}
height={200}
data={value}
margin={{
top: 5, right: 30, left: 20,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="x"
/>
<YAxis label={{ value: `no.`, angle: -90, position: 'insideBottomLeft' }} />
<Tooltip
content={<CustomTooltip />}
/>
<Bar dataKey="y" /* fill={colors[0]} */ >
</BarChart>
我在 x 轴上的数据是数字 [0,1,2,3...],但我希望我的刻度为 [A1,A2,A3...]
最佳答案
您可以使用格式化程序属性,这是一个示例
<XAxis dataKey="x" tickFormatter={(t) => `A${t+1}`} />
关于reactjs - 如何更改图表中的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64692408/