Category / Section
How to add space between multiple columns in a Chart segment?
1 min read
Description:
This article describes how to add space between multiple series segments that share the same data point and the same x-axis.
Solution:
The spacing between multiple series segments can be achieved through the SegmentSpacing property of the series.
The following code example demonstrates the same.
XAML
<syncfusion:ColumnSeries Label="ColumnSeries1" ItemsSource="{Binding Computers}" XBindingPath="Computer" YBindingPath="Year2013" <!—Sets the SegmentSpacing--> SegmentSpacing="0.5"/> <syncfusion:ColumnSeries Label="ColumnSeries2" ItemsSource="{Binding Computers}" XBindingPath="Computer" YBindingPath="Year2014" SegmentSpacing="0.5" />
C#
(sampleChart.Series[0] as ColumnSeries).SegmentSpacing = 0.5; (sampleChart.Series[1] as ColumnSeries).SegmentSpacing = 0.5;
The following screenshot illustrates the spacing applied between the segments of the same data point.
Figure 1: SfChart with multiple ColumnSeries segments spaced at the same point