Skip to main content

SplineSeries2D Class

Represents a series view of the Spline type.

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

Declaration

public class SplineSeries2D :
    LineSeries2D,
    ISplineView

Remarks

The SplineSeries2D class provides the functionality of a series view of the Spline type within a chart control.

In addition to the common view settings inherited from the base LineSeries2D class, the SplineSeries2D class declares the spline type specific settings, which allow you to define the style of the spline curve (SplineSeries2D.LineTension).

Note that a particular view type can be defined for a series via its Diagram.Series property.

For more information on series views of the Spline type, refer to the Spline topic.

Example

This example demonstrates how to create a 2D Spline chart.

Spline chart

  1. Create a ChartControl and specify its ChartControl.Diagram property to a SimpleDiagram2D object.

    Note

    Note that the ChartControl.Diagram is a content property. You can declare a diagram in XAML directly after a chart control’s declaration without wrapping it in opening and closing ChartControl.Diagram tags.

  2. Add a SplineSeries2D object to the Diagram.Series collection.

    Note

    Note that the Diagram.Series is a content property. You can declare series in XAML directly after a diagram’s declaration without wrapping them in opening and closing Diagram.Series tags.

    Use the following properties to bind the series to data:

  3. To enable series markers, use the LineSeries2D.MarkerVisible property. The LineSeries2D.MarkerSize property allows you to set the marker size.

  4. Assign a SeriesLabel object to the Series.Label property. Use the following properties to customize series label options:

  5. Use the properties below to customize axes:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
        x:Class="SplineChart.MainWindow"
        xmlns:local="clr-namespace:SplineChart"
        Title="Spline Chart" Height="440" Width="660">
    <Window.DataContext>
        <local:ChartViewModel/>
    </Window.DataContext>
    <Grid>
        <dxc:ChartControl>
            <dxc:XYDiagram2D>
                <dxc:SplineSeries2D DataSource="{Binding Data}" 
                                    ArgumentDataMember="Argument"
                                    ValueDataMember="Value"
                                    LineTension="0.8" 
                                    MarkerSize="15"
                                    MarkerVisible="True">
                    <dxc:SplineSeries2D.Label>
                        <dxc:SeriesLabel dxc:MarkerSeries2D.Angle="90" 
                                         ConnectorVisible="False"
                                         Indent="15"
                                         ResolveOverlappingMode="Default"                                                   
                                         Visible="True"/>
                    </dxc:SplineSeries2D.Label>
                </dxc:SplineSeries2D>
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D GridLinesVisible="True"/>
                </dxc:XYDiagram2D.AxisX>
                <dxc:XYDiagram2D.AxisY>
                    <dxc:AxisY2D>
                        <dxc:AxisY2D.Title>
                            <dxc:AxisTitle Content="Cents per Gallon"/>
                        </dxc:AxisY2D.Title>
                        <dxc:AxisY2D.WholeRange>
                            <dxc:Range dxc:AxisY2D.AlwaysShowZeroLevel="False"/>
                        </dxc:AxisY2D.WholeRange>
                    </dxc:AxisY2D>
                </dxc:XYDiagram2D.AxisY>
            </dxc:XYDiagram2D>
            <dxc:ChartControl.Titles>
                <dxc:Title Dock="Top" 
                           HorizontalAlignment="Center" 
                           Content="U.S. Fuel Oil Prices"/>
            </dxc:ChartControl.Titles>
        </dxc:ChartControl>
    </Grid>
</Window>

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

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.

See Also