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

Feature request for ChartXLabel overlay

Open pdugan20 opened this issue 5 years ago • 3 comments

Would be really cool to see a pattern like this added in a future release where you could optionally toggle the ChartXLabel to appear as an overlay on the chart itself. It's typically done at the top with a vertical line marking its current position (see the Apple Stock and Robinhood examples).

IMG_0728 IMG_0719

pdugan20 avatar Sep 28 '20 11:09 pdugan20

That would be cool! :)

osdnk avatar Oct 27 '20 23:10 osdnk

I won't guarantee to focus on this, but I think we might need sth similar in Rainbow

osdnk avatar Oct 27 '20 23:10 osdnk

Is this effect achievable somehow?

I'm trying achieve this effect via a <ChartComponent/> inside the ChartPathProvider but it only moves when the screen is re-rendered.

  const ChartComponent = () => {
    const values = useChartData()
    console.log(values.positionX)

    const positionValue = values.positionX.value

    return (
      <View
        style={{
          height: 40,
          width: '100%',
        }}
      >
        <ChartYLabel
          style={{
            position: "absolute",
            color: "#ed8000",
            backgroundColor: "white",
            fontSize: 16,
            left: positionValue,
          }}
        />
      </View>
    )
  }

eridr avatar Jul 05 '21 14:07 eridr