Skip to main content

RangeBarSideBySideSeries2D Class

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

Declaration

public class RangeBarSideBySideSeries2D :
    RangeBarSeries2D,
    ISideBySideBarSeriesView,
    IBarSeriesView

Example

The following example demonstrates how to create a Side-by-Side Range Bar chart. For this, it is necessary to assign the ChartControl.Diagram property to XYDiagram2D, and then add two RangeBarSideBySideSeries2D objects with points to the diagram’s Diagram.Series collection.

Also, this example shows how to add a chart title and to hide markers and labels for both series to improve chart appearance.

<Window x:Class="SideBySideRangeBar2DChart.MainWindow"
        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"
        Title="MainWindow" Height="480" Width="640" >
    <Grid>
        <dxc:ChartControl Name="chartControl1">
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram2D>
                    <dxc:XYDiagram2D.Series>
                        <dxc:RangeBarSideBySideSeries2D  ArgumentScaleType="DateTime" 
                                                         MinMarkerVisible="False" MaxMarkerVisible="False">
                            <dxc:RangeBarSideBySideSeries2D.Points>
                                <dxc:SeriesPoint Argument="01/01/2010" Value="73.39" dxc:RangeBarSeries2D.Value2="84.68"/>
                                <dxc:SeriesPoint Argument="02/01/2010" Value="71.19" dxc:RangeBarSeries2D.Value2="80.16"/>
                                <dxc:SeriesPoint Argument="03/01/2010" Value="77.1" dxc:RangeBarSeries2D.Value2="81.18"/>
                                <dxc:SeriesPoint Argument="04/01/2010" Value="78.2" dxc:RangeBarSeries2D.Value2="83.59"/>
                                <dxc:SeriesPoint Argument="05/01/2010" Value="64.91" dxc:RangeBarSeries2D.Value2="85.14"/>
                                <dxc:SeriesPoint Argument="06/01/2010" Value="70.94" dxc:RangeBarSeries2D.Value2="78.86"/>
                                <dxc:SeriesPoint Argument="07/01/2010" Value="72.33" dxc:RangeBarSeries2D.Value2="79.53"/>
                                <dxc:SeriesPoint Argument="08/01/2010" Value="70.2" dxc:RangeBarSeries2D.Value2="81.7"/>
                                <dxc:SeriesPoint Argument="09/01/2010" Value="72.51" dxc:RangeBarSeries2D.Value2="80.22"/>
                                <dxc:SeriesPoint Argument="10/01/2010" Value="79.74" dxc:RangeBarSeries2D.Value2="83.48"/>
                            </dxc:RangeBarSideBySideSeries2D.Points>
                            <dxc:RangeBarSideBySideSeries2D.Label>
                                <dxc:SeriesLabel  Visible="False" />
                            </dxc:RangeBarSideBySideSeries2D.Label>
                        </dxc:RangeBarSideBySideSeries2D>
                        <dxc:RangeBarSideBySideSeries2D  DisplayName="West Texas Intermediate" ArgumentScaleType="DateTime" 
                                                         MinMarkerVisible="False" MaxMarkerVisible="False">
                            <dxc:RangeBarSideBySideSeries2D.Points>
                                <dxc:SeriesPoint Argument="01/01/2010" Value="72.89" dxc:RangeBarSeries2D.Value2="83.18"/>
                                <dxc:SeriesPoint Argument="02/01/2010" Value="71.19" dxc:RangeBarSeries2D.Value2="80.16"/>
                                <dxc:SeriesPoint Argument="03/01/2010" Value="78.7" dxc:RangeBarSeries2D.Value2="83.76"/>
                                <dxc:SeriesPoint Argument="04/01/2010" Value="81.45" dxc:RangeBarSeries2D.Value2="86.84"/>
                                <dxc:SeriesPoint Argument="05/01/2010" Value="65.96" dxc:RangeBarSeries2D.Value2="86.19"/>
                                <dxc:SeriesPoint Argument="06/01/2010" Value="71.44" dxc:RangeBarSeries2D.Value2="79.79"/>
                                <dxc:SeriesPoint Argument="07/01/2010" Value="71.98" dxc:RangeBarSeries2D.Value2="79.03"/>
                                <dxc:SeriesPoint Argument="08/01/2010" Value="71.2" dxc:RangeBarSeries2D.Value2="82.55"/>
                                <dxc:SeriesPoint Argument="09/01/2010" Value="72.41" dxc:RangeBarSeries2D.Value2="79.97"/>
                                <dxc:SeriesPoint Argument="10/01/2010" Value="79.49" dxc:RangeBarSeries2D.Value2="83.23"/>
                            </dxc:RangeBarSideBySideSeries2D.Points>
                            <dxc:RangeBarSideBySideSeries2D.Label>
                                <dxc:SeriesLabel Visible="False" />
                            </dxc:RangeBarSideBySideSeries2D.Label>
                        </dxc:RangeBarSideBySideSeries2D>
                    </dxc:XYDiagram2D.Series>
                    <dxc:XYDiagram2D.AxisX>
                        <dxc:AxisX2D GridLinesVisible="True" DateTimeGridAlignment="Month">
                            <dxc:AxisX2D.DateTimeOptions>
                                <dxc:DateTimeOptions Format="Custom" FormatString="MMMM" />
                            </dxc:AxisX2D.DateTimeOptions>
                        </dxc:AxisX2D>
                    </dxc:XYDiagram2D.AxisX>
                    <dxc:XYDiagram2D.AxisY>
                        <dxc:AxisY2D>
                            <dxc:AxisY2D.Title>
                                <dxc:AxisTitle Content="$ per barrel" />
                            </dxc:AxisY2D.Title>
                            <dxc:AxisY2D.Range>
                                <dxc:AxisRange dxc:AxisY2D.AlwaysShowZeroLevel="False" />
                            </dxc:AxisY2D.Range>
                        </dxc:AxisY2D>
                    </dxc:XYDiagram2D.AxisY>
                </dxc:XYDiagram2D>
            </dxc:ChartControl.Diagram>
            <dxc:ChartControl.Titles>
                <dxc:Title Dock="Top" HorizontalAlignment="Center">Crude Oil Prices in 2010</dxc:Title>
            </dxc:ChartControl.Titles>
        </dxc:ChartControl>
    </Grid>
</Window>

Implements

See Also