react-native-animated-charts icon indicating copy to clipboard operation
react-native-animated-charts copied to clipboard

Can we get current position of dot chart on screen ?

Open ModaxDev opened this issue 3 years ago • 3 comments

ModaxDev avatar Nov 28 '21 13:11 ModaxDev

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>

ajimae avatar Dec 06 '21 20:12 ajimae

This implementations works for me. Thanks!

oliverloops avatar Jan 04 '22 22:01 oliverloops

See: https://github.com/rainbow-me/react-native-animated-charts/issues/46#issuecomment-1054171462

jay-jlm avatar Feb 28 '22 11:02 jay-jlm