react-native-chart-kit
react-native-chart-kit copied to clipboard
Padding to labels
Hello guys and thank you for the awesome library. I was wondering if it's possible to add some sort of padding for longer labels. right now, it goes out of bounds.
I need the same, give some padding to x axis values
any update on this ?
I have the same issue. Did anyone figure something out?
Update: I've just figured it out (sort of?): acording to this, you can set the propsForHorizontalLabels, referring to refer to react-native-svg's Text documentation.
On your chartConfig, you may use
const chartConfig = {{
[... your other settings ...],
propsForHorizontalLabels:{
fontSize: "14",
x:"60"
}
};
the x
will define how displaced it is. In my case it worked
Before defining x
after defining x
Not sure wether or not it'll work in every scenario, nor if this is the best solution, but in case anyone ever needs it, here it is
there's a way to do it with vertical labels?