使用核心情节在iPhone上实时绘图? [英] real time plotting on iPhone using core plot?

查看:97
本文介绍了使用核心情节在iPhone上实时绘图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用核心图来动态绘制线图。数据不会一次出现,我们将逐点接收。

I want to use core-plot for drawing line graph dynamically. data won't come at a time, we will be receiving point by point dynamically.

是否可以使用核心绘图动态绘制图表,即逐点绘制当我们收到(x,y)点时?

Is it possible to draw the chart dynamically using core-plot i.e drawing point by point as on when we receive the (x,y) point?

请帮助我,谢谢。

推荐答案

是的,你可以很容易地做到这一点。对于每个接收的数据点,将其附加到要显示的值数组。当这些数据点进入时,在Core Plot图(或者只是特定的图)上调用 -reloadData 来重绘图形,传入刚刚添加了值的数组响应 -numbersForPlot:字段:recordIndexRange:委托方法。

Yes, you can do this reasonably easily. For each received data point, append it to an array of values to display. As these data points come in, call -reloadData on the Core Plot graph (or just the particular plot) to redraw the graph, passing in the array you just added a value to in response to the -numbersForPlot:field:recordIndexRange: delegate method.

如果需要调整绘图范围跟踪您的数据点(对于移动的滚动条),重新计算X轴的新CPPlotRange并将绘图空间的 xRange 属性设置为该值。

If you need to adjust the plot range to track your data points (for a moving ticker), recalculate the new CPPlotRange for the X axis and set the plot space's xRange property to that.

使用 CPTestApp-iPhone AAPLot StockPlot 示例作为模板如何整体设置折线图,并从该起点进行修改。

Use the CPTestApp-iPhone, AAPLot, or StockPlot examples as templates for how to set up the line chart overall, and modify from that starting point.

我做的事情si通过科学应用程序在Mac上对此进行了测试:
alt text http: //www.sunsetlakesoftware.com/sites/default/files/SensingInAirAgain.jpg

I do something similar to this on the Mac in a scientific application: alt text http://www.sunsetlakesoftware.com/sites/default/files/SensingInAirAgain.jpg

这篇关于使用核心情节在iPhone上实时绘图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆