I have a problem where a react-native-chart-kit is within a horizontal scrollview but the rightmost part of the bar chart gets cut off at the end of the scrollbar
import React, { useEffect } from 'react';
import { StyleSheet, ScrollView, View, Dimensions } from 'react-native';
import { BarChart } from 'react-native-chart-kit';
import { crowdData } from '../data/data';
const CrowdingChart = ({stationId}) => {
const data = {
labels: ['12am - 1am','3am - 4am','6am - 7am','9am - 10am','12pm - 1pm','3pm - 4pm','6pm - 7pm','9pm - 10pm'],
datasets: [
{
data: crowdData[stationId]["THU"].reduce((acc, cum, index) => {
if (index % 4 == 0){
acc.push(cum)
}else{
acc[acc.length - 1] += cum
}
return acc
}, []).map(elem => elem/4)
}
]
};
return (
<View style={styles.container}>
<ScrollView horizontal={true}>
<BarChart
data={data}
withHorizontalLabels={false}
width={Dimensions.get('window').width * 2}
height={300}
chartConfig={{
backgroundColor: '#fff',
backgroundGradientFrom: '#fff',
backgroundGradientTo: '#fff',
color: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`,
labelColor: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`
}}
style={styles.chart}
/>
</ScrollView>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
width: "90%",
overflow: "hidden",
borderWidth: 1,
borderRadius : 20,
paddingHorizontal: "2%"
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 16
},
chart: {
paddingRight: 0
}
});
export default CrowdingChart;
I've tried changing padding for the container, the chart and the scrollview itself and the width of the scrollview but nothing worked