Best solution to store the state of the charts

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Anton Rau
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: Zurich, Switzerland

Best solution to store the state of the charts

Post by Anton Rau » Tue Jan 27, 2004 11:01 am

Hello

I have a program which controls experimental setup and so I have to
implement such a feature like you can stop an experiment, exit a program and
then, next time you start a program, all charts have to be restored at the
previous state. I have tried a .ten files but templates overwrite the series
data so I cannot append new data to series. Also I have tried to serialize a
series data but it seems that they are not serializable.

What is the best method to store the charts data if I intend to use them
later? By the way, series are created during runtime and amount of
experimental data is really huge so xml serialization won't be the best
choice.

Thank you.

Best regards,
Anton Rau

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Jan 27, 2004 4:48 pm

Hello Anton,

.ten files should supply you with the functionality you require. I may not have understood the context of your application correctly but a .ten file may be saved with or without data (IncludeData property). After being imported more data can be added to the Series in continuation.

With that in mind, if that is not a workable solution, please could you explain in more detail the point in your mail:

"but templates overwrite the series data so I cannot append new data to series"

With thanks.

Regards,
Marc Meumann
Steema Software

Anton Rau
Newbie
Newbie
Posts: 11
Joined: Fri Nov 15, 2002 12:00 am
Location: Zurich, Switzerland

Post by Anton Rau » Tue Jan 27, 2004 7:09 pm

Hello Marc,

Thank you for your reply. I have tried to use .ten files. But the problem is that when I import data from the .ten file (saved together with data values) I can see series in the chart editor but it is impossible to add new values to that series. So I can see the picture of the previous session on the chart but when I add a new points nothing happens. Screen does not update.

What can it be?

Best regards,
Anton Rau

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Jan 27, 2004 10:08 pm

Hello Anton,

Here's a small test you could run to verify the adding of data to a .ten imported Chart.

eg. Add 2 Charts to a form and 3 buttons. To the click events of the buttons you can add the following code:

Code: Select all

private System.IO.MemoryStream memory;

private void button1_Click(object sender, System.EventArgs e)
{
  Line myLine=new Line(tChart1.Chart);
  myLine.FillSampleValues();

  // Save
  memory=new System.IO.MemoryStream();
  tChart1.Export.Template.Save(memory);
}

private void button2_Click(object sender, System.EventArgs e)
{
  //Load
  memory.Position=0;
  tChart2.Import.Template.Load(memory);    
}

private void button3_Click(object sender, System.EventArgs e)
{
  //Add new data
  Random r=new Random();
  tChart2[0].Add(tChart2[0].YValues.Maximum*r.NextDouble());
}
Clicking buttons 1 and 2 should save and load the Chart . You could do the same saving the Chart to a disk .ten file instead of the memory stream.

Clicking button3 should then add data to the imported Chart, a point for every click.

Please let us know if that doesn't work or if it highlights some differences with your own Charts that might help us understand the problem.

Regards,
Marc Meumann
Steema Support

petex
Newbie
Newbie
Posts: 4
Joined: Fri May 07, 2004 4:00 am

Saving the Line properties only

Post by petex » Mon Apr 25, 2005 9:38 am

Hi.

I need to program the same original requirement that Anton had, with a small difference: I need to save and then recover the line property settings for each line as indexed by its description label; kept in my own description of the trends. Allow me to explain:

I have several trends each with its own description label; when I re-generate a plot and I want to recover the line properties; the same trend name may be generated in a different line object, but I still want to recover for each trend the properties saved for the matching description label.

I tried to serialize the Line object with the same result Anton obtained (not serializable).

If I use the .ten file, I may recover for one line the properties of another line.

What would be the best approach.

Thanks.

Post Reply