Selecting Slices on the IGPieChartView
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview of selecting slices on the IGPieChartView™ control and demonstrates its configuration using a code example.

In this topic


Introduction

Selecting slices summary

A selected pie slice uses an outline, brush color or both to signify its selection. Selected slices use the selectedBrush and selectedOutline properties for applying distinct colors to the selected slices.

One method for creating Selected slices is by adding their index to an NSMutableIndexSet, and then assigning the NSMutableIndexSet instance to the selectedSlices property. Additionally, when using the IGPieChartViewDelegate control’s pieChartView:tapWithItem:atPoint: method, the item parameter contains a reference to the IGPieSliceInfo object, which has a settable property named isSelected that selects or deselects the tapped slice.


Selecting Slices on the IGPieChartView – Code Example

Description

The code below adds two indexes of the IGPieChartView slices to an NSMutableIndexSet and sets this object to the selectedSlices property. The result is a pie chart with two selected slices.

Prerequisites

This code example requires the inclusion of the IG 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();
NSMutableIndexSet selected = new NSMutableIndexSet();
selected.Add(1);
selected.Add(4);
_pieChartView.SelectedSlices = selected;

In Objective-C:

NSMutableIndexSet *selected = [[NSMutableIndexSet alloc]init];
[selected addIndex:1];
[selected addIndex:4];
_pieChartView.selectedSlices = selected;

Related Content

Topics

The following topic provides additional information related to this topic.

Topic

Purpose

The topics in this group cover enabling, configuring, and using the IGPieChartView control’s supported features.