Search code examples
c#chartsgraphic

How to change x-axis?


friends! Today I want to ask you next question - how to change points on x-axis?

See what I have.

chart1.Series[0].Points.Clear();
chart1.Series[0].Color = Color.Red;
chart1.Series[0].BorderWidth = 2;
...
for (double i = step; i <= T; i += step)
{...
   chart1.Series[0].Points.AddXY(i, SomeVar);
}

And so I have that. enter image description here

But I don't want to see number 11. Can you understand me what I want? :)


Solution

  • Try to change the min max values of your axis, this will hide the auto generated axis labels.

    chart1.ChartAreas[0].AxisX.Minimum = 0;
    chart1.ChartAreas[0].AxisX.Maximum = 10;