react-native-animated-charts
react-native-animated-charts copied to clipboard
Can we get current position of dot chart on screen ?
You have to wrap it around the Provider. Look at this source code on how I was able to get it working.
<ChartPathProvider data={data}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: '#ccc',
marginTop: 10,
marginHorizontal: SIZES.width * .04,
}}>
<ChartYLabel
format={formatUSD}
style={{ color: 'green', margin: 4 }}
/>
<ChartXLabel
format={formatDatetime}
style={{ color: 'red', margin: 4 }}
/>
</View>
<View
style={{}}
>
{/* <CurrentPositionVerticalLine stroke={1} backgroundColor={'#fffj'} /> */}
<ChartPath
height={SIZES.height * .25}
width={SIZES.width}
stroke={COLORS.lightGray}
strokeWidth={1.5}
selectedStrokeWidth={1.5}
longPressGestureHandlerProps={{
maxDist: 100000,
minDurationMs: 300,
shouldCancelWhenOutside: true
}}
hitSlop={hitSlop}
hapticsEnabled={hapticsEnabled}
smoothingWhileTransitioningEnabled={
smoothingWhileTransitioningEnabled
}
fill="none"
/>
<ChartDot
style={{
backgroundColor: COLORS.lightGray2,
}}
/>
</View>
</ChartPathProvider>
This implementations works for me. Thanks!
See: https://github.com/rainbow-me/react-native-animated-charts/issues/46#issuecomment-1054171462