Page 1 of 1

Slow Chart using Axtive X 5 C#.NET

Posted: Thu Aug 11, 2005 7:39 pm
by 6924764
Hello,

I'm using the version 5 active x component in the .Net environment. The chart displays correctly, but when I increase the number of days along the x axis (example 30 days) the chart displays too slowly. There are many series for the chart (20 or more series). I beleive the performace issue is because the data does not contain a row for each date for each series.
To compensate for the missing data I loop through each date for each series for each record to look for a matching record for that date for that series. I want each date in the period along the x axis regardless if there where events for that day or not. Here is the loop code:

for(int i=0;i<=Ts.TotalDays;i++) // all the days in the period
{
for(int j=0; j<=this.DChart.SeriesCount-1;j++) // each series
{
foreach(DDaily dd in al) // all of my records
{
WeHaveAMatch = false;
if(dd.RecordName == this.DChart.Series(j).Title && dd.DDate == Convert.ToDateTime(Session["StartDate"]).AddDays(i))
{ this.DChart.Series(j).AddXY(Convert.ToDateTime(Session["StartDate"]).AddDays(i).ToOADate(),dd.TotalDSum,string.Empty,this.DChart.Series(j).Color);
WeHaveAMatch = true;
break;
}
}
if (WeHaveAMatch == false)
{ this.DChart.Series(j).AddNullXY(Convert.ToDateTime(Session["StartDate"]).AddDays(i).ToOADate(),0,string.Empty);
}
}
}

If there is a match in my data I add the value to the series. Otherwise I add a nullXY for the series for that day. Like I said the chart generates correct, just slow. Is there a way to get a nice looking stacked bar without having to go through so many loops? Thank you.

Posted: Tue Aug 16, 2005 3:29 pm
by 6924764
I was able to resolve the issue. The slowness was cause by the data being returned by the database. In this case I was returning more data than neccessary, causing the loop in the application to go on for an excessive amount of time. By simplifying the data results the chart was produced in an acceptable amount of time. No changes to the application code where made.