Core Plot skipped values Graph

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 02:09:26

问题


i'm trying to draw a Graph with a user-friendly timeline having every day/week (to be decided by time range) as a label at x-axis. However, the datasource values are given on another basis - there might be 10 entries one day and the eleventh comes in a month.

See the photoshop image:

With the latest Core Plot drop I cannot find a way to do it, need your help.

Regards, user792677.


回答1:


The scatter plot asks the datasource for x-y pairs of data. There is no requirement that either value follow some sort of sequence or regular pattern. Other plot types work similarly, although the names and number of data fields can vary.

In your example, return 4 from the -numberOfRecordsForPlot: method. Return the following values from the -numberForPlot:field:recordIndex: method. The table assumes your y-values are calculated by a function f(x), but they can of course come from any source. Use the field parameter to determine whether the plot is asking for the x- or y- value.

Index  X-Value  Y-Value
  0       1       f(1)
  1       3       f(3)
  2       9       f(9)
  3      10      f(10)


来源:https://stackoverflow.com/questions/8165815/core-plot-skipped-values-graph

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