ORKGraphChartViewDataSource Protocol Reference

Conforms to NSObject
Declared in ORKGraphChartView.h

An object that adopts the ORKGraphChartViewDataSource protocol is responsible for providing the data required to populate an ORKGraphChartView object.

At a minimum, a data source object must implement the graphChartView:numberOfPointsInPlot: and graphChartView:plot:valueForPointAtIndex: methods. These methods return the number of points in a plot and the points themselves. Each point in a plot is represented by an object of the ORKRangedPoint class. A data source object may provide additional information to the graph chart view by implementing the optional methods.

When configuring an ORKGraphChartView object, assign your data source to its dataSource property.

– graphChartView:numberOfPointsForPlotIndex: required method

Asks the data source for the number of range points to be plotted by the graph chart view at the specified plot index.

- (NSInteger)graphChartView:(ORKGraphChartView *)graphChartView numberOfPointsForPlotIndex:(NSInteger)plotIndex

Parameters

graphChartView

The graph chart view asking for the number of range points.

plotIndex

An index number identifying the plot in the graph chart view. This index is 0 in a single-plot graph chart view.

Return Value

The number of range points in the plot at plotIndex.

Declared In

ORKGraphChartView.h

– graphChartView:pointForPointIndex:plotIndex: required method

Asks the data source for the range point to be plotted at the specified point index for the specified plot.

- (ORKRangedPoint *)graphChartView:(ORKGraphChartView *)graphChartView pointForPointIndex:(NSInteger)pointIndex plotIndex:(NSInteger)plotIndex

Parameters

graphChartView

The graph chart view that is asking for the range point.

pointIndex

An index number identifying the range point in the graph chart view.

plotIndex

An index number identifying the plot in the graph chart view. This index is 0 in a single-plot graph chart view.

Return Value

The range point specified by pointIndex in the plot specified by plotIndex for the specified graph chart view`.

Declared In

ORKGraphChartView.h

– numberOfPlotsInGraphChartView:

Asks the data source for the number of plots to be plotted by the graph chart view. If this method is not implemented, the graph chart view assumes that it has a single plot.

- (NSInteger)numberOfPlotsInGraphChartView:(ORKGraphChartView *)graphChartView

Parameters

graphChartView

The graph chart view asking for the number of plots.

Return Value

The number of plots in the graph chart view.

Declared In

ORKGraphChartView.h

– graphChartView:colorForPlotIndex:

Asks the data source for the color of the specified plot.

- (UIColor *)graphChartView:(ORKGraphChartView *)graphChartView colorForPlotIndex:(NSInteger)plotIndex

Parameters

graphChartView

The graph chart view asking for the color of the segment.

plotIndex

An index number identifying the plot in the graph chart view. This index is always 0 in single-plot graph chart views.

Return Value

The color of the segment at the specified index in a pie chart view.

Discussion

If this method is not implemented, the first plot uses the graph chart view tintColor, and all subsequent plots uses the current referenceLineColor.

Declared In

ORKGraphChartView.h

– scrubbingPlotIndexForGraphChartView:

Asks the data source which plot the scrubber should snap to in multigraph chart views.

- (NSInteger)scrubbingPlotIndexForGraphChartView:(ORKGraphChartView *)graphChartView

Parameters

graphChartView

The graph chart view asking for the scrubbing plot index.

Return Value

The index of the plot that the scrubber should snap to.

Discussion

If this method is not implemented, the scrubber snaps over the first plot.

Declared In

ORKGraphChartView.h

– maximumValueForGraphChartView:

Asks the data source for the upper limit of the y-axis drawn by the graph chart view.

- (CGFloat)maximumValueForGraphChartView:(ORKGraphChartView *)graphChartView

Parameters

graphChartView

The graph chart view asking for the maximum value.

Return Value

The maximum value of the y-axis drawn by graphChartView.

Discussion

If this method is not implemented, the greatest maximumValue of all ORKRangedPoint instances returned in graphChartView:plot:valueForPointAtIndex: is used.

See also: graphChartView:plot:valueForPointAtIndex:.

Declared In

ORKGraphChartView.h

– minimumValueForGraphChartView:

Asks the data source for the lower limit of the y-axis drawn by the graph chart view.

- (CGFloat)minimumValueForGraphChartView:(ORKGraphChartView *)graphChartView

Parameters

graphChartView

The graph chart view asking for the minimum value.

Return Value

The minimum value of the y-axis drawn by graphChartView.

Discussion

If this method is not implemented, the smallest minimumValue of all ORKRangedPoint instances returned in graphChartView:plot:valueForPointAtIndex: is used.

See also: graphChartView:plot:valueForPointAtIndex:.

Declared In

ORKGraphChartView.h

– numberOfDivisionsInXAxisForGraphChartView:

Asks the data source for the number of divisions in the x-axis. The value is ignored if it is lower than the number of data points. A title appearing adjacent to each division may optionally be returned by the graphChartView:titleForXAxisAtPointIndex: method.

- (NSInteger)numberOfDivisionsInXAxisForGraphChartView:(ORKGraphChartView *)graphChartView

Parameters

graphChartView

The graph chart view asking for the number of divisions in its x-axis.

Return Value

The number of divisions in the x-axis for graphChartView.

Declared In

ORKGraphChartView.h

– graphChartView:titleForXAxisAtPointIndex:

Asks the data source for the title to be displayed adjacent to each division in the x-axis (the number returned by numberOfDivisionsInXAxisForGraphChartView:). You can return nil from this method if you don’t want to display a title for the specified point index.

- (nullable NSString *)graphChartView:(ORKGraphChartView *)graphChartView titleForXAxisAtPointIndex:(NSInteger)pointIndex

Parameters

graphChartView

The graph chart view asking for the title.

pointIndex

The index of the specified x-axis division.

Return Value

The title string to be displayed adjacent to each division of the x-axis of the graph chart view.

Discussion

If this method is not implemented, the x-axis has no titles.

See also: numberOfDivisionsInXAxisForGraphChartView:.

Declared In

ORKGraphChartView.h

– graphChartView:drawsVerticalReferenceLineAtPointIndex:

Asks the data source if the vertical reference line at the specified point index should be drawn..

- (BOOL)graphChartView:(ORKGraphChartView *)graphChartView drawsVerticalReferenceLineAtPointIndex:(NSInteger)pointIndex

Parameters

graphChartView

The graph view asking for the tile.

pointIndex

The index corresponding to the number returned by numberOfDivisionsInXAxisForGraphChartView:.

Return Value

Whether the graph chart view should draw the vertical reference line.

Discussion

If this method is not implemented, the graph chart view will draw all vertical reference lines.

Declared In

ORKGraphChartView.h