I am attempting to create an ASP application that uses a cumulative graph. The problem I have is that every time a control button is activated, the page reloads and the previous data dissapears. This was not an issue in windows froms. How can I retain the current series on page reload when adding another series?
I assume this is something to do with the TEMPCHART setting. Can someone tell me how to set this to Session? I am new to ASP and the tutorial in section 9 did not make it clear to me.
Cumulative Graph in ASP??
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi -
You can use code similar to the following:
You can use code similar to the following:
Code: Select all
private void Page_Load(object sender, System.EventArgs e)
{
// ****************************************************
//The data load code for WebChart1 demostrates a technique to save
//data between page calls. The Chart is saved as a TeeChart template
//to a session variable.
// ****************************************************
Steema.TeeChart.Chart ch1=WebChart1.Chart;
MemoryStream tmpChart=new MemoryStream();
if (Session["ch1"]==null)
{
//setup Chart
if (ch1.Series.Count<2)
{
ch1.Series.Add(new Steema.TeeChart.Styles.Points());
ch1.Series.Add(new Steema.TeeChart.Styles.Points());
}
ch1.Header.Text="Chart 1.";
((Steema.TeeChart.Styles.Points)ch1.Series[0]).Pointer.Pen.Visible=false;
((Steema.TeeChart.Styles.Points)ch1.Series[1]).Pointer.Pen.Color=Color.FromArgb(79,79,255);
ch1.Series[0].Color=Color.FromArgb(255,199,26);
ch1.Series[1].Color=Color.FromArgb(106,106,255);
ch1.Series[0].FillSampleValues(5);
ch1.Series[1].FillSampleValues(5);
//export Chart to a MemoryStream template
ch1.Export.Template.Save(tmpChart);
//save template to a Session variable
Session.Add("ch1",tmpChart);
}
else
{
//retrieve the session stored Chart
tmpChart=(MemoryStream)Session["ch1"];
//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
ch1.Import.Template.Load(tmpChart);
}
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/