BarFullStackedSeries2D Class
Represents the 2D Full-Stacked Bar series.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.2.dll
NuGet Package: DevExpress.Wpf.Charts
#Declaration
public class BarFullStackedSeries2D :
BarStackedSeries2D
#Example
This example demonstrates how to create a 2D Full-Stacked Bar chart.
Create a ChartControl and set its ChartControl.Diagram property to a XYDiagram2D object.
Note
The Chart
Control. 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 ChartDiagram Control. tags.Diagram Specify the Diagram.SeriesItemsSource property to bind a collection of objects used to generate series.
The Diagram.SeriesItemTemplate property allows you to define each series item presentation. Use the following API members to configure a series item:
Member Description Bar
Full Stacked Series2D Represents the 2D Full-Stacked Bar series. Series. Data Source Specifies the series’s data source. Series. Argument Data Member Defines the data member that provides the series’s arguments. Series. Value Data Member Specifies the data member that provides the series’s values. Series. Display Name Gets or sets the display name of the series. Add an Legend to the ChartControlBase.Legends collection. Refer to the Legend topic for more information about legends.
Add an Title to the ChartControlBase.Titles collection. Define the title’s Content and HorizontalAlignment properties. Refer to the Chart Titles topic for more information about titles.
Use the following API members to configure the axis options.
Member Description XYDiagram2D. Axis Y Gets the Y-axis. Axis Y2D Represents the Y-axis of a XYDiagram2D class. Axis Base. Label Specifies axis label settings. Axis Label. Text Pattern Gets or sets a format string that specifies the text to be displayed within the axis label. Axis Y2D. Numeric Scale Options Provides access to the options that define the behavior of a numeric Y-scale when its mode is continuous. Continuous Numeric Scale Options. Auto Grid Gets or sets a value that specifies whether the spacing of grid lines is calculated automatically based upon the major tickmarks of the axis. Continuous Numeric Scale Options. Grid Spacing Gets or sets the numeric grid step in grid alignment units. XYDiagram2D. Axis X Gets the X-axis. Axis X2D Represents the X-axis of a XYDiagram2D class. Axis2D. Tickmarks Minor Visible Specifies whether the axis minor tick marks are visible. This is a dependency property.
<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:FullStackedBar2DChart"
x:Class="FullStackedBar2DChart.Window1"
Title="Window1" Height="450" Width="750">
<Window.DataContext>
<local:ChartViewModel/>
</Window.DataContext>
<Grid>
<dxc:ChartControl>
<dxc:ChartControl.Titles>
<dxc:Title Content="Sales by Regions"
HorizontalAlignment="Center"/>
</dxc:ChartControl.Titles>
<dxc:ChartControl.Legends>
<dxc:Legend/>
</dxc:ChartControl.Legends>
<dxc:XYDiagram2D SeriesItemsSource="{Binding SaleSeries}">
<dxc:XYDiagram2D.SeriesItemTemplate>
<DataTemplate>
<dxc:BarFullStackedSeries2D DisplayName="{Binding Category}"
DataSource="{Binding Values}"
ArgumentDataMember="Region"
ValueDataMember="Value">
</dxc:BarFullStackedSeries2D>
</DataTemplate>
</dxc:XYDiagram2D.SeriesItemTemplate>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D>
<dxc:AxisY2D.Label>
<dxc:AxisLabel TextPattern="{}{VP:P0}"/>
</dxc:AxisY2D.Label>
<dxc:AxisY2D.NumericScaleOptions>
<dxc:ContinuousNumericScaleOptions AutoGrid="False"
GridSpacing="0.2"/>
</dxc:AxisY2D.NumericScaleOptions>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D TickmarksMinorVisible="False"/>
</dxc:XYDiagram2D.AxisX>
</dxc:XYDiagram2D>
</dxc:ChartControl>
</Grid>
</Window>