Reputation: 7710
I am trying to have a Chart that only displays the secondary X axis (top axis) but whenever I disable the primary X axis (bottom), the secondary X axis tick labels disapears...
When I enable secondary axis:
chartArea1.AxisX2.Enabled = AxisEnabled.True;
When I disable seconday axis:
chartArea1.AxisX.Enabled = AxisEnabled.False;
I have been trying many things but I could not find a solution that did not look like a hack.
Upvotes: 0
Views: 1550
Reputation: 54433
Instead of turning it off you can style it to disappear:
Axis axis = chart1.ChartAreas[0].Axes[0]; // your indices
LabelStyle als = new LabelStyle();
als.ForeColor = chart1.ChartAreas[0].BackColor;
axis.LabelStyle = als;
axis.MajorTickMark.TickMarkStyle = TickMarkStyle.None;
Upvotes: 3