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?
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.
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.
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.
Yes just set the AxisX.LabelStyle to false
e.g
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false;
I use following code, and works well too.
chart1.ChartAreas[0].AxisY.Enabled = AxisEnabled.False;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With