Core-Plot - animating a CPScatterPlot

喜夏-厌秋 提交于 2019-12-09 19:42:05

问题


I'm developing an iPhone application, in which I display a graph using Core-Plot framework. The graph is made of a CPScatterPlot, and what I'm trying to do is to animate the appearance of this plot on the screen.

I'm not looking for a fade-in animation, or for the plot to be slid from the left of the screen. I'd rather like the user to see each point of the graph appearing one at a time (starting from the left), so that it would seem the graph is being traced slowly.

I doubt Core-Plot provides a way to "slow down" the tracing of a graph, so I will probably have to implement this entirely from scratch. Does anyone have a clue on how I could do that ?

Thanks


回答1:


I haven't tried it, but the approach I would use is to use two separate scatterplots that are configured using the same appearance properties (line style, plot symbols, etc.). Make one hidden and load the first point in the other one. Load the first two points in the hidden plot and use Core Animation to make it fade in. When the animation finishes, hide the first plot, load the first three data points in it, and fade it in. Repeat this alternating pattern until all of the data points have been loaded.



来源:https://stackoverflow.com/questions/6411431/core-plot-animating-a-cpscatterplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!