Question

I need to create a line graph on iOS. The graph is a time series, with time along the X axis and a percentage value along the Y axis. I need to be able to set both the X and Y position of each sample, because the samples are not taken at a regular interval (ie. the X axis positions are arbitrary). I do not want to normalise the data to a fixed interval, because that will cause rounding and so on. I have tried Core Plot and JBChartView, but I cannot find any way to set the X positions in either of these libraries.

  1. Is there any way to set the X axis position of each sample in these libraries? I've looked through all the protocols, but it's possible I've missed something.

  2. If it is not possible to set the X axis position in either of those libraries, can you recommend a graphing library that has this functionality?

Thanks!

Was it helpful?

Solution 2

Core Plot can absolutely do this. The scatterplot pulls data from its datasource independently for the x- and y-values. Most of the included examples just use the data index for the x-value, but that choice was only to make the examples easier to follow. The x-values can be anything. The examples that use a date scale on the x-axis are one demonstration of this feature. The plot values do not need to be evenly spaced; the data is a series of x-y pairs.

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top