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?
charts returning very slow
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
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);
}
}
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);
}
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Cory,
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.the samples all use a FillSampleValues method. What code should I write to replace that?
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 |
Instructions - How to post in this forum |
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);
}
}
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);
}
}
Hi, Cory.
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 ?slowing it down is when GetChart.aspx is generating the chart.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com