How to add space between multiple columns in WPF Chart segment?
Description
This article demonstrates how to add spacing between multiple column segments in a WPF Chart (SfChart) when multiple series share the same data source.
Solution
You can add the spacing between multiple series segments by using the SegmentSpacing property of WPF Chart (SfChart).
In this example, setting SegmentSpacing to 0.5 creates a spacing between adjacent segments within the same category.
Refer the code below to define segment spacing in a WPF Chart:
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;
Output
The following screenshot illustrates the spacing applied between the segments of the same data point.
Conclusion
I hope you enjoyed learning about how to add space between multiple columns in WPF Chart segment.
You can refer to our WPF Chart feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Chart documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!