How to serialize all the teechart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
fchio
Newbie
Newbie
Posts: 2
Joined: Wed Dec 19, 2007 12:00 am
Location: méxico
Contact:

How to serialize all the teechart

Post by fchio » Thu Dec 20, 2007 2:52 am

Hi actually Im develop with TeeChart, and I need to save to an XML my Chart but when i use:

System.IO.MemoryStream fs = new System.IO.MemoryStream();

Steema.TeeChart.Export.DataExport dataExport = new Steema.TeeChart.Export.DataExport(graphic.Chart);

dataExport.XML.IncludeHeader = true;
dataExport.XML.IncludeIndex = true;
dataExport.XML.IncludeLabels = true;
dataExport.XML.IncludeSeriesTitle = true;

dataExport.XML.Save(fs);
fs.Flush();
XmlDocument xmlPanel = new XmlDocument();
fs.Seek(0, System.IO.SeekOrigin.Begin);
xmlPanel.Load(fs);
fs.Close();

I only save the data, labels, index and headers. So I need to save the colors the position the rotation, and too much information, so How I can save all the information for latter save all this in a XML

Later When I load the information I do the next

XmlDocument xmlMain = new XmlDocument();
XmlNode nodeImp = xmlMain.ImportNode(nodeGraph, true);
xmlMain.AppendChild(nodeImp);

System.IO.MemoryStream ms = new System.IO.MemoryStream();
xmlMain.Save(ms);
string s = xmlMain.InnerXml;
ms.Flush();
ms.Seek(0, System.IO.SeekOrigin.Begin);
ms.Position = 0;

Steema.TeeChart.Import.Imports();
graphic.Chart.Import.Template.Load(ms);

graphic.Import.Template.Load(ms);
graphic.Refresh();

But it send an error to say that couldn't load binary data.

Please What can I do to solve my problem..

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 Dec 20, 2007 10:19 am

Hi fchio,

The easiest way to achieve what you request is exporting TeeChart to its native template file format which also supports exporting chart's data. For more information please read Tutorial 12 - Exporting and Importing Charts
, specially the TeeChart's 'Ten' template and data export import format section. TeeChart native templates can be either stored in a file or a MemoryStream.
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

Post Reply