Legends
Send Feedback

Glossary Item Box

Topic Overview

Purpose

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

In this topic


Introduction

Legend summary

Legends identify the name of a series or its elements represented in the chart plot area. 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 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 chart view. Legends are linked to charts via the legend property either on the IGChartView 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 IGChartView 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 IGChartView 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 IGChartView.

Code

In Objective-C:

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

In C#:

IGLegend legend = new IGLegend();
legend.Frame = new RectangleF(0,0, 200, 100);
chart.Legend = legend;
this.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 IGChartView control.