c# chart change max and min values on the x axis

If you are using System.Windows.Forms.DataVizualisation.Charting you can set the Axis range by manipulating the chart's ChartAreas property. So something like

myChart.ChartAreas[0].AxisX.Maximum = 13;
myChart.ChartAreas[0].AxisX.Minimum = 0;

This will work better :

myChart.ChartAreas[0].AxisX.IsMarginVisible = false;

You might try myChart.ChartAreas[0].AxisX.RoundAxisValues(). It is on by default for the Y axis and I find it generally works better for the X Axis as well.

Tags:

C#

Charts