如何在图表中将标签移离x轴

问题描述 投票:0回答:1

尽管使用了边距和填充,但我无法将标签从 x 轴向下移动(例如 30px)。

       <XAxis
          dataKey="week_of_year"
          tick={{ fontSize: '12px' }}
       >
          <Label
            position='insideBottom'
            offset={10}
            value="Week of year"
            style={{ fontSize: '80%', fill: 'black', padding: '100px' }}
          />
        </XAxis>

非常感谢您的建议!

recharts
1个回答
1
投票

您可以使用

dx
dy
<Label />

属性

例如:

<Label
    value='Dollars'
    offset={-10}
    dx={20}
    dy={20}
    position="insideBottomLeft"
    fontSize={14}
/>
© www.soinside.com 2019 - 2024. All rights reserved.