Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Animation on Y axis not limited to viewport range in Line charts

Open Ella-Sun opened this issue 8 years ago • 9 comments

Using animateWithYAxisDuration...,when array of Y is @[@12372174.19,@12368623.19,@12364962.19,@12366509.19,@12372256.19,@12361333.19],the animation of chart was delayed by a few seconds.I'm don't know the reason.

Ella-Sun avatar May 03 '16 08:05 Ella-Sun

could you dig more? Not sure what you mean delayed a few seconds? Can you try ChartsDemo to see if the animation is delayed as yours?

liuxuan30 avatar May 03 '16 08:05 liuxuan30

NSArray *datas = @[@"1237217.19",@"12368623.19",@"12364962.19",@"12366509.19",@"12372256.19",@"12361333.19"];
    NSInteger i = 0;
    for (NSString *str in datas) {

        double value = [str doubleValue];
        [yVals addObject:[[ChartDataEntry alloc] initWithValue:value xIndex:i++]];
    }
LineChartDataSet *set1 = [[LineChartDataSet alloc] initWithYVals:yVals label:@""];

[self.chartView animateWithXAxisDuration:1.0 yAxisDuration:1.0];



Then the chart was stucked.

Ella-Sun avatar May 06 '16 02:05 Ella-Sun

??

Ella-Sun avatar May 06 '16 02:05 Ella-Sun

what is "Then the chart was stucked."? a short gif or video is better

liuxuan30 avatar May 07 '16 02:05 liuxuan30

https://github.com/Sun-Hong/FormatData/blob/master/Test/stuck.gif chart get stuck on loading. I found that when all the data is similar,this problem would appear.

Ella-Sun avatar May 09 '16 08:05 Ella-Sun

Seems to be a problem with the Y axis being between 123.0 and 123.2. Most of the time the animation is spending is between 0 and 123.0. We need to limit animation on line charts to viewport only

danielgindi avatar May 09 '16 10:05 danielgindi

I've exactly the same problem. Y axis being between e.g. 70 and 100, but the animation starts at 0 (and takes some time until it reaches 70 and starts showing data). Any update on that?

sgreifeneder avatar May 24 '16 11:05 sgreifeneder

I am also facing the same problem for Y axis animation. is there any update or work-around to fix this?

harshadcpatel avatar May 20 '21 12:05 harshadcpatel

I solved it by some custom changes in the ChartEasingFunction(I don't know what is does actually)

lineChartView.animate(yAxisDuration: 3.5) { elapsed, duration in
      return min(elapsed + 2.5, duration) / duration
  }

Pranav108 avatar Feb 06 '24 10:02 Pranav108