c# how to draw line chart

32,155

Set the ChartType propetry of the series to Line:

series.ChartType = SeriesChartType.Line;
Share:
32,155
Harshit
Author by

Harshit

Updated on September 18, 2020

Comments

  • Harshit
    Harshit over 3 years

    I am trying to create line chart to display the data. Currently I have the code to display bar chart. Here it is

    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);
    
    }
    

    It works perfectly fine. How could I modify this to display line chart ?

    Thanks