IGPieChart Data Source Helper
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of data source helper in the IGPieChartView™ and demonstrates its configuration using a code example.

In this topic


Introduction

Data source helper summary

Using the IGPieChartViewDataSourceHelper eliminates the need to implement any of the required protocol methods found in the IGPieChartViewDataSource class. Thus, simplifying your wiring up of data to the IGPieChartView control by using the data source helper specialized for this control.

The IGPieChartViewDataSourceHelper is extremely flexible in how the values and labels load. These initialization methods support directly loading your data arrays or loading them with an array custom NSObjects.

  • initWithData:valuePath:labelPath:
  • initWithData:valuePath:
  • initWithValues:
  • initWithValues:labels:

Additionally, you can initialize the IGPieChartViewDataSourceHelper using the generic init method, and depending on the use case, manually set the; data, values, labels, valuePath, labelPath, properties.


IGPieChartView Data Source Helper – Code Example

Description

The code below demonstrates loading an NSMutableArray of NSObjects containing values for the pie slice and the label properties. Once initialized, and after loading data and values into the IGPieChartViewDataSourceHelper control, you can assign an instance of the data source helper to the IGPieChartView control’s dataSource property.

Prerequisites

This code example requires the inclusion of the Chart framework, detail about how to add this framework can be found in the Adding the Chart Framework File topic.

Code

In C#:

IGPieChartView pieChartView = new IGPieChartView();
NSMutableArray data = new NSMutableArray();
// ...Add NSObjects to the array, the NSObject in this example must contain the property named “value” and a property named “label”
IGPieChartViewDataSourceHelper pieChartDataSourceHelper = new IGPieChartViewDataSourceHelper(data, "value", "label");
//...
pieChartView.DataSource = pieChartDataSourceHelper;

In Objective-C:

NSMutableArray *data = [[NSMutableArray alloc]init];
// ...Add NSObjects to the array, the NSObject in this example must contain the property named “value” and a property named “label”
IGPieChartViewDataSourceHelper *pieChartDataSourceHelper = [[IGPieChartViewDataSourceHelper alloc]initWithData:data valuePath:@"value" labelPath:@"label"];
//...
pieChartView.dataSource = pieChartDataSourceHelper;

Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

To help you get up and running with the IGPieChartView control this topic provides basic information about creating an instance of the control to display a pie chart.