Positioning Data Markers in WPF 3D Chart

18 Nov 20186 minutes to read

The positioning of adornments inside the series is defined using the AdornmentPosition property.

  • Top - Positions the Adornment at the top edge point of a chart segment.
  • Bottom - Positions the Adornment at the bottom edge point of a chart segment.
  • TopAndBottom - Positions the Adornment at the center point of a chart segment.

This behavior varies based on the chart series type.

The following code example shows how to specify the adornments position:

<chart:ColumnSeries3D  
    ItemsSource="{Binding CategoricalData}" 
    XBindingPath="Year"
    YBindingPath="Plastic">
    <chart:ColumnSeries3D.AdornmentsInfo>
        <chart:ChartAdornmentInfo3D 
            ShowMarker="True" 
            SymbolHeight="10" 
            SymbolWidth="10" 
            Symbol="Diamond" 
            AdornmentsPosition="TopAndBottom" 
            SymbolInterior="#FF64B5F6">
        </chart:ChartAdornmentInfo3D>
    </chart:ColumnSeries3D.AdornmentsInfo>
</chart:ColumnSeries3D>
ColumnSeries3D series = new ColumnSeries3D()
{
    ItemsSource = new CategoryDataViewModel().CategoricalData,
    XBindingPath = "Year",
    YBindingPath = "Plastic",
};
ChartAdornmentInfo3D adornmentInfo = new ChartAdornmentInfo3D()
{
    ShowLabel = true,
    ShowMarker = true,
    AdornmentsPosition=AdornmentsPosition.TopAndBottom,
    SymbolHeight=10,
    SymbolWidth=10
};

series.AdornmentsInfo = adornmentInfo;
chart.Series.Add(series);

TopAndBottom Position in WPF Chart

Label Position

WPF 3D Chart provides additional customization options to position the adornments smartly based on series types using the LabelPosition property.

The following section shows a few examples of this LabelPosition behavior with respect to the series.

Auto

The Auto position of labels with respect to ColumnSeries3D and LineSeries3D.

<chart:ChartAdornmentInfo3D  
    UseSeriesPalette="True" 
    LabelPosition="Auto"
    ShowLabel="True" 
    BorderBrush="White" BorderThickness="1">
</chart:ChartAdornmentInfo3D>
ChartAdornmentInfo3D adornmentInfo = new ChartAdornmentInfo3D()
{
    ShowLabel = true,
    ShowMarker = true,
    BorderBrush = new SolidColorBrush(Colors.White),
    LabelPosition=AdornmentsLabelPosition.Auto,
    UseSeriesPalette=true,
    BorderThickness = new Thickness(1),
};
Column Series Line Series
Auto Position in WPF Chart Auto Position in WPF Chart

Inner

The Inner position of labels with respect to ColumnSeries3D and LineSeries3D.

<chart:ChartAdornmentInfo3D  
    UseSeriesPalette="True" 
    LabelPosition="Inner"
    ShowLabel="True" 
    BorderBrush="White" BorderThickness="1">
</chart:ChartAdornmentInfo3D>
ChartAdornmentInfo3D adornmentInfo = new ChartAdornmentInfo3D()
{
    ShowLabel = true,
    ShowMarker = true,
    BorderBrush = new SolidColorBrush(Colors.White),
    LabelPosition=AdornmentsLabelPosition.Inner,
    UseSeriesPalette=true,              
    BorderThickness = new Thickness(1),
};
Column Series Line Series
Inner Position in WPF Chart Inner Position in WPF Chart

Outer

The Outer position of labels with respect to ColumnSeries3D and LineSeries3D.

<chart:ChartAdornmentInfo3D  
    UseSeriesPalette="True" 
    LabelPosition="Outer"
    ShowLabel="True" 
    BorderBrush="White" BorderThickness="1">
</chart:ChartAdornmentInfo3D>
ChartAdornmentInfo3D adornmentInfo = new ChartAdornmentInfo3D()
{
    ShowLabel = true,
    ShowMarker = true,
    BorderBrush = new SolidColorBrush(Colors.White),
    LabelPosition=AdornmentsLabelPosition.Outer,
    UseSeriesPalette=true,              
    BorderThickness = new Thickness(1),
};
Column Series Line Series
Outer Position in WPF Chart Outer Position in WPF Chart

Center

The Center position of labels with respect to ColumnSeries3D and LineSeries3D.

<chart:ChartAdornmentInfo3D  
    UseSeriesPalette="True" 
    LabelPosition="Center"
    ShowLabel="True" 
    BorderBrush="White" BorderThickness="1">
</chart:ChartAdornmentInfo3D>
ChartAdornmentInfo3D adornmentInfo = new ChartAdornmentInfo3D()
{
    ShowLabel = true,
    ShowMarker = true,
    BorderBrush = new SolidColorBrush(Colors.White),
    LabelPosition=AdornmentsLabelPosition.Center,
    UseSeriesPalette=true,              
    BorderThickness = new Thickness(1),
};
Column Series Line Series
Center Position in WPF Chart Center Position in WPF Chart