Vinod Handigudmath

Vinod Handigudmath

  • NA
  • 45
  • 19.5k

plotting the graph from large amount of data in asp.net c#

Aug 26 2013 7:15 AM

Hi everyone,

 

  • I am facing problem in plotting the graph from large amount of data i.e. the data rows vary from 20000 to 500k.
  • I am using MS chart control, asp.net and c#.
  • It is line chart.
  • X axis is date time and Y axis can contain 6 parameters maximum.

 

When the database contains less number of records i.e. from 5000 to 8000 records then the graph plots without any problem. But when the database has records ranging from 10k to 500k then application doesn't plot the graph.

 

I debugged the code, nowhere it is breaking. So I want to know is there any other way to handle such large amount data to plot the graph.

 

Below is my code,

 

    cmd.CommandText = "select * from Tablename";

    cmd.Connection = con;

    cmd.Connection.Open();

    SqlDataAdapter da=new SqlDataAdapter();

    da.SelectCommand = cmd;

    DataTable dt = new DataTable();

    da.Fill(dt);

    cmd.Connection.Close();

    YearlyPowerChart.Series[0].IsVisibleInLegend = true;

    YearlyPowerChart.Series[0].XValueMember = dt.Columns["Time_Stamp"].ToString();

        YearlyPowerChart.Series[0].YValueMembers = dt.Columns["PV-1 Power(kW)"].ToString();

    YearlyPowerChart.Series[0].Name = "PV-1 Power(kW)";

    YearlyPowerChart.Series[0].Color = color0;

 

    YearlyPowerChart.Series[1].IsVisibleInLegend = true;

    YearlyPowerChart.Series[1].XValueMember = dt.Columns["Time_Stamp"].ToString();

        YearlyPowerChart.Series[1].YValueMembers = dt.Columns["PV-2 Power(kW)"].ToString();

    YearlyPowerChart.Series[1].Name = "PV-2 Power(kW)";

    YearlyPowerChart.Series[1].Color = color1;

 

    YearlyPowerChart.Series[2].IsVisibleInLegend = true;

    YearlyPowerChart.Series[2].XValueMember = dt.Columns["Time_Stamp"].ToString();

    YearlyPowerChart.Series[2].YValueMembers = dt.Columns["Battery Power(kW)"].ToString();

    YearlyPowerChart.Series[2].Name = " Battery Power(kW)";

    YearlyPowerChart.Series[2].Color = color2;

 

    YearlyPowerChart.Series[3].IsVisibleInLegend = true;

    YearlyPowerChart.Series[3].XValueMember = dt.Columns["Time_Stamp"].ToString();

    YearlyPowerChart.Series[3].YValueMembers = dt.Columns["Inverter Total Watts(kW)"].ToString();

    YearlyPowerChart.Series[3].Name = " Inverter Total Watts(kW)";

    YearlyPowerChart.Series[3].Color = color3;

 

Please help me as soon as possible, Thanks in advance.