4

我的 iPad 应用程序使用 Core Plot 有一个散点图,一切运行良好。我想要做的是为线条的绘制设置动画,以便看起来图形上的每个点到点都被绘制在用户面前。我不想让这条线淡入淡出,因为我已经完成了这项工作。

我已经看到下面提出的问题非常相似,但我并不完全理解答案。 Core-Plot - 动画 CPScatterPlot

请记住,我是 Core Plot 的新手,并且只使用了一天左右。

谢谢

4

2 回答 2

3
self.plot.anchorPoint = CGPointMake(0.0, 0.0); // Moved anchor point, 

CABasicAnimation *scaling = [CABasicAnimation 
                                 animationWithKeyPath:@"transform.scale.y"]; // s
scaling.fromValue = [NSNumber numberWithFloat:0.0]; 
scaling.toValue = [NSNumber numberWithFloat:1.0]; 
scaling.duration = 0.1f; // Duration 
scaling.removedOnCompletion = NO; 
scaling.fillMode = kCAFillModeForwards; 
[self.plot addAnimation:scaling forKey:@"scaling"];
于 2012-10-18T20:59:35.313 回答
1

查看 Core Plot 附带的 Plot Gallery 示例应用程序中的“实时演示”图。它使用计时器一次将一个点添加到散点图中。代码可以在这里找到。

-newData:方法将一个点添加到绘图并更新绘图范围,以便新点可见。调用-insertDataAtIndex:numberOfRecords:导致绘图检索新数据点并自动重绘。

于 2011-09-21T22:59:33.873 回答