Trung Nguyen
Trung Nguyen

Reputation: 117

how to move Label away from x axis in Recharts

I could not move the Label down away (e.g. 30px) from x axis although margin and padding were used.

       <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>

Your suggestion is highly appreciated!

Upvotes: 1

Views: 3272

Answers (1)

Rutuja Dhokchaule
Rutuja Dhokchaule

Reputation: 106

You can use dx and dy properties of <Label />

For example:

<Label
    value='Dollars'
    offset={-10}
    dx={20}
    dy={20}
    position="insideBottomLeft"
    fontSize={14}
/>

Upvotes: 1

Related Questions