coinjar / react-native-wagmi-charts

A sweet & simple chart library for React Native that will make us feel like We're All Gonna Make It.
MIT License
588 stars 116 forks source link

LineChart Labels #163

Open Lexical-Luke opened 11 months ago

Lexical-Luke commented 11 months ago

I'm trying to place the datetime as labels on my graph. I can add a label by using the Tooltip with the at positioning but it only shows the value. How can I achieve this functionality?

I have tried the code below but it shows a blank label until I use the Cursor, then the timestamp flashes but the Tooltip DatetimeText points to the time at the cursor, not to the at={} point.

Help would be much appreciated.

<LineChart.Tooltip at={1}>
  <LineChart.DatetimeText
    options={{
      hour: "numeric",
      minute: "numeric",
    }}
  />
</LineChart.Tooltip>
cihangir-mercan commented 8 months ago

hey, any solution on this? @Lexical-Luke

cihangir-mercan commented 8 months ago

I did this with custom view:

    <LineChart.Tooltip
                      at={minIndex}
                      position="bottom"
                      cursorGutter={-32}
                    >
      <View style={styles.tooltipWrapper}>
        <Text style={styles.tooltipLabel}>
          En Düşük Değer:
        </Text>
        <Text style={styles.tooltipPrice}>
          {minMaxPrice.minPrice?.price}
        </Text>
      </View>
    </LineChart.Tooltip>