Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete grid lines from Chart in WindowsForm?

Tags:

How can I remove grid lines from chart? I use standard Chart library.

Thanks!

like image 218
Chris Avatar asked Jan 15 '12 16:01

Chris


People also ask

How do you remove lines from an Excel graph?

Click the chart with the lines, and then click the Chart Design tab. Click Add Chart Element, click Gridlines, and then click More Gridline Options. Select No line. You can also click the line and press DELETE .

What is the use of gridlines and legends in a chart?

- The Legend displays the plotted data series with a predefined symbol and the name of the series.It also assigns a unique colour to each series. Gridlines- These are the parallel lines along the X-axis and Y-axis in the plot area which makes it easier to identify the value of each data point on the chart.


1 Answers

You can disable MajorGrid or MinorGrid of each of the axis of the desired chart-area:

mainChart.ChartAreas[0].AxisX.MajorGrid.Enabled = false; mainChart.ChartAreas[0].AxisX.MinorGrid.Enabled = false; mainChart.ChartAreas[0].AxisY.MajorGrid.Enabled = false; mainChart.ChartAreas[0].AxisY.MinorGrid.Enabled = false; 

as seen below: https://github.com/sinairv/MSChartWrapper/blob/master/MSChartWrapper/ChartWrapper.cs#L58-L61

like image 117
Sina Iravanian Avatar answered Sep 22 '22 17:09

Sina Iravanian