Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding The Gridlines On An ASP.Net Chart Control

Tags:

I've made some graphs in my ASP.Net MVC application using the ASP.Net MSChart control. I cant seem to find the property for hiding the gridlines, anyone know how this is done?

Thanks

like image 755
Gavin Avatar asked Jun 29 '09 14:06

Gavin


People also ask

How do I get rid of grid display?

To show the gridlines, in Excel, PowerPoint, or Word, click the View tab, and then check the Gridlines box. To hide the gridlines, clear the Gridlines check box.

When would you want to include gridlines in a data visualization?

Grid lines are useful when you need to detect subtle differences between quantitative values that are too far from the baseline. Circumstance 3: Assisting the comparison of values along the categorical scale.


2 Answers

Set the Axis.MajorGrid.Enabled property to false for the x and y axes:

Chart1.ChartAreas["YourChartArea"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["YourChartArea"].AxisY.MajorGrid.Enabled = false;
like image 120
aherrick Avatar answered Oct 03 '22 00:10

aherrick


Its more simple than above . All you need to do is add the following lines in your aspx pageinside your chartarea , since you are using chart control.

            <chartareas>
                            <asp:ChartArea Name="ChartArea1">
                                <axisy>
                                    <MajorGrid Enabled ="False" />
                                </axisy>
                                <axisx>
                                    <MajorGrid Enabled="false"/>
                                </axisx>
                            </asp:ChartArea>

You can also set the Mazor grid line width property to zero to see the same output :-

          <chartareas>
                            <asp:ChartArea Name="ChartArea1">
                                <axisy>
                                    <MajorGrid LineWidth="0" />
                                </axisy>
                                <axisx>
                                    <MajorGrid LineWidth="0"/>
                                </axisx>
                            </asp:ChartArea>
like image 24
Prince Sharma Avatar answered Oct 03 '22 00:10

Prince Sharma