C# 在MSChart中放置线

C# 在MSChart中放置线,c#,mschart,C#,Mschart,我在C#程序中使用MSChart创建线图,但找不到任何选项来创建“下降线”,即从每个数据点下降到X轴的线。 有人能帮忙吗? 谢谢。我使用LineAnnotation对象解决了我的问题: int index = 1; foreach (DataPoint _point in series1.Points) { LineAnnotation annotation = new LineAnnotation(); annotation.LineColor = Color.Black;

我在C#程序中使用MSChart创建线图,但找不到任何选项来创建“下降线”,即从每个数据点下降到X轴的线。 有人能帮忙吗?
谢谢。

我使用LineAnnotation对象解决了我的问题:

int index = 1;
foreach (DataPoint _point in series1.Points)
{
    LineAnnotation annotation = new LineAnnotation();
    annotation.LineColor = Color.Black;
    annotation.LineWidth = 4;
    annotation.LineDashStyle = ChartDashStyle.Dot;
    annotation.AxisX = chartArea1.AxisX;
    annotation.AxisY = chartArea1.AxisY;
    annotation.AnchorX = index;
    annotation.AnchorY = 0;
    annotation.Height = _point.YValues[0];
    annotation.Width = 0;
    annotation.IsSizeAlwaysRelative = false;
    annotation.ClipToChartArea = "ChartArea1";

    chart1.Annotations.Add(annotation);
    index++;
}
有趣的是,当我将注释锚定到数据点本身时,上面的代码表现得很奇怪,即使我的所有点都在同一象限中,也会向上和向下绘制一些线。经过多次尝试,我通过将注释锚定到X轴上适当的“已删除”点来解决问题