c#如何绘制折线图

时间:2015-09-18 05:11:42

标签: c# charts linechart

我正在尝试创建折线图来显示数据。目前我有代码显示条形图。这是

using System.Windows.Forms.DataVisualization.Charting;

private void CreateChart()
{
    var series = new Series("Finance");

    // Frist parameter is X-Axis and Second is Collection of Y- Axis
    series.Points.DataBindXY(new[] { 2001, 2002, 2003, 2004 }, new[] { 100, 200, 90, 150 });
    chart1.Series.Add(series);

}

它完美无缺。我怎么能修改它来显示折线图?

由于

1 个答案:

答案 0 :(得分:7)

将系列的ChartType属性设置为Line

series.ChartType = SeriesChartType.Line;