Charts
Charts copied to clipboard
Animation on Y axis not limited to viewport range in Line charts
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.
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?
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.
??
what is "Then the chart was stucked."? a short gif or video is better
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.
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
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?
I am also facing the same problem for Y axis animation. is there any update or work-around to fix this?
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
}