<YAxis
orientation="right"
// YAxis={{
// tickFormatter: (Estimated_minutes) =>
// parseFloat(Estimated_minutes).toFixed(0),
// }}
formatter={formatYAxis}
type="number"
yAxisId="2"
dataKey="Estimated_minutes"
fill="#000000"
/>
如何格式化Yaxis
中的整数值?我试过 toFixed
但它仍然给我错误。还有其他方法可以实现吗?
最佳答案
这可能有帮助
<YAxis
type="number"
tickFormatter={(value) => value.toFixed(2)}
domain={["dataMin", "auto"]}
allowDecimals={true}
/>
关于reactjs - recharts 中的 decimal 到 toFixed(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65033974/