Class StackingBarSeries
StackingBarSeries is typically preferred in cases of multiple series of type BarSeries. Each series is stacked horizontally side by side to each other.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.WPF.dll
Syntax
public class StackingBarSeries : StackingSeriesBase, ICloneable, ISupportAxes2D, ISupportAxes, ISegmentSelectable, ISegmentSpacing
Examples
<syncfusion:StackingBarSeries ItemsSource="{Binding Data}" XBindingPath="Year" YBindingPath="Value">
</syncfusion:StackingBarSeries>
StackingBarSeries series1 = new StackingBarSeries();
series1.ItemsSource = viewmodel.Data;
series1.XBindingPath = "Year";
series1.YBindingPath = "Value";
chart.Series.Add(series1);
Constructors
StackingBarSeries()
Initializes a new instance of the StackingBarSeries.
Declaration
public StackingBarSeries()
Fields
CustomTemplateProperty
Identifies the CustomTemplate dependency property.
Declaration
public static readonly DependencyProperty CustomTemplateProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for CustomTemplate dependency property. |
SegmentSelectionBrushProperty
Identifies the SegmentSelectionBrush dependency property.
Declaration
public static readonly DependencyProperty SegmentSelectionBrushProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for SegmentSelectionBrush dependency property. |
SegmentSpacingProperty
Identifies the SegmentSpacing dependency property.
Declaration
public static readonly DependencyProperty SegmentSpacingProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for SegmentSpacing dependency property. |
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for SelectedIndex dependency property. |
Properties
CustomTemplate
Gets or sets the DataTemplate used to customize the shape appearence.
Declaration
public DataTemplate CustomTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Windows.DataTemplate | The template that specifies shape inside canvas. The default is null. |
Examples
<chart:SfChart>
<chart:SfChart.PrimaryAxis>
<chart:NumericalAxis/>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis/>
</chart:SfChart.SecondaryAxis>
<chart:StackedBarSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue">
<chart:StackedBarSeries.CustomTemplate>
<DataTemplate>
<Canvas>
<Rectangle Fill="{Binding Interior}" Width="{Binding Width}" Height="{Binding Height}"
Canvas.Left="{Binding RectX}" Canvas.Top="{Binding RectY}" Stroke="{Binding Stroke}"/>
</Canvas>
</DataTemplate>
</chart:StackedBarSeries.CustomTemplate>
</chart:StackedBarSeries>
</chart:SfChart>
IsSideBySide
Gets a value indicating whether this series is placed side by side.
Declaration
protected override bool IsSideBySide { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | It returns |
Overrides
IsStacked
Gets a value indicating whether this series is a stacked series.
Declaration
protected override bool IsStacked { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
SegmentSelectionBrush
Gets or sets the interior(brush) for the selected segment(s).
Declaration
public Brush SegmentSelectionBrush { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Windows.Media.Brush | The System.Windows.Media.Brush value. |
SegmentSpacing
Gets or sets the spacing between the segments across the series in cluster mode.
Declaration
public double SegmentSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The value ranges from 0 to 1 and its default value is 0. |
SelectedIndex
Gets or sets the index of the first segment in the current selection or returns negative one (-1) if the selection is empty.
Declaration
public int SelectedIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The index of first segment in the current selection. The default value is negative one (-1). |
See Also
Methods
CalculateSegmentSpacing(Double, Double, Double)
Method used to calculate the segment spacing.
Declaration
protected double CalculateSegmentSpacing(double spacing, double Right, double Left)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | spacing | Segment spacing |
| System.Double | Right | Segment right value |
| System.Double | Left | Segment left value |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the segment spacing value. |
CloneSeries(DependencyObject)
Returns the instance of StackingBarSeries series.
Declaration
protected override DependencyObject CloneSeries(DependencyObject obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.DependencyObject | obj | object |
Returns
| Type |
|---|
| System.Windows.DependencyObject |
Overrides
CreateSegment()
Creates an instance of series segment.
Declaration
protected override ChartSegment CreateSegment()
Returns
| Type | Description |
|---|---|
| ChartSegment | Returns the instance of corresponding series segment. |
Overrides
Remarks
This customization is not supported for fast type series and technical indicators.
Examples
This sample shows how to call the CreateSegment() method to customize the line series segments.
public class LineSeriesExt : LineSeries
{​
protected override ChartSegment CreateSegment()
{​
return new LineSegmentExt();
}​
}​
public class LineSegmentExt : LineSegment
{​
public override UIElement CreateVisual(Size size)
{​
// Write your customization code here.
}​
public override void Update(IChartTransformer transformer)
{​
// Write your customization code here.
}​
}
CreateSegments()
Creates the segments of StackingBarSeries.
Declaration
public override void CreateSegments()
Overrides
Explicit Interface Implementations
ISegmentSpacing.CalculateSegmentSpacing(Double, Double, Double)
Method used to calculate the segment spacing.
Declaration
double ISegmentSpacing.CalculateSegmentSpacing(double spacing, double Right, double Left)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | spacing | Segment spacing value. |
| System.Double | Right | Segment right value. |
| System.Double | Left | Segment left value. |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the calculated segment space. |