FinancialSeries2D Class
Represents the base class for 2D Candle Stick and 2D Stock series.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.2.dll
NuGet Package: DevExpress.Wpf.Charts
Declaration
public abstract class FinancialSeries2D :
XYSeries2D,
IBarSeriesView,
IFinancialSeriesView,
ISeriesView
Example
The following example demonstrates how to create a 2D Candle Stick chart.
Create a ChartControl and set its ChartControl.Diagram property to a XYDiagram2D object. Note that the ChartControl.Diagram is a content property. You can declare a diagram in XAML after a chart control’s declaration without wrapping it in opening and closing ChartControl.Diagram tags.
Add a StockSeries2D object to the Diagram.Series collection. Note that the Diagram.Series is a content property. You can declare series in XAML 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:
- Series.DataSource - Specifies the series’s data source.
- Series.ArgumentDataMember - Defines the data member that provides the series’s arguments.
- FinancialSeries2D.OpenValueDataMember - Specifies the data member that contains data for Open point values.
- FinancialSeries2D.HighValueDataMember - Defines the data member that contains data for High point values.
- FinancialSeries2D.LowValueDataMember - Specifies the data member that contains data for Low point values.
- FinancialSeries2D.CloseValueDataMember - Specifies the data member that contains data for Close point values.
<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"
xmlns:local="clr-namespace:CandleStick2DChart"
x:Class="CandleStick2DChart.Window1"
Title="Window1"
Height="350" Width="620">
<Grid>
<dxc:ChartControl Name="chartControl1">
<dxc:ChartControl.DataContext>
<local:ChartViewModel/>
</dxc:ChartControl.DataContext>
<dxc:XYDiagram2D>
<dxc:CandleStickSeries2D ArgumentScaleType="DateTime"
DataSource="{Binding Data}"
ArgumentDataMember="Date"
OpenValueDataMember="Open"
HighValueDataMember="High"
LowValueDataMember="Low"
CloseValueDataMember="Close"
LabelsVisibility="True"
Brush="Green">
<dxc:CandleStickSeries2D.Label>
<dxc:SeriesLabel TextPattern="{}{HV}"/>
</dxc:CandleStickSeries2D.Label>
<dxc:CandleStickSeries2D.ReductionOptions>
<dxc:ReductionStockOptions ColorMode="OpenToCloseValue"
dxc:CandleStickSeries2D.FillMode="FilledOnReduction"
Level="CloseValue"
Brush="Red"/>
</dxc:CandleStickSeries2D.ReductionOptions>
<dxc:CandleStickSeries2D.Model>
<dxc:ThinCandleStick2DModel />
</dxc:CandleStickSeries2D.Model>
</dxc:CandleStickSeries2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Label>
<dxc:AxisLabel TextPattern="{}{A:MMMM d}"/>
</dxc:AxisX2D.Label>
<dxc:AxisX2D.DateTimeScaleOptions>
<dxc:AutomaticDateTimeScaleOptions SkipRangesWithoutPoints="True"/>
</dxc:AxisX2D.DateTimeScaleOptions>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D>
<dxc:AxisY2D.WholeRange>
<dxc:Range dxc:AxisY2D.AlwaysShowZeroLevel="False"/>
</dxc:AxisY2D.WholeRange>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
</dxc:XYDiagram2D>
</dxc:ChartControl>
</Grid>
</Window>