Segment spacing in .NET MAUI Pyramid Chart

8 Jul 20261 minute to read

The gap between each segment in the pyramid chart can be set using the GapRatio property. The default value of the GapRatio property is 0, and its value ranges from 0 to 1. This ratio represents the spacing relative to the segment height; a value of 0.2 means the gap is 20% of the segment’s height.

NOTE

Prerequisite: Ensure that the required NuGet package is installed, the necessary namespaces are imported, and the Pyramid Chart control is properly configured in your application. For detailed setup and configuration instructions, refer to the Getting Started guide.

<chart:SfPyramidChart ItemsSource="{Binding Data}" 
                      XBindingPath="XValue" 
                      YBindingPath="YValue"
                      GapRatio="0.2">
</chart:SfPyramidChart>
SfPyramidChart chart = new SfPyramidChart();
ViewModel viewModel = new ViewModel();
chart.BindingContext = viewModel;

chart.ItemsSource = viewModel.Data;
chart.XBindingPath = "XValue";
chart.YBindingPath = "YValue";
chart.GapRatio = 0.2;

this.Content = chart;

Segment spacing in .NET MAUI Pyramid Chart