Legends
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview about legends in the IGPieChartView™ control.

In this topic


Introduction

Legend summary

Legends identify the name of a series or its elements represented in the pie chart. The legend is a view that displays a series of legend items. Denoted by a colored icon and a label, each legend item represents a series in the pie chart view. The icon uses the series brush with the label being the series title. The legend can be positioned anywhere in the application’s view and does not have to be part of the pie chart view. Legends are linked to pie charts via the legend property either on the IGPieChartView or on a series. A single legend can be used to display some or all of the series in multiple chart views, although a series may only be bound to one legend view at a time.

Note: If a series does not have a title property set, the label will contain the text, “Series Title” in the legend.

Legend preview

The image below presents an IGPieChartView rendered onto a view that containing a legend in the upper right corner. Each item’s icon in the legend corresponds to the series of the same color.


Adding a Legend to a UIView – Code Example

Description

The following code creates an IGLegend instance and assigns it to the legend property on the IGPieChartView before adding the legend to the subview. With the legend property being set on the chart, the legend will contain items for every series that was added to the IGPieChartView.

Code

In C#:


IGPieChartView pieChartView = new IGPieChartView(new RectangleF(0,0, this.View.Frame.Size.Width, this.View.Frame.Size.Height), IGGridViewStyle.IGGridViewStyleDefault);
pieChart.legend = legend; this.View.AddSubview(pieChartView);

In Objective-C:

IGLegend *legend = [[IGLegend alloc]initWithFrame:CGRectMake(0, 0, 200, 100)];
yourPieChart.legend = legend;
[self.view addSubview:legend];

Related Content

Topics

The following topic provides additional information related to this topic.

Topic

Purpose

This topic serves as a gateway to the features and functionality of the IGPieChartView control.