Back to Devexpress

XYSeries2D.LastPoint Property

wpf-devexpress-dot-xpf-dot-charts-dot-xyseries2d-f3924908.md

latest6.8 KB
Original Source

XYSeries2D.LastPoint Property

Specifies settings for the last series point.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public SidePoint LastPoint { get; set; }
vb
Public Property LastPoint As SidePoint

Property Value

TypeDescription
SidePoint

A SidePoint object that contains settings for the last series point.

|

Remarks

LastPoint specifies how the chart displays the last point and its related visual elements.

The LastPoint.LabelDisplayMode property defines how to display the point’s label.

The following values are available:

|

Value

|

Description

| | | --- | --- | --- | |

Default

|

The label uses common label settings.

|

| |

DiagramEdge

|

The control displays the label at the diagram edge. The SidePoint.Label property specifies appearance settings.

|

| |

SeriesPoint

|

The control shows the label next to the series point. If the label should be outside a visual area when zooming or scrolling, the label is displayed at the diagram’s edge. The SidePoint.Label property specifies appearance settings.

|

|

Use the LastPoint.Label property to customize label’s text color, border options, text pattern, and other settings. Refer to the SeriesLabel’s Properties page for a list of available options.

You can specify how to display markers in series that support markers (for example, Line or Point). To do this, use the RangeAreaSeries2D.MarkerDisplayMode or SegmentSeries2DBase.MarkerDisplayMode property according to your series type. To show the marker on the last series point, set MarkerDisplayMode to SidePointDisplayMode.SeriesPoint. To display it on the diagram’s edge, set MarkerDisplayMode to SidePointDisplayMode.DiagramEdge.

Example

This example demonstrates how to create a template that customizes the last label appearance.

To show its label, set the LastPoint.LabelDisplayMode property to SeriesPoint.

The markup below specifies SeriesLabel.ElementTemplate and customizes the label appearance:

  • background color
  • text color
  • font size
  • border corner radius
  • border thickness

Set MarkerDisplayMode to SeriesPoint to display the last point marker.

Set LineSeries2D.MarkerVisible to False to hide other markers.

xaml
<Window.Resources>
    <ResourceDictionary>
        <DataTemplate x:Key="labelTemplate">
            <Border BorderThickness="1" CornerRadius="4" Opacity="1.0">
                <Border.Background>
                    <SolidColorBrush Color="DarkRed"/>
                </Border.Background>
                <Label Content="{Binding Path=Text}" Padding="2,2,2,1.5" 
        Foreground="White" FontSize="13" />
            </Border>
        </DataTemplate>
    </ResourceDictionary>
</Window.Resources>
...
<dxc:ChartControl x:Name="ChartControl1" ...>
    <dxc:XYDiagram2D>
        <dxc:SplineSeries2D Name="xSplineSeries2D" 
                            DataSource="{Binding Data}" 
                            ArgumentDataMember="Argument"
                            ValueDataMember="Value"
                            LineTension="0.8"
                            MarkerSize="15"
                            MarkerVisible="False"
                            LabelsVisibility="False">
            <dxc:SplineSeries2D.LastPoint>
                <dxc:SidePoint LabelDisplayMode="SeriesPoint"
                            dxc:SegmentSeries2DBase.MarkerDisplayMode="SeriesPoint">
                    <dxc:SidePoint.Label>
                        <dxc:SeriesLabel ElementTemplate="{StaticResource labelTemplate}"/>
                    </dxc:SidePoint.Label>
                </dxc:SidePoint>
            </dxc:SplineSeries2D.LastPoint>
            ...
        </dxc:SplineSeries2D>
        ...
    </dxc:XYDiagram2D>
    ...
</dxc:ChartControl>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LastPoint property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-charts-create-real-time-chart/CS/RealtimeChartMVVM/MainWindow.xaml#L22

xml
ValueDataMember="Value" >
<dxc:SplineSeries2D.LastPoint>
    <dxc:SidePoint LabelDisplayMode="SeriesPoint">

See Also

How to: Provide a Custom Template for Series Labels

SidePoint

FirstPoint

XYSeries2D Class

XYSeries2D Members

DevExpress.Xpf.Charts Namespace