ASP.NET with MS Chart disable the vertical line ASP.NET with MS Chart disable the vertical line asp.net asp.net

ASP.NET with MS Chart disable the vertical line


simple way:

Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;


I don't know the specific ASP syntax, but here is the VB.NET code that does the trick:

Dim gd As New System.Windows.Forms.DataVisualization.Charting.Gridgd.LineWidth = 0myChart.ChartAreas("MainChartArea").AxisX.MajorGrid = gd

C# version if needed :

System.Web.UI.DataVisualization.Charting.Grid gd = new System.Web.UI.DataVisualization.Charting.Grid(); gd.LineWidth = 0; myChart.ChartAreas[0].AxisX.MajorGrid = gd;

As you can see, you can't just turn off the gridline, you have to set it's width to 0. The MinorGrid can be hidden the same way.


Simplest way, put the following code in chart load event.

protected void Chart1_Load(object sender, EventArgs e){    Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;    Chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;}