charts returning very slow

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Cory
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2005 5:00 am

charts returning very slow

Post by Cory » Wed Apr 13, 2005 9:06 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 14, 2005 8:31 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Cory
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2005 5:00 am

Post by Cory » Thu Apr 14, 2005 12:18 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 14, 2005 1:01 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Cory
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2005 5:00 am

Post by Cory » Thu Apr 14, 2005 1:03 pm

the samples all use a FillSampleValues method. What code should I write to replace that?

Cory
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2005 5:00 am

Post by Cory » Thu Apr 14, 2005 1:08 pm

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

}



}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 14, 2005 1:40 pm

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); 
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Cory
Newbie
Newbie
Posts: 9
Joined: Mon Jan 17, 2005 5:00 am

Post by Cory » Thu Apr 14, 2005 1:44 pm

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Apr 19, 2005 11:57 am

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 ?
Marjan Slatinek,
http://www.steema.com

Post Reply