IGPieChartView Class Reference

Inherits from UIView
Declared in IGPieChartView.h

Overview

This class represents the pie chart view.

The pie chart view is a data visualization tool that displays a circular graph containing sectors (slices). Pie chart data is a collection of numeric values, and each slice represents one value. Small values that fall below a user-defined threshold are grouped into the Others slice.

The pie chart view supports multiple slice selection and explosion, as well as tooltips, rotation, tap and long press gestures.

Other Methods

  delegate

Sets the IGPieChartViewDelegate for the pie chart view.

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

Declared In

IGPieChartView.h

  dataSource

Sets the data source for the pie chart view. This can be an interface that conforms to IGPieChartViewDataSource protocol or an instance of IGPieChartViewDataSourceHelper.

@property (nonatomic, assign, nullable) id<IGPieChartViewDataSource> dataSource

Declared In

IGPieChartView.h

  dataPoints

Returns an array of IGCategoryPoint objects. (read-only)

@property (nonatomic, readonly) NSMutableArray<__kindofIGCategoryPoint*> *dataPoints

Declared In

IGPieChartView.h

  allowSliceExplosion

Determines whether exploded slices appear exploded or not. When set to false, this property disables all visual cues that indicate that a slice is exploded. All exploded slices will appear as not exploded. Once this property is set to true, any slices that are marked as exploded will visually appear as exploded. Changing the value of this property has no effect on the explodedSlices property.

@property (nonatomic) BOOL allowSliceExplosion

Declared In

IGPieChartView.h

  allowSliceSelection

Determines whether selected slices appear as selected or not. When set to false, this property disables all visual cues that indicate that a slice is selected. All selected slices will appear as not selected. Once this property is set to true, any slices that are marked as selected will visually appear as selected. Changing the value of this property has no effect on the selectedSlices property.

@property (nonatomic) BOOL allowSliceSelection

Declared In

IGPieChartView.h

  brushes

An array of IGBrush objects that are used to color the pie slices. This array takes precedence over themes.

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

Declared In

IGPieChartView.h

  outlines

An array of IGBrush objects that are used to color the slice outlines. This array takes precedence over themes.

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

Declared In

IGPieChartView.h

  explodedRadius

Determines how far away the tip of the slice is from the origin.

@property (nonatomic) CGFloat explodedRadius

Discussion

This property will typically have a value between 0 and 1, where 0 would put the slice at the origin and 1 would put the tip of the slice at a distance equal to the pie’s radius.

Declared In

IGPieChartView.h

  font

Determines the font used by the pie chart labels. This is the default font for the labels of the slices that are not selected. Selected labels and the others label have their own font properties.

@property (nonatomic, retain, nullable) UIFont *font

Declared In

IGPieChartView.h

  fontBrush

Determines the font brush used by the pie char labels. This is the default font brush for the labels of the slices that are not selected. Selected labels and the others label have their own font brush properties.

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

Declared In

IGPieChartView.h

  innerExtent

Determines the amount of white space in the center of the chart. This property can be used to create an empty ring in the middle of the pie chart and make it look like a doughnut chart. The value of this property should be set between 0 and 1.

@property (nonatomic) CGFloat innerExtent

Declared In

IGPieChartView.h

  labelExtent

Determines how far the labels are displayed from the slices.

@property (nonatomic) CGFloat labelExtent

Declared In

IGPieChartView.h

  labelsPosition

Determines where in the pie chart the labels are displayed.

@property (nonatomic) IGLabelsPosition labelsPosition

Discussion

This property can be used to determine the positioning of the labels. Labels can be positioned in the center of the slices, inside the slices towards the outher arc, outside the slices or using best fit approach. This property can also hide the labels by setting it to IGLabelsPositionNone.

Declared In

IGPieChartView.h

  isLeaderLineVisible

Determines if the line from the slice to the label is visible.

@property (nonatomic) BOOL isLeaderLineVisible

Declared In

IGPieChartView.h

  leaderLineBrush

The brush of the leader line.

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

Declared In

IGPieChartView.h

  leaderLineThickness

The thickness of the leader line.

@property (nonatomic) CGFloat leaderLineThickness

Declared In

IGPieChartView.h

  legend

Associates an item legend with the pie chart.

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

Declared In

IGPieChartView.h

  othersCategoryText

Text displayed for the Others slice. The value is “Others” by default.

@property (nonatomic, retain, nullable) NSString *othersCategoryText

Declared In

IGPieChartView.h

  othersCategoryThreshold

Determines how small a value has to be in order to be grouped into the Others slice.

@property (nonatomic) CGFloat othersCategoryThreshold

Declared In

IGPieChartView.h

  othersCategoryType

This property is used along with othersCategoryThreshold to group slices into the Others slice. When set to IGOthersCategoryTypeNumber the value is directly compared with the threshold. When set to IGOthersCategoryTypePercent the comparison is made between the threshold and the value expressed as the percentage of the total.

@property (nonatomic) IGOthersCategoryType othersCategoryType

Declared In

IGPieChartView.h

  showZeroValuesInLegend

@property (nonatomic) BOOL showZeroValuesInLegend

  radiusFactor

Determines the length of the pie radius.

@property (nonatomic) CGFloat radiusFactor

Discussion

The value of this property is multiplied by the length of the radius to produce the final radius.

Declared In

IGPieChartView.h

  selectedSlices

An index collection of selected sliced.

@property (nonatomic, retain, nullable) NSIndexSet *selectedSlices

Discussion

This property contains a set of indices that represent the selected slices. For example, a set of {0,1,3} means that the first, second and fourth slices are selected.

Declared In

IGPieChartView.h

  explodedSlices

An index collection of exploded sliced.

@property (nonatomic, retain, nullable) NSIndexSet *explodedSlices

Discussion

This property contains a set of indices that represent the exploded slices. For example, a set of {0,1,3} means that the first, second and fourth slices are exploded.

Declared In

IGPieChartView.h

  startAngle

Determines the start angle of the pie chart.

@property (nonatomic) CGFloat startAngle

Discussion

This property determines the starting position of the first slice in the pie chart. The value of 0, which is the default value, starts the first slice at 3 o'clock.

Declared In

IGPieChartView.h

  sweepDirection

Determines whether the pie chart is clockwise or counter clockwise.

@property (nonatomic) IGSweepDirection sweepDirection

Declared In

IGPieChartView.h

  theme

This property can be used to apply a theme to a pie chart.

@property (nonatomic, nullable) IGPieChartThemeDefinition *theme

Discussion

This can be a pre-defined or a custom theme. Pre-defined themes can be used by setting this property to one of the themes in IGPieChartDefaultThemes interface.

Declared In

IGPieChartView.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

IGPieChartView.h

  selectedBrush

The fill brush of the selected slice.

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

Declared In

IGPieChartView.h

  selectedOutline

The outline brush of the selected slice.

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

Declared In

IGPieChartView.h

  selectedLabelBrush

The label brush of the selected slice.

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

Declared In

IGPieChartView.h

  selectedStrokeThickness

The stroke thickness of the selected slice.

@property (nonatomic) CGFloat selectedStrokeThickness

Declared In

IGPieChartView.h

  selectedLabelFont

The label font of the selected slice.

@property (nonatomic, retain, nullable) UIFont *selectedLabelFont

Declared In

IGPieChartView.h

  othersCategoryBrush

The fill brush of the Others slice.

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

Declared In

IGPieChartView.h

  othersCategoryOutline

The outline brush of the Others slice.

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

Declared In

IGPieChartView.h

  othersCategoryLabelBrush

The label brush of the Others slice.

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

Declared In

IGPieChartView.h

  othersCategoryStrokeThickness

The stroke thickness of the Others slice.

@property (nonatomic) CGFloat othersCategoryStrokeThickness

Declared In

IGPieChartView.h

  othersCategoryLabelFont

The label font of the Others slice.

@property (nonatomic, retain, nullable) UIFont *othersCategoryLabelFont

Declared In

IGPieChartView.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

IGPieChartView.h

  explodedDisplayStyle

Determines the way exploded slices are rendered. When this property is set to IGPieSliceExplodedDisplayStyleAwayFromCenter (default) exploded slices are displaced from the origin outward. When set to IGPieSliceExplodedDisplayStyleExtendRadius exploded slices remain at the origin, but their radius is extended outward. The radius is increased by a factor of the value in explodedRadius property.

@property (nonatomic) IGPieSliceExplodedDisplayStyle explodedDisplayStyle

Declared In

IGPieChartView.h

Configuring the pie chart view

– rotateSliceWithIndex:toAngle:duration:alignment:

Rotates a slice at a given index to a specific angle position.

- (void)rotateSliceWithIndex:(NSInteger)index toAngle:(CGFloat)angle duration:(NSTimeInterval)duration alignment:(IGPieChartSliceAlignment)alignment

Parameters

index

Index of the slice that will be rotated.

angle

Angle in degrees, to which the slice will be rotated.

duration

Duration in seconds for the rotational animation

alignment

Specifies which part of the slice will be aligned with the angle parameter: start of the slice, middle of the slice, end of the slice.

Declared In

IGPieChartView.h

– rotateSliceWithDataPoint:toAngle:duration:alignment:

Rotates a slice representing a given data point to a specific angle position.

- (void)rotateSliceWithDataPoint:(IGDataPoint *)dataPoint toAngle:(CGFloat)angle duration:(NSTimeInterval)duration alignment:(IGPieChartSliceAlignment)alignment

Parameters

dataPoint

IGDataPoint represented by the slice that will be rotated.

angle

Angle in degrees, to which the slice will be rotated.

duration

Duration in seconds for the rotational animation

alignment

Specifies which part of the slice will be aligned with the angle parameter: start of the slice, middle of the slice, end of the slice.

Declared In

IGPieChartView.h

– getPieSliceAtPoint:

Given a point relative to the IGPieChartView, a slice that exists at that point will be returned.

- (IGPieSliceInfo *)getPieSliceAtPoint:(CGPoint)point

Parameters

point

A CGPoint that is relative to the IGPieChartView

Return Value

An IGPieSliceInfo object if one exists at that point, or nil if there isn’t a slice at the given point.

Declared In

IGPieChartView.h

  exportVisualData

Returns a data representation of the visuals of the pie chart.

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

Discussion

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

Declared In

IGPieChartView.h

Notifying the pie chart view of data source changes

– clearItemsForDataSource:

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

- (void)clearItemsForDataSource:(id<IGPieChartViewDataSource>)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

IGPieChartView.h

– insertItemAtIndex:withSource:

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

- (void)insertItemAtIndex:(NSInteger)index withSource:(id<IGPieChartViewDataSource>)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

IGPieChartView.h

– removeItemAtIndex:withSource:

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

- (void)removeItemAtIndex:(NSInteger)index withSource:(id<IGPieChartViewDataSource>)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

IGPieChartView.h

– replaceItemAtIndex:withSource:

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

- (void)replaceItemAtIndex:(NSInteger)index withSource:(id<IGPieChartViewDataSource>)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

IGPieChartView.h

– updateItemAtIndex:withSource:

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

- (void)updateItemAtIndex:(NSInteger)index withSource:(id<IGPieChartViewDataSource>)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

IGPieChartView.h