Back to Devexpress

Legends

wpf-117638-controls-and-libraries-charts-suite-chart3d-control-legends.md

latest5.1 KB
Original Source

Legends

  • Oct 05, 2021
  • 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.

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.

xaml
<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 PropertyDescription
ChartControlBase.LegendsThe collection of legends of the Chart3D control.
LegendAn individual legend.
LegendBase.IndentFromDiagramSpecifies the indent between the legend and the chart.
LegendBase.HorizontalPositionSpecifies the horizontal position of the legend.
LegendBase.VerticalPositionSpecifies the vertical position of the legend.
LegendBase.TitleSpecifies options of the legend title.
LegendTitleLegend title options.

The following image demonstrates the result of the code above.

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.

Legend items with markers

Legend items with checkboxes

The gradient legend item

The following XAML demonstrates how legend items can be configured.

xaml
<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 , MarkerAndCheckBox or CheckBoxAndMarker.

| |

Series3DBase.CheckedInLegend

|

Specifies whether the series check box is checked.

|