开发者

C# Extra X points on mschart

I'm using the Chart control on my .Net 4.0 WinForms application.

I'm plotting a curve where the x-value is the month (1 to 12) an the y-value is the value of the curve.

I've added points 1 to 12, but for some reason the chart is shown from 0 to 13. Points 0 an 13 obviously have no value so the line does not extend to those columns.

How can I remove the 0开发者_StackOverflow and 13 points from my graph?


You can set the Axis Minimum and Maximum values in your chart set up. Also set IsStartedFromZero to false.

Assuming one chart area:

var chartArea = MyChart.ChartAreas.First();
chartArea.AxisX.Minimum = 1;
chartArea.AxisX.Maximum = 12;
chartArea.AxisX.IsStartedFromZero = false;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜