Abhinandan-Kushwaha / react-native-gifted-charts

The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.
https://www.npmjs.com/package/react-native-gifted-charts
MIT License
792 stars 153 forks source link

isAnimated on bar chart animates from the wrong direction #868

Open jcseo3 opened 1 month ago

jcseo3 commented 1 month ago

Description

https://github.com/user-attachments/assets/37d9e6ea-2c2f-4b00-8724-1c636d301e0a

I have a bar chart component on which I have set the isAnimated prop to be true. When I do this, it seems like on initial render the chart animates as expected (from the y = 0 point of the axis), but on data change, it animates from all different directions. I don't believe we had this issue when using version ^1.4.10 but seems to have broken at some point after.

(as far as I can tell, animation works as expected up to version 1.4.30 of the package)

Thank you for your attention to this matter!

Steps to reproduce

here are the bar chart component props I am using

<BarChart
          yAxisTextStyle={...}
          data={chartData}
          height={125}
          barBorderRadius={2}
          disableScroll
          spacing={5}
          isAnimated={true}
          onPress={(_item, index) => {
          ...
            setSelectedWeekIndex(index);
          }}
          yAxisThickness={0}
          formatYLabel={(label) => {...}
          yAxisSide={yAxisSides.RIGHT}
          roundToDigits
          noOfSections={2}
          hideRules
          referenceLinesOverChartContent={false}
          showReferenceLine1
          referenceLine1Position={maxVal / 2}
          referenceLine1Config={...}
          showReferenceLine2
          referenceLine2Position={maxVal}
          referenceLine2Config={...}
          scrollToEnd
          minHeight={5}
        />

Snack or a link to a repository

No response

version of react-native-gifted-charts

1.4.44

React Native version

0.73.6

Platforms

iOS

Workflow

React Native

Abhinandan-Kushwaha commented 1 month ago

Hi @jcseo3 👋 Can you share the data and the exact code you are using? Coz I am unable repro this issue in my local.