IGChartView Class Reference

Inherits from UIView
Conforms to UIScrollViewDelegate
Declared in IGChartView.h

Overview

A chart view is a data visualization control that creates a graphical representation of the user’s data. This control is designed to display high amounts of data and can handle constant data updates.

A chart view consists of two or more IGAxis objects and one or more IGSeries objects. The type of axes will depend on which series are used in the chart view. Each IGSeries object has a detailed description about axes requirements. The chart view supports an unlimited number of axes and an unlimited number of series. A typical chart view may include an IGCategoryXAxis, an IGNumericYAxis and a series such as IGColumnSeries.

Other Methods

  delegate

Sets the IGChartViewDelegate for the chart view

@property (nonatomic, assign, nullable) id<IGChartViewDelegate> delegate

Declared In

IGChartView.h

  axes

Returns an array of IGAxis objects used by the chart view. (read-only)

@property (nonatomic, readonly) NSArray<__kindofIGAxis*> *axes

Discussion

This property will return a read-only list of axes. To add or remove an axis, use addAxis and removeAxis methods.

Declared In

IGChartView.h

  series

Returns an array of IGSeries objects used by the chart view. (read-only)

@property (nonatomic, readonly) NSArray<__kindofIGSeries*> *series

Discussion

This property will return a read-only list of series. To add or remove a series, use addSeries and removeSeries methods.

Declared In

IGChartView.h

  brushes

Returns an array of IGBrush objects used by the chart’s series.

@property (nonatomic, retain, nullable) NSArray<__kindofIGBrush*> *brushes

Discussion

This property will return a list of brushes used by the series. Each of the chart’s series will use a brush from the brushes array in the same order. Setting a brush on a series directly takes precedence over this array, in which case, the brush from the array will be skipped over.

Declared In

IGChartView.h

  markerBrushes

Returns an array of IGBrush objects used by the chart’s series markers.

@property (nonatomic, retain, nullable) NSArray<__kindofIGBrush*> *markerBrushes

Discussion

This property will return a list of brushes used by the series markers. Each of the chart’s series will use a marker brush from the markerBrushes array in the same order. Setting a marker brush on a series directly takes precedence over this array, in which case, the brush from the array will be skipped over.

Declared In

IGChartView.h

  outlines

Returns an array of IGBrush objects used to draw a border around the series shapes.

@property (nonatomic, retain, nullable) NSArray<__kindofIGBrush*> *outlines

Discussion

This property will return a list of outlines used by the series. Each of the chart’s series will use an outline from the outlines array in the same order. Setting an outline on a series directly takes precedence over this array, in which case, the outline from the array will be skipped over.

Declared In

IGChartView.h

  markerOutlines

Returns an array of IGBrush objects used to draw a border around the series markers.

@property (nonatomic, retain, nullable) NSArray<__kindofIGBrush*> *markerOutlines

Discussion

This property will return a list of outlines used by the series markers. Each of the chart’s series will use a marker outline from the markerOutlines array in the same order. Setting a marker outline on a series directly takes precedence over this array, in which case, the outline from the array will be skipped over. To add or remove an outline, use addMarkerOutline and removeMarkerOutline methods.

Declared In

IGChartView.h

  plotAreaBrush

Represents the brush used to color the chart view’s plot area.

@property (nonatomic, retain, nullable) IGBrush *plotAreaBrush

Discussion

The plot area is the portion of the chart view that contains axis lines, axis gridlines and all the series. It excludes the region marked by the axis extent.

Declared In

IGChartView.h

  plotAreaRect

@property (nonatomic, readonly) CGRect plotAreaRect

  gridMode

Determines how the grid lines are displayed.

@property (nonatomic) IGGridMode gridMode

Discussion

This enumeration property determines whether the grid lines are displayed on top of all series or underneath them. The enumeration is of type IGGridMode

Declared In

IGChartView.h

  isSquare

A Boolean value indicating whether a square aspect ratio should be used for the chart view.

@property (nonatomic) BOOL isSquare

Discussion

A square aspect ratio is locked to YES for polar and radial charts.

Declared In

IGChartView.h

  theme

An object that defines a set of brushes and fonts that will be used to style the chart.

@property (nonatomic, retain, nullable) IGChartThemeDefinition *theme

Declared In

IGChartView.h

  legend

Specifies the legend control used by the chart.

@property (nonatomic, assign, nullable) IGLegendBase *legend

Discussion

This property lets the user set a reference to an existing legend control. When this property is set, all series in the chart will use the specified legend, unless a series has a legend property set directly on it.

Declared In

IGChartView.h

  tooltipPinLocation

Specifies the tooltip location.

@property (nonatomic) IGTooltipPinLocation tooltipPinLocation

Discussion

This property determines where the tooltip will be positioned. The default setting uses a floating tooltip, which follows the location of the long press. Tooltip can also be pinned to top, bottom, left, or right.

Declared In

IGChartView.h

  zoomDisplayType

Specifies zooming capabilities of the char view.

@property (nonatomic) IGChartZoom zoomDisplayType

Discussion

This property can be used to lock the zooming functionality entirely or allow zooming in either or both directions. By default, zooming is unrestricted. For polar and radial series, zooming should either be set to Both or None; setting to either Vertical or Horizontal will be treated as setting zooming to Both.

Declared In

IGChartView.h

  zoomScale

Specifies the zoom scale.

@property (nonatomic) CGFloat zoomScale

Discussion

This property determines what the chart view’s zoom scale should be. The default value is 1, which means fully zoomed out.

Declared In

IGChartView.h

  minimumZoomScale

Specifies the minimum zoom scale.

@property (nonatomic) CGFloat minimumZoomScale

Discussion

This property determines how far the chart view should be allowed to zoom out. The default value is 1. Set minimumZoomScale to be greater than maximumZoomScale to disable zooming.

Declared In

IGChartView.h

  maximumZoomScale

Specifies the maximum zoom scale.

@property (nonatomic) CGFloat maximumZoomScale

Discussion

This property determines how far the chart view should be allowed to zoom in. The default value is 200. Set minimumZoomScale to be greater than maximumZoomScale to disable zooming.

Declared In

IGChartView.h

  zoomContentOffset

The point at which the origin of the content view is offset from the origin of the chart view.

@property (nonatomic) CGPoint zoomContentOffset

Declared In

IGChartView.h

  bouncesHorizontally

Determines whether the chart will be allowed to bounce when panning horizontally.

@property (nonatomic) BOOL bouncesHorizontally

Discussion

This property is set to YES by default. It allows a zoomed in chart to be panned past its horizontal limit. The chart will bounce back to its horizontal limit after the gesture is finished.

Declared In

IGChartView.h

  bouncesVertically

Determines whether the chart will be allowed to bounce when panning vertically.

@property (nonatomic) BOOL bouncesVertically

Discussion

This property is set to YES by default. It allows a zoomed in chart to be panned past its vertical limit. The chart will bounce back to its vertical limit after the gesture is finished.

Declared In

IGChartView.h

  bouncesZoom

Determines whether the chart will be allowed to zoom past its limit.

@property (nonatomic) BOOL bouncesZoom

Declared In

IGChartView.h

  crosshairsThickness

The thickness of the crosshair lines.

@property (nonatomic) CGFloat crosshairsThickness

Discussion

This property determines the thickness of both crosshairs. The default value is 1.5.

Declared In

IGChartView.h

  crosshairsBackground

The color of the crosshairs.

@property (nonatomic, retain, nullable) UIColor *crosshairsBackground

Declared In

IGChartView.h

  crosshairsVisibility

Determines the visibility of the crosshairs.

@property (nonatomic) IGCrosshairsVisibility crosshairsVisibility

Discussion

The chart view can display both crosshairs, vertical or horizontal, or none.

Declared In

IGChartView.h

  antiAliasing

Gets or sets when anti-aliasing should occur while rendering the chart.

@property (nonatomic, assign) IGChartAntiAliasing antiAliasing

Discussion

Setting this property to IGChartAntiAliasingAlways will result in the best looking chart, however it will have slower performance. Setting it to IGChartAntiAliasingNever will result in the best performance, however the chart will not be rendered smoothly. The last option, which is also the default, IGChartAntiAliasingAlwaysExceptWhilePanningAndZooming, will result in the chart looking smooth, except while zooming and panning, however the zooming and panning operations will be much faster.

Declared In

IGChartView.h

  animateSeriesWhenAxisRangeChanges

Specifies whether series animation will proceed when a change in the axis range has been detected.

@property (nonatomic) BOOL animateSeriesWhenAxisRangeChanges

Declared In

IGChartView.h

  renderingQuality

Determines the rendering quality of the chart. This property only affects retina displays. By default, the chart will render with high quality. If the chart contains too many data points and its performance begins to degrade due to a high number of shapes, setting a lower rendering quality will increase the performance.

@property (nonatomic) IGRenderingQuality renderingQuality

Declared In

IGChartView.h

  zoombar

Gets or sets the IGRangeSelectorView which can be used to control a single axis zoom if the Chart’s zoomDisplayType is set to IGChartZoomHorizontal or IGChartZoomVertical.

@property (nonatomic, nullable) IGRangeSelectorView *zoombar

Discussion

This property does not retain a reference to the IGRangeSelectorView so that control should be retained on the ViewController level.

Declared In

IGChartView.h

  horizontalAutoMargin

Determines the width of the margin on the left/right of the chart when adding auto margins. The side of the chart that does not use any label panels will create an auto margin. The default value is 20 pixels. The left/right side of the chart that does not use any label panels will create an auto margin. The default value is 20 pixels.

@property (nonatomic) CGFloat horizontalAutoMargin

Declared In

IGChartView.h

  verticalAutoMargin

Determines the height of the margin at the top/bottom of the chart when adding auto margins.

@property (nonatomic) CGFloat verticalAutoMargin

Discussion

The top/bottom side of the chart that does not use any label panels will create an auto margin. This margin defaults to the half of the chart’s resolved font height.

Declared In

IGChartView.h

  plotAreaLeftMargin

@property (nonatomic) CGFloat plotAreaLeftMargin

  plotAreaTopMargin

@property (nonatomic) CGFloat plotAreaTopMargin

  plotAreaRightMargin

@property (nonatomic) CGFloat plotAreaRightMargin

  plotAreaBottomMargin

@property (nonatomic) CGFloat plotAreaBottomMargin

  panGestureRecognizer

@property (nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer

  pinchGestureRecognizer

@property (nonatomic, readonly) UIPinchGestureRecognizer *pinchGestureRecognizer

  alignsGridLinesToPixels

When set to true, ensures that the chart’s gridlines don’t get drawn between pixels.

@property (nonatomic) BOOL alignsGridLinesToPixels

Declared In

IGChartView.h

Initializing the chart view

– initWithFrame:

Initializes the chart view with a given frame

- (instancetype)initWithFrame:(CGRect)frame

Parameters

frame

A rectangular frame that specifies the location and size of the chart view.

Return Value

Returns an initialized IGChartView object.

Declared In

IGChartView.h

Configuring the chart view

– addAxis:

Adds an axis to the chart view.

- (void)addAxis:(IGAxis *)axis

Parameters

axis

Axis object to be added to the chart view.

Declared In

IGChartView.h

– removeAxis:

Removes a specified axis from the chart view.

- (void)removeAxis:(IGAxis *)axis

Parameters

axis

Axis object to be removed from the chart view.

Declared In

IGChartView.h

– findAxisByKey:

Gets an axis from the chart for a specified key.

- (IGAxis *)findAxisByKey:(NSString *)key

Parameters

key

Unique axis identifier key.

Discussion

This method returns a reference to the axis in the chart’s axes array for a given key. If the axis cannot be found the method returns nil.

Declared In

IGChartView.h

– addSeries:

Adds a series to the chart view.

- (void)addSeries:(IGSeries *)series

Parameters

series

Series to be added to the chart view.

Declared In

IGChartView.h

– removeSeries:

Removes a specified series from the chart view.

- (void)removeSeries:(IGSeries *)series

Parameters

series

Series to be removed from the chart view.

Declared In

IGChartView.h

– findSeriesByKey:

Gets a series form the chart for a specified key.

- (IGSeries *)findSeriesByKey:(NSString *)key

Parameters

key

Unique series identifier key.

Discussion

This method returns a reference to the series in the chart’s series array for a given key. If the series cannot be found the method returns nil.

Declared In

IGChartView.h

– findSeriesAtPoint:

Gets a series object at given coordinates.

- (IGSeries *)findSeriesAtPoint:(CGPoint)point

Parameters

point

CGPoint used to look up a series.

Return Value

IGSeries corresponding to the given point.

Discussion

Given a specific point, the chart view will try to get an IGSeries, containing that point.

Declared In

IGChartView.h

– findStackedFragmentSeriesAtPoint:

Gets a stacked fragment series at given coordinates.

- (IGStackedFragmentSeries *)findStackedFragmentSeriesAtPoint:(CGPoint)point

Parameters

point

CGPoint used to look up a stacked fragment series.

Return Value

Stacked fragment series corresponding to the given point.

Discussion

This method is useful when trying to handle user interactions on stacked series. When provided with valid coordinates, the chart will find a matching IGStackedFragmentSeries.

Declared In

IGChartView.h

– addSeriesForType:usingKey:withDataSource:firstAxisKey:secondAxisKey:

Creates a series from a series type and adds it to the chart.

- (IGSeries *)addSeriesForType:(Class)seriesType usingKey:(NSString *)seriesKey withDataSource:(id<IGSeriesDataSource>)dataSource firstAxisKey:(NSString *)axisKey1 secondAxisKey:(NSString *)axisKey2

Parameters

seriesType

Series type, such as IGColumnSeries or IGFinancialSeries.

seriesKey

A unique series string identifier.

dataSource

Series data source.

axisKey1

First axis key.

axisKey2

Second axis key.

Return Value

Returns a new instance of a series that was added to the chart.

Discussion

This method creates an IGSeries based on the specified series type. It also creates appropriate axes based on the specified axis keys. If any of the keys already exist, the chart will attempt to use that axis, provided that the axis type can be applied to the series. The first axis key is typically the X axis, while the second key is the Y axis. For polar and radial series, the first axis key is the angle axis, while the second key is the radius axis.

Declared In

IGChartView.h

– addStackedSeriesForType:usingKey:withDataSource:firstAxisKey:secondAxisKey:

Creates a stacked series from a series type and adds it to the chart.

- (IGStackedSeriesBase *)addStackedSeriesForType:(Class)seriesType usingKey:(NSString *)seriesKey withDataSource:(id<IGStackedSeriesDataSource>)dataSource firstAxisKey:(NSString *)axisKey1 secondAxisKey:(NSString *)axisKey2

Parameters

seriesType

Series type, such as IGStackedColumnSeries.

seriesKey

A unique series string identifier.

dataSource

Series data source.

axisKey1

First axis key.

axisKey2

Second axis key.

Return Value

Returns a new instance of a stacked series that was added to the chart.

Discussion

This method creates a stacked series based on the specified series type. It also creates appropriate axes based on the specified axis keys. If any of the keys already exist, the chart will attempt to use that axis, provided that the axis type can be applied to the series. The first axis key is the X axis, while the second key is the Y axis.

Declared In

IGChartView.h

– refresh

Causes the chart view to refresh itself.

- (void)refresh

Declared In

IGChartView.h

  exportVisualData

Returns a data representation of the visuals of the chart.

@property (NS_NONATOMIC_IOSONLY, readonly, strong) VisualChartData *exportVisualData

Discussion

This method is available to provide a way to do validation for testing of the visuals of the chart.

Declared In

IGChartView.h

Notifying the chart view of data source changes

– clearItemsForDataSource:

Notifies the chart view that all items in the data source were cleared.

- (void)clearItemsForDataSource:(id<IGSeriesDataSource>)source

Parameters

source

Data source that had its items removed.

Discussion

This method is used to tell the chart view that all of the items in a given data source have been removed.

Declared In

IGChartView.h

– clearItemsForStackedDataSource:

Notifies the chart view that all items in the stacked data source were cleared.

- (void)clearItemsForStackedDataSource:(id<IGStackedSeriesDataSource>)source

Parameters

source

Data source that had its items removed.

Discussion

This method is used to tell the chart view that all of the items in a given data source have been removed.

Declared In

IGChartView.h

– insertItemAtIndex:withSource:

Notifies the chart view that an item has been inserted in the data source.

- (void)insertItemAtIndex:(NSInteger)index withSource:(id<IGSeriesDataSource>)source

Parameters

index

Index of an item that has been inserted.

source

Data source that had an item inserted.

Discussion

This method is used to tell the chart view that an item has been inserted into a given data source at a given index.

Declared In

IGChartView.h

– insertStackedItemAtIndex:withSource:

Notifies the chart view that an item has been inserted in the stacked data source.

- (void)insertStackedItemAtIndex:(NSInteger)index withSource:(id<IGStackedSeriesDataSource>)source

Parameters

index

Index of an item that has been inserted.

source

Data source that had an item inserted.

Discussion

This method is used to tell the chart view that an item has been inserted into a given data source at a given index.

Declared In

IGChartView.h

– removeItemAtIndex:withSource:

Notifies the chart view that an item has been removed from the data source.

- (void)removeItemAtIndex:(NSInteger)index withSource:(id<IGSeriesDataSource>)source

Parameters

index

Index of an item that has been removed.

source

Data source that had an item removed.

Discussion

This method is used to tell the chart view that an item has been removed from a given data source at a given index.

Declared In

IGChartView.h

– removeStackedItemAtIndex:withSource:

Notifies the chart view that an item has been removed from the stacked data source.

- (void)removeStackedItemAtIndex:(NSInteger)index withSource:(id<IGStackedSeriesDataSource>)source

Parameters

index

Index of an item that has been removed.

source

Data source that had an item removed.

Discussion

This method is used to tell the chart view that an item has been removed from a given data source at a given index.

Declared In

IGChartView.h

– replaceItemAtIndex:withSource:

Notifies the chart view that an item has been replaced in the data source.

- (void)replaceItemAtIndex:(NSInteger)index withSource:(id<IGSeriesDataSource>)source

Parameters

index

Index of an item that has been replaced.

source

Data source that had an item replaced.

Discussion

This method is used to tell the chart view that an item has been replaced in a given data source at a given index.

Declared In

IGChartView.h

– replaceStackedItemAtIndex:withSource:

Notifies the chart view that an item has been replaced in the stacked data source.

- (void)replaceStackedItemAtIndex:(NSInteger)index withSource:(id<IGStackedSeriesDataSource>)source

Parameters

index

Index of an item that has been replaced.

source

Data source that had an item replaced.

Discussion

This method is used to tell the chart view that an item has been replaced in a given data source at a given index.

Declared In

IGChartView.h

– updateItemAtIndex:withSource:

Notifies the chart view that an item has been updated in the data source.

- (void)updateItemAtIndex:(NSInteger)index withSource:(id<IGSeriesDataSource>)source

Parameters

index

Index of an item that has been replaced.

source

Data source that had an item replaced.

Discussion

This method is used to tell the chart view that an item has been updated in a given data source at a given index.

Declared In

IGChartView.h

– updateStackedItemAtIndex:withSource:forFragment:

Notifies the chart view that an item has been updated in the stacked data source.

- (void)updateStackedItemAtIndex:(NSInteger)index withSource:(id<IGStackedSeriesDataSource>)source forFragment:(IGStackedFragmentSeries *)fragment

Parameters

index

Index of an item that has been replaced.

source

Data source that had an item replaced.

fragment

Stacked fragment containing the replaced item.

Discussion

This method is used to tell the chart view that an item has been updated in a given data source at a given index.

Declared In

IGChartView.h