[英]how do I space the values by fixed amounts on the y axis in recharts
[英]How to increase axis space in recharts to fit another label?
我正在嘗試在我的 X 軸標簽下方添加另一個標簽,但它一直被切斷。
這是我的 XAxis 代碼:
<XAxis type="number" tick={<CustomizedNumberTick lang={props.language} />}>
<Label
style={{ fontSize: 12 }}
value={chartTitle}
position="insideTop"
offset={-500}
/>
<Label
style={{ fontSize: 12 }}
value={props.formatMessage({ id: "kilograms" })}
position="insideBottom"
offset={-5}
/>
<Label
style={{ fontSize: 12 }}
value={props.formatMessage({ id: "myFooter" })}
position="insideBottom"
offset={-15}
/>
</XAxis>
我嘗試將 XAxis 上的 dy 屬性設置為不同的值,但沒有運氣。 理想情況下,我希望 kolograms 標簽和 myFooter 標簽都適合。
任何幫助表示贊賞!
我可以通過將條形圖中的 margin-bottom 從 10 增加到 20 來解決這個問題:
<BarChart
width={600}
height={550}
layout="vertical"
data={props.data}
margin={{ top: 5, right: 30, left: 55, bottom: 20 }}
ref={ref}
>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.