C# 如何在mschart中添加在X轴上均匀分布的点?

C# 如何在mschart中添加在X轴上均匀分布的点?,c#,winforms,visual-studio-2010,charts,axes,C#,Winforms,Visual Studio 2010,Charts,Axes,c#mschart vs2010.net4 chart1.Series[0].Points.AddXY(0, 1); chart1.Series[0].Points.AddXY(7, 1; chart1.Series[0].Points.AddXY(8,1); 我希望这3分看起来像这样 . . . . . . 但结果是这样的 . . . . . . 为什么?? 多谢各位 图表代码 chartArea1.AxisX.Interlaced

c#mschart vs2010.net4

    chart1.Series[0].Points.AddXY(0, 1);
    chart1.Series[0].Points.AddXY(7, 1;
    chart1.Series[0].Points.AddXY(8,1);
我希望这3分看起来像这样

 .      . .
 . . .
但结果是这样的

 .      . .
 . . .
为什么?? 多谢各位

图表代码

chartArea1.AxisX.InterlacedColor = System.Drawing.SystemColors.ControlLight;
chartArea1.AxisX.Interval = 1D;
chartArea1.AxisX.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount;
chartArea1.AxisX.IntervalOffset = 1D;
chartArea1.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisX.IsInterlaced = true;
chartArea1.AxisX.IsLabelAutoFit = false;
chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartArea1.AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
chartArea1.AxisX.MajorTickMark.LineColor = System.Drawing.Color.Maroon;
chartArea1.AxisX.ScrollBar.LineColor = System.Drawing.Color.White;
chartArea1.AxisY.ArrowStyle = System.Windows.Forms.DataVisualization.Charting.AxisArrowStyle.SharpTriangle;
chartArea1.AxisY.InterlacedColor = System.Drawing.Color.WhiteSmoke;
chartArea1.AxisY.Interval = 1D;
chartArea1.AxisY.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.AxisY.IsInterlaced = true;
chartArea1.AxisY.IsLabelAutoFit = false;
chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Lucida Grande", 8F);
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
chartArea1.AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDot;
chartArea1.AxisY.ScaleView.MinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
chartArea1.CursorX.IsUserEnabled = true;
chartArea1.CursorX.IsUserSelectionEnabled = true;
chartArea1.CursorY.IsUserEnabled = true;
chartArea1.CursorY.IsUserSelectionEnabled = true;
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
this.chart1.Location = new System.Drawing.Point(-4, 0);
this.chart1.Margin = new System.Windows.Forms.Padding(0);
this.chart1.Name = "chart1";
series1.BorderWidth = 3;
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series1.Font = new System.Drawing.Font("Calibri", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
series1.IsXValueIndexed = true;
series1.LabelBorderWidth = 2;
series1.MarkerColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
series1.Name = "Series1";
series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.UInt32;
series1.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.UInt32;
this.chart1.Series.Add(series1);
this.chart1.Size = new System.Drawing.Size(1031, 618);
this.chart1.TabIndex = 5;

我想您应该使用空数据点(请参阅)

使用IsEmpty属性,将生成以下代码。 (
DataManipulator.InsertEmptyPoints
应该需要更少的代码,但我还没有测试它)

发现了问题

 series1.IsXValueIndexed = true;
这就是发生的原因。 这应该是假的。
谢谢大家的关注。

你能给我们看更多的代码和图表截图吗?我很乐意,但我不能上传图片,因为我不允许上传。我可能在“属性”窗口中触摸了一些设置,但我记不起它们了哪种是系列图表类型?点?是的,它们是点。我还尝试设置为stepline,但是,所有的x距离都是相同的。我认为应该将x轴的
Interval
属性设置为1,这将有助于获得结果,因为数据操纵器似乎只在vs2012中使用。由于性能问题,我不能添加那么多的点。@aihenry2980 DataManipulator出现在.Net 4()中。我不明白为什么不能在VS2010 thx中使用它作为答案,IsXValueIndexed似乎只需一个系列就足够了。空数据点似乎在使用多个系列时使用得更好。我以前从未尝试过多个系列,我稍后会尝试。Thanx@jbl