How to remove the grid lines in .NET MAUI (SfCartesianChart)?
The .NET MAUI Chart control provides 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 how to remove the grid lines in a .NET MAUI Chart (SfCartesianChart).
You can refer to our .NET MAUI Chart feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Chart documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Chart and other .NET MAUI components.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!