Page 1 of 1

Streaming WEB teechart

Posted: Fri May 19, 2006 2:26 pm
by 6927799
I need to pass a web teechart in a stream from one app to another, I can't find a method to save the web teechart to a stream. Is it posible?
Could you give an example of how to save to and load from a stream a web teechart?

thank you

Posted: Fri May 19, 2006 2:48 pm
by narcis
Hi Hermes,

Yes, you can do something like this:

Code: Select all

  protected void Button1_Click(object sender, EventArgs e)
  {
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    WebChart1.Chart.Export.Template.Save(stream);
    Session.Add("ch1", stream);
  }
  protected void Button2_Click(object sender, EventArgs e)
  {
    WebChart1.Chart.Series.RemoveAllSeries();
  }
  protected void Button3_Click(object sender, EventArgs e)
  {
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    stream = (System.IO.MemoryStream)Session["ch1"]; 
    stream.Position = 0;
    WebChart1.Chart.Import.Template.Load(stream);
    stream.Close();
  }