Page 1 of 1

charts returning very slow

Posted: Wed Apr 13, 2005 9:06 pm
by 8128609
I am creating 3 pie charts on a webform using the .net class, and they are returning very slow.

I am putting them into a memory stream and my tempchart=session.

Can someone help me figure out why the charts are bogging my web site down so much?

Posted: Thu Apr 14, 2005 8:31 am
by narcis
Hi Cory,

That seems quit strange. Have you had a look at the "ASP Live Examples" available at the TeeChart program group?

Could you please send us a project we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

Posted: Thu Apr 14, 2005 12:18 pm
by 8128609
I just sent some sample code through the email. It runs slowly on by pc and the server. As far as the live samples, where can I get to those?

Posted: Thu Apr 14, 2005 1:01 pm
by narcis
Hi Cory,

Where did you sent the sample code? Could you please post it at the newsgroup I told in my previous message?

Regarding the live examples you cn find them at the TeeChart for .NET folder at the program manager (Start Menu\All Programs). You'll find an entry called "ASP Server Examples". Running it will direct you to those examples.

Posted: Thu Apr 14, 2005 1:03 pm
by 8128609
the samples all use a FillSampleValues method. What code should I write to replace that?

Posted: Thu Apr 14, 2005 1:08 pm
by 8128609
those sample is where I got the code I am using:

public void LoadLeasedOwned()

{

Intel.PMT.CommonClasses.cData oData = new Intel.PMT.CommonClasses.cData();

DataSet ds = new DataSet();

ds = oData.ExecuteQuery("Exec sp_bldgs_leased_owned");

System.Drawing.Color sliceColor = new Color();



MemoryStream tmpChart=new MemoryStream();



if (Session["pieLeasedOwned"]==null)

{



foreach(DataTable myTable in ds.Tables)

{

foreach(DataRow myRow in myTable.Rows)

{



if (myRow["tnnt_desc"].ToString().Trim() == "Owned")

{

sliceColor = Color.Maroon;

}

else

{

sliceColor = Color.LightBlue;

}

pieLeasedOwned.Chart.Series[0].Add((int)myRow["Num"],myRow["tnnt_desc"].ToString(),sliceColor);



}

}



//Chart



//Series

pieLeasedOwned.Chart.Series[0].PercentFormat="##0%";



//Panel

pieLeasedOwned.Chart.Panel.Color=Color.LightYellow;



//Aspect

pieLeasedOwned.Chart.Aspect.View3D=false;

pieLeasedOwned.Chart.Aspect.ZoomText=false;



//Legend

pieLeasedOwned.Chart.Legend.Visible=true;

pieLeasedOwned.Chart.Legend.TextStyle = Steema.TeeChart.LegendTextStyles.Plain;

pieLeasedOwned.Chart.Legend.Font.Size=7;

pieLeasedOwned.Chart.Legend.Font.Bold=true;

pieLeasedOwned.Chart.Legend.Color = Color.LightYellow;

pieLeasedOwned.Chart.Legend.Shadow.Visible=false;

pieLeasedOwned.Chart.Legend.Pen.Visible=false;



//Marks

pieLeasedOwned.Chart.Series[0].Marks.Visible=true;

pieLeasedOwned.Chart.Series[0].Marks.ArrowLength = 2;

pieLeasedOwned.Chart.Series[0].Marks.Arrow.Visible=false;

pieLeasedOwned.Chart.Series[0].Marks.Font.Size=6;

pieLeasedOwned.Chart.Series[0].Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;

pieLeasedOwned.Chart.Series[0].Marks.Bevel.Width=0;

pieLeasedOwned.Chart.Series[0].Marks.Pen.Visible=false;

pieLeasedOwned.Chart.Series[0].Marks.Shadow.Visible=false;





//Header

pieLeasedOwned.Chart.Header.Visible = false;



//export Chart to a MemoryStream template

pieLeasedOwned.Chart.Export.Template.Save(tmpChart);



//save template to a Session variable

Session.Add("pieLeasedOwned",tmpChart);

}

else

{

//retrieve the session stored Chart

tmpChart=(MemoryStream)Session["pieLeasedOwned"];

//set the Stream position to 0 as the last read/write

//will have moved the position to the end of the stream

tmpChart.Position=0;

//import saved Chart

pieLeasedOwned.Chart.Import.Template.Load(tmpChart);

}



}

Posted: Thu Apr 14, 2005 1:40 pm
by narcis
Hi Cory,
the samples all use a FillSampleValues method. What code should I write to replace that?
You have several options, you can use the Add method as in the code you posted in your next message (shown below) or use any Add method's overrides.

Code: Select all

pieLeasedOwned.Chart.Series[0].Add((int)myRow["Num"],myRow["tnnt_desc"].ToString(),sliceColor); 

Posted: Thu Apr 14, 2005 1:44 pm
by 8128609
when I step through it everything runs very slow which makes me think that the part that is slowing it down is when GetChart.aspx is generating the chart. that code looks like:
private void Page_Load(object sender, System.EventArgs e)
{
// *************************************************************
// Code to retrieve Session saved streamed Charts to a WebForm.
// This code should be included if the WebChart 'UseStreams' property is set to True.
// *************************************************************

string chartName=Request.QueryString["Chart"];

if (Session[chartName]!=null)
{
MemoryStream chartStream = new MemoryStream();
chartStream=((MemoryStream)Session[chartName]);
Response.OutputStream.Write(chartStream.ToArray(),0,(int)chartStream.Length);
chartStream.Close();
Session.Remove(chartName);
}
}

Posted: Tue Apr 19, 2005 11:57 am
by Marjan
Hi, Cory.
slowing it down is when GetChart.aspx is generating the chart.
That's true, but what exactly is slowing down chart generation cannot be identified from this. I suspect it's related to getting data from dataset and adding it to chart series. If you simply populate your series with "fake" values, does it also take so long to generate chart ?