Skip to main content

Legends

  • 2 minutes to read

The Chart3D control can contain the unlimited number of legends. Each legend can display information about series, their colorized point markers or surface fill styles.

Chart3D-Legend-TitleImage

This document explains how to solve the following tasks.

Add and Configure a Legend

To configure a newly added legend, use XAML like the following. Note that the legend title accompanies the legend.

<dxc:Chart3DControl>
    <dxc:Chart3DControl.Legends>
        <dxc:Legend x:Name="legend"
                    HorizontalPosition="Right"
                    VerticalPosition="Top"
                    IndentFromDiagram="16">
            <dxc:Legend.Title>
                <dxc:LegendTitle Content="Legend Title">
            </dxc:Legend.Title>
        </dxc:Legend>
    </dxc:Chart3DControl.Legends>
</dxc:Chart3DControl>

The code above uses the following classes and properties.

Class or Property Description
ChartControlBase.Legends The collection of legends of the Chart3D control.
Legend An individual legend.
LegendBase.IndentFromDiagram Specifies the indent between the legend and the chart.
LegendBase.HorizontalPosition Specifies the horizontal position of the legend.
LegendBase.VerticalPosition Specifies the vertical position of the legend.
LegendBase.Title Specifies options of the legend title.
LegendTitle Legend title options.

The following image demonstrates the result of the code above.

Chart3D-Legends-LegendProperties

Specify Legend Items Shown in a Legend

Each series can provide a legend item to a legend. In addition, colorizers and fill styles also add their legend items to a legend. The following images demonstrate the different available legend item types.

The following XAML demonstrates how legend items can be configured.

<dxc:Series ShowInLegend="True"
            CheckableInLegend="True">
    <dxc:Series.View>
        <dxc:Bar3DSeriesView>
            <dxc:Bar3DSeriesView.Colorizer>
                <dxc:RangeColorizer3D Legend="{Binding ElementName=legend}"
                                      LegendTextPattern="{}{V:F2}">
                    <!--Other options here.-->
                </dxc:RangeColorizer3D>
            </dxc:Bar3DSeriesView.Colorizer>
        </dxc:Bar3DSeriesView>
    </dxc:Series.View>
</dxc:Series>

The XAML above uses the following types and properties.

Class or Property

Description

Series3DBase.ShowInLegend

FillStyleBase.ShowInLegend

Colorizer3DBase.ShowInLegend

Specifies whether a chart element should provide its legend items to a legend.

Series3DBase.Legend

FillStyleBase.Legend

Colorizer3DBase.Legend

Specifies the legend to which legend items of the chart element should be added.

Series3DBase.LegendTextPattern

FillStyleBase.LegendTextPattern

Colorizer3DBase.LegendTextPattern

Configures the text pattern specifying the text to be displayed within legend items.

Series3DBase.CheckableInLegend

Specifies whether the series check box should be shown on the attached legend. Note that, check boxes will be shown within a legend, if its Legend.MarkerMode property is set to CheckBox, MarkerAndCheckBoxor CheckBoxAndMarker.

Series3DBase.CheckedInLegend

Specifies whether the series check box is checked.