Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bars not showing sometimes and fast animation then provided animation time #629

Open
nikhilhooda35 opened this issue May 8, 2024 · 6 comments

Comments

@nikhilhooda35
Copy link

nikhilhooda35 commented May 8, 2024

In the code below [in the second comment], both bar charts are the same. However, the second bar chart behaves as expected, while the first one is very fast in animation, and its bars sometimes disappear. I am attaching a screenshot to illustrate the disappearing issue.

Screenshot 2024-05-08 175634

image

in screenshots you can see now the second one starts acting weird.

@nikhilhooda35
Copy link
Author

nikhilhooda35 commented May 8, 2024

<View>
  <BarChart
    animationDuration={900}
    animationEasing
    overflowTop={30}
    noOfSections={6}
    labelWidth={100}
    width={500}
    barWidth={23}
    spacing={10}
    data={barData}
    stepValue={120}
    yAxisThickness={0}
    xAxisThickness={0}
    isAnimated
    rulesColor={'#fff'}
    rotateLabel={true}
    xAxisTextNumberOfLines={1}
    xAxisLabelsVerticalShift={50}
    xAxisLabelTextStyle={{
      fontSize: 12,
      top: 30,
      left: 12,
      position: 'absolute',
    }}
    renderTooltip={(item, index) => {
      return (
        <View
          style={{
            marginBottom: 5,
            marginLeft: -6,
            backgroundColor: '#ffcefe',
            paddingHorizontal: 6,
            paddingVertical: 4,
            borderRadius: 4,
          }}>
          <Text>{item.value}</Text>
        </View>
      );
    }}
  />

  <BarChart
    animationDuration={900}
    animationEasing
    overflowTop={30}
    noOfSections={6}
    labelWidth={100}
    width={500}
    barWidth={23}
    spacing={10}
    data={barData}
    stepValue={120}
    yAxisThickness={0}
    xAxisThickness={0}
    isAnimated
    rulesColor={'#fff'}
    rotateLabel={true}
    xAxisTextNumberOfLines={1}
    xAxisLabelsVerticalShift={50}
    xAxisLabelTextStyle={{
      fontSize: 12,
      top: 30,
      left: 12,
      position: 'absolute',
    }}
    renderTooltip={(item, index) => {
      return (
        <View
          style={{
            marginBottom: 5,
            marginLeft: -6,
            backgroundColor: '#ffcefe',
            paddingHorizontal: 6,
            paddingVertical: 4,
            borderRadius: 4,
          }}>
          <Text>{item.value}</Text>
        </View>
      );
    }}
  />
</View>

@bekbull
Copy link

bekbull commented Aug 11, 2024

I have the same issue as you. Did you solve it?

<BarChart
    data={chartData}
    frontColor={'#37915B'}
    barWidth={13}
    width={250}
    isAnimated={true}
    onPress={onPressOfBar}
    stepHeight={37}
    barBorderTopLeftRadius={4}
    barBorderTopRightRadius={4}
    spacing={7}
    initialSpacing={1}
    endSpacing={1}
    xAxisLabelTextStyle={{
        fontSize: 10, color: '#000', transform: [{ rotate: '90deg' }, { translateY: 12 }], width: 45,
        textAlign: 'center'
    }}
    xAxisLabelsHeight={11}
    xAxisLabelsVerticalShift={10}
    animationDuration={900}
    // adjustToWidth={true}
/>

@Abhinandan-Kushwaha
Copy link
Owner

Hi @bekbull
Can you share the complete code with data and a video of the output?

@bekbull
Copy link

bekbull commented Aug 12, 2024

Hi @bekbull Can you share the complete code with data and a video of the output?

Hi. I've solved this issue by adding some delay before chart starts rendering.

@coderBeat
Copy link

coderBeat commented Sep 10, 2024

@bekbull
Please, could you give an example how did you add a delay ?

@LinkUpGames
Copy link

@bekbull Same here, I want to know how you added the delay for displaying the animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants