Version

Legend

This topic provides information for configuring the UltraDataPieChart in order to use an ItemLegend.

Overview

This topic contains the following sections:

Requirements

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

Using the Legend

In order to display a legend for the UltraDataPieChart an ItemLegend needs to be created and assigned to the Legend property. The ItemLegend will display its items in vertical orientation as a default, but this can be configured by setting its Orientation property.

By default, the ItemLegend will show the same content as the label that is shown for each slice in the UltraDataPieChart. This can be modified by utilizing the LegendSliceLabelContentMode property on the chart. This exposes a RadialLabelMode enumeration that can allow you to show the label, value, percentage, or any combination of those as the legend’s content for each data pie chart slice.

The ItemLegend badge is also able to be modified. By default, it will appear as a filled circle corresponding to the color of the associated data pie chart slice. This can be configured by using the LegendItemBadgeShape property of the chart and you can set this to be a circle, line, bar, column, and more.

Code Example

In C#:

UltraItemLegend legend = new UltraItemLegend()
{
    Dock = DockStyle.Top,
    Orientation = Orientation.Horizontal
};

UltraDataPieChart dataPieChart = new UltraDataPieChart()
{
    Dock = DockStyle.Fill,
    DataSource = data,
    Legend = legend
};

this.Controls.Add(dataPieChart);
this.Controls.Add(legend);

Related Content