How to remove the grid lines in .NET MAUI (SfCartesianChart)?
The .NET MAUI Chart control offers built-in support for removing grid lines in a Cartesian chart. You can achieve this by setting the ShowMajorGridLines property to false for the X-axis and ShowMinorGridLines property to false for the Y-axis. The following code example illustrates how to remove grid lines in an SfCartesianChart:
XAML
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowMajorGridLines="False" ></chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis ShowMinorGridLines="False" ></chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
C#
SfCartesianChart chart = new SfCartesianChart();
// X-axis configuration
CategoryAxis xAxis = new CategoryAxis();
xAxis.ShowMajorGridLines = false;
chart.XAxes.Add(xAxis);
// Y-axis configuration
NumericalAxis yAxis = new NumericalAxis();
yAxis.ShowMinorGridLines = false;
chart.YAxes.Add(yAxis);
Content = chart;
Output
Conclusion
I hope you enjoyed learning about how to remove the grid lines in .NET MAUI Chart (SfCartesianChart).
You can refer to our .NET MAUI Chart’s feature tour page to know about its other groundbreaking feature representations. You can also explore our .NET MAUI Chart documentation to understand how to present and manipulate data.
For current customers, you can check out our .NET MAUI from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI Chart and other .NET MAUI components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!