how to adjust label text center in react native svg charts in react native

1k Views Asked by At
      <View style={{flex: 1, height: windowHeight * 0.39, marginLeft: 10}}>
    <BarChart
      style={{flex: 1}}
      data={data}
      spacingInner={width * 0.000999}
      spacingOuter={
        Months.length == 1
          ? width * 0.36
          : Months.length == 3
          ? width * 0.3
          : null
      }
      horizontal={false}
      yAccessor={({item}) => item.value}
      svg={{fill: fill}}
      contentInset={{top: width * 0.025, bottom: width * 0.025}}
      spacing={0.2}
      gridMin={0}
      gridMax={Math.max(...values)}>
      <Grid svg={{stroke: LineFill}} />
    </BarChart>
    <XAxis
      xAccessor={({index}) => index}
      data={Months}
      formatLabel={(label, index) => data[index].label}
      style={{
        marginHorizontal: width * -0.03,
        height: width * 0.04,
        alignItems: Months.length == 1 ? 'center' : null,
      }}
      contentInset={{
        left: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 :  width * 0.07,
        right: Months.length == 3 ? width * 0.26 : Months.length == 4 ? width * 0.09 : width * 0.066,
      }}
      svg={axesSvgXAxis}
    />
  </View>

Blockquote Hi i am new to react native , i am using react native-svg-charts , i am facing issue in adjust label text center according to the position of bars in react native-svg-charts.strong text

https://i.stack.imgur.com/TXSNA.png

0

There are 0 best solutions below