How to disable grid lines in OLAP Chart?
This article explains how to disable grid lines in a Syncfusion WPF OLAP Chart hosted inside an OLAP Client. By turning off grid lines on both the primary and secondary axes, you can achieve a cleaner and less cluttered chart appearance.
Disabling grid lines is useful when you want to focus attention on the data itself or align the chart with specific UI or design requirements.
Follow these steps to disable grid lines in the WPF OLAP Chart:
Step 1: Initialize the Chart and Attach the Loaded Event
Configure the OLAP Chart and attach the Loaded event so that grid line settings can be applied once the chart is fully rendered. For more information, refer this getting started documentation.
public MainWindow()
{
InitializeComponent();
this.olapChart.Loaded += OlapChart_Loaded;
}
Public Sub New()
InitializeComponent()
AddHandler Me.olapChart.Loaded, AddressOf OlapChart_Loaded
End Sub
Step 2: Disable Grid Lines on Chart Axes
In the Loaded event, disable grid lines for both the primary and secondary axes by setting the ShowGridLinesProperty to false.
void OlapChart_Loaded(object sender, RoutedEventArgs e)
{
this.olapChart.Series[0].Area.PrimaryAxis
.SetValue(ChartArea.ShowGridLinesProperty, false);
this.olapChart.Series[0].Area.SecondaryAxis
.SetValue(ChartArea.ShowGridLinesProperty, false);
}
Private Sub OlapChart_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.olapChart.Series(0).Area.PrimaryAxis.SetValue(ChartArea.
ShowGridLinesProperty,False)
Me.olapChart.Series(0).Area.SecondaryAxis.SetValue(ChartArea.
ShowGridLinesProperty, False)
End Sub
Output
Conclusion
I hope you enjoyed learning how to disable grid lines in the WPF OLAP Chart.
You can refer to our WPF OlapChart featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF OLAP Chart demo 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!