I am trying to align this react-native-chart-kit bar graph to the center. Bar Chart
This is code that I have currently:
<BarChart
data={{
labels: ["SU", "MO", "TU", "WE", "TH", "FR", "SA"],
datasets: [
{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
],
},
],
}}
width={Dimensions.get("window").width - 100}
height={220}
withHorizontalLabels={false}
fromZero={true}
withInnerLines={false}
chartConfig={{
backgroundGradientFrom: dark.backgroundColor,
backgroundGradientTo: dark.backgroundColor,
decimalPlaces: 0,
fillShadowGradientFrom: accent,
fillShadowGradientTo: accent,
fillShadowGradientFromOpacity: 1,
fillShadowGradientToOpacity: 0.25,
barPercentage: 0.75,
color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
}}
style={{
marginVertical: 10,
borderRadius: 10,
}}
/>
I was thinking that disabling the withHorizontalLabels
attribute would also remove the space that it would take up, but it did not.
I have tried adjusting the propsForHorizontalLabels
styles but with no result.