react-native-chart-kit icon indicating copy to clipboard operation
react-native-chart-kit copied to clipboard

Padding to labels

Open danipralea opened this issue 5 years ago • 4 comments

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. Simulator Screen Shot - iPhone X - 2019-10-17 at 00 06 36

danipralea avatar Oct 16 '19 21:10 danipralea

I need the same, give some padding to x axis values

Satyrogh avatar Apr 03 '20 18:04 Satyrogh

any update on this ?

IkaroAlef avatar Sep 24 '20 02:09 IkaroAlef

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 image

after defining x image

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

ArthurYdalgo avatar Apr 05 '21 18:04 ArthurYdalgo

there's a way to do it with vertical labels?

robCalderonDev avatar Nov 28 '23 16:11 robCalderonDev