Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I turn off the x-axis labels in an ASP.NET Chart Control?

I want to programmatically turn on/off the labels on an Chart Control.

The chart is for a load of stats, by person, and I want to be able to anonymise it by removing the labels.

Can this be done from the Chart Control, or do I need to do it at the underlying data-table?

like image 954
Ben Avatar asked Jan 31 '11 10:01

Ben


People also ask

How do I hide axis labels?

To change the position of the labels, in the Axis labels box, click the option that you want. Tip To hide tick marks or tick-mark labels, in the Axis labels box, click None.

How do I remove the X axis labels in Excel?

To remove an axis title, on the Layout tab, in the Labels group, click Axis Title, click the type of axis title that you want to remove, and then click None. To quickly remove a chart or axis title, click the title, and then press DELETE. You can also right-click the chart or axis title, and then click Delete.

How do I hide the Y axis in a chart?

Select the arrow to display a list of axes that can be displayed or hidden on the chart. Clear the check box for the axes you want to hide.


2 Answers

Yes just set the AxisX.LabelStyle to false

e.g

Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false;
like image 86
escouser Avatar answered Oct 08 '22 23:10

escouser


I use following code, and works well too.

chart1.ChartAreas[0].AxisY.Enabled = AxisEnabled.False;
like image 31
Apple Juice Avatar answered Oct 09 '22 00:10

Apple Juice