动画核心图散点图

发布于 2024-12-05 17:22:25 字数 320 浏览 5 评论 0原文

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

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

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

谢谢

I have a scatter Graph in my iPad app using Core Plot, and all is working well. What I want to do is animate the drawing of the line so that it looks like each point to point on the graph is being drawn in front of the user. I'm not looking to fade the line in as I have already got this working.

I have seen the question asked below which is very similar, but I don't fully understand the answer.
Core-Plot - animating a CPScatterPlot

Please bare in mind I am new to Core Plot and have only been using it for a day or so.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮倦 2024-12-12 17:22:25
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"];
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"];
没企图 2024-12-12 17:22:25

查看 Core Plot 附带的 Plot Gallery 示例应用程序中的“实时演示”图。它使用计时器一次向散点图添加一个点。代码可以在此处< /a>.

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

Look at the "real time demo" plot in the Plot Gallery example app included with Core Plot. It uses a timer to add points to a scatter plot one at a time. The code can be found here.

The -newData: method adds a point to the plot and updates the plot range so the new point will be visible. The call to -insertDataAtIndex:numberOfRecords: causes the plot to retrieve the new data point and redraw automatically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文