开发者

Core Plot, multi line chart at runtime (CPTestApp for mac example)

What is the best way of creating multiline plot.

Is it possible to have new lines added at the runtime or is there a way of preserving existing line preserved while the plot is refreshed with new data?

I assume开发者_C百科 that new data could be appended to existing array in order to make existing chart line appear as a new chart line (chart line would return to some starting point and continue from thereon as new line), but I had read somewhere that one chart line can not have more than one colour, thus it would be impossible to hide the line between end and start point, or am I wrong?

What would be the best approach?


A single Core Plot graph can contain multiple plots which can all be the same type or a mixture of different types. You can add and remove plots any time. Adding another scatter plot is the easiest way to do what you describe in the question.

If the data for an existing plot changes, you can call -reloadData on the plot to refresh its data, or on the graph to update all plots at once. For better performance with large or frequently updated data sets, plots also have methods to add data points to an existing plot and to remove a subset of the data to allow partial updates of the plot data.

It is true that a single plot can only use one line style for the plot line, but you can leave gaps in the data line by returning nil or [NSNull null] from the datasource.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜