# IGSeriesDataSource Protocol Reference

Conforms to | NSObject |
---|---|

Declared in | Series.h |

## Overview

The IGSeriesDataSource protocol is adopted by an object that mediates the application’s data model for an IGSeries object. The data source provides the series object with the information it needs to construct and modify a chart view.

The required methods of the protocol provide the points to be displayed by the chart view along with the total number of points in the series. There are also optional methods for creating point tooltips.

`– numberOfPointsInSeries:`

required method

Asks the data source for the total number of points in the series.

`- (NSInteger)numberOfPointsInSeries:(IGSeries *)`*series*

#### Parameters

`series` |
Series requesting the information. |
---|

#### Return Value

Returns the number of points in the series.

#### Declared In

`Series.h`

`– series:pointAtIndex:`

required method

Asks the data source for an IGDataPoint to be placed at a given location.

`- (IGDataPoint *)series:(IGSeries *)`*series* pointAtIndex:(NSInteger)*index*

#### Parameters

`series` |
Series requesting the information. |
---|---|

`index` |
Index of the created data point. |

#### Return Value

Returns an object inheriting IGDataPoint that will be used by the series.

#### Declared In

`Series.h`

`– allPointsForSeries:`

Asks the data source for all IGDataPoint objects.

`- (NSArray<__kindofIGDataPoint*> *)allPointsForSeries:(IGSeries *)`*series*

#### Parameters

`series` |
Series requesting the information. |
---|

#### Return Value

Returns an array of IGDataPoint objects.

#### Discussion

This method should only be implemented if your data is already in the IGDataPoint format. Otherwise you should covert your data point by point using the series:pointAtIndex: method.

#### Declared In

`Series.h`

`– series:updatePointAtIndex:`

`- (IGDataPoint *)series:(IGSeries *)`*series* updatePointAtIndex:(NSInteger)*index*

`– series:tooltipForPointAt:`

Asks the data source for a tooltip that will be used for a point at a specified index.

`- (UIView *)series:(IGSeries *)`*series* tooltipForPointAt:(NSInteger)*index*

#### Parameters

`series` |
Series requesting the information. |
---|---|

`index` |
Index of the data point, to which the tooltip will be assigned. |

#### Return Value

Returns a view that will be used as a tooltip.

#### Declared In

`Series.h`

`– objectAtIndex:`

Returns the original data object at a specified index.

`- (NSObject *)objectAtIndex:(NSInteger)`*index*

#### Parameters

`index` |
Index of the data object to be returned. |
---|

#### Return Value

Returns the data object at a specified index.

#### Declared In

`Series.h`

`– objectForDataPoint:inSeries:`

Returns the original data object based on its corresponding data point.

`- (NSObject *)objectForDataPoint:(IGDataPoint *)`*point* inSeries:(IGSeries *)*series*

#### Parameters

`point` |
IGDataPoint that represents the original object. |
---|---|

`series` |
IGSeries that holds the data point. |

#### Return Value

Returns the data object that corresponds to the given data point.

#### Declared In

`Series.h`