Version

Legend

This topic provides information for configuring the UltraPieChart™ in order to use an UltraItemLegend.

Overview

This topic contains the following sections:

Requirements

This article assumes you have already read the Data Binding topic and have a pie chart already bound to some data.

Properties

In order to display a legend next to the UltraPieChart an ItemLegend needs to be created and assigned to the Legend property of the UltraPieChart. You can also set the LegendLabelMemberPath which is responsible for telling the legend which property in the data source to use for each legend item. If no LegendLabelMemberPath is specified then the legend will use the UltraPieChart's LabelMemberPath property instead.

PieChartWithLegend.png

In C#:

ItemLegend legend = new ItemLegend();

UltraPieChart pieChart = new UltraPieChart();
pieChart.ItemsSource = EnergyData;
pieChart.ValueMemberPath = "Coal";
pieChart.LabelMemberPath = "CountryAbbreviation";
pieChart.LegendLabelMemberPath = "Country";
pieChart.Legend = legend;

In Visual Basic:

Dim legend As New ItemLegend()

Dim pieChart As New UltraPieChart()
pieChart.ItemsSource = EnergyData
pieChart.ValueMemberPath = "Coal"
pieChart.LabelMemberPath = "CountryAbbreviation"
pieChart.LegendLabelMemberPath = "Country";
pieChart.Legend = legend

Related Content