Is there any sample code around showing how to read in the XML formated code that is put on the clipboard when a user exports the data from a TeeChart to Excel format?
I have Chart #1 up and I go to the Chart Editor Tool, go to Export tab, select Excel format, and press the copy button. I now have the data in the chart in excel format. i would like to paste it into my application that has another TeeChart control on it. I will create the series and add the points to the series, but I need a straight forward way to process the data which looks like the following when I do Clipboard.GetText()
<table border="1">
<tr><td>X</td><td>Y</td><td>Z</td></tr>
<tr><td>-10</td><td>-9.06640217149325E-08</td><td>-10</td></tr>
<tr><td>-10</td><td>-4.7196580801641E-07</td><td>-9</td></tr>
<tr><td>-10</td><td>-1.94626105447176E-06</td><td>-8</td></tr>
<tr><td>10</td><td>2.66432129899291E-07</td><td>10</td></tr>
</table>
Importing Excel data from export
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Mike,
Why don't you directly use XML importing/exporting? At Tutorial 12 - Exporting and Importing Charts you'll find information on how to export/import using XML format.
Why don't you directly use XML importing/exporting? At Tutorial 12 - Exporting and Importing Charts you'll find information on how to export/import using XML format.
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 |
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Over sight
I over looked that example. Thanks for bringing it to my attention
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
How do you decide on the series source
The example you pointed me to is nice, but it skips a critical step. When setting up to read the XML data in, how do you know what the series style of the data. In other words how do you know that user created the XML data from a Points, Points3D, Surface or other style. That is a critical piece of information before calling the xmlSource.Load(). Calling load after setting the series property to the wrong series style is causing an exception, "Illegal characters in path"
I was looking at the format of the data when I exported it from the TeeChart Examples for .NET application. I went to Welcome !\Components\ChartController\Custom Buttons and opened up the chart editor. Went to the Export tab and selected XML format. Copied it to the windows clipboard and pasted into my application where I call Clipboard.GetText(). I notice the XML contains a nice well formated XML with the Series Style type inside. Clearly shows type = "Line". I would expect the XmlSource to load this and determine the type with out me have to inspect the XML.
Am I overlooking something. Or do I need to load the XML up into a document and inspect it first before I call code that loads up XmlSource object?
Code: Select all
protected override void button1_Click(object sender, System.EventArgs e)
tChart1.Series.RemoveAllSeries();
Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart); // <- How do you know the series style to use here?
points1.Title = "Points Series";
xmlSource1.Series = points1;
xmlSource1.SeriesNode = "Points Series";
xmlSource1.Load(textBox2.Text);
tChart1.Refresh();
Code: Select all
<chart>
- <series title="line1" type="Line">
- <points count="25">
<point Y="196" />
<point Y="157" />
<point Y="141" />
<point Y="226" />
<point Y="179" />
<point Y="188" />
<point Y="129" />
<point Y="239" />
<point Y="354" />
<point Y="401" />
<point Y="512" />
<point Y="575" />
<point Y="536" />
<point Y="491" />
<point Y="514" />
<point Y="624" />
<point Y="721" />
<point Y="762" />
<point Y="703" />
<point Y="596" />
<point Y="510" />
<point Y="593" />
<point Y="699" />
<point Y="614" />
<point Y="540" />
</points>
</series>
</chart>
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Mike,
Yes, the series style information in the XML document creates the series for you so you can do something as simple as this:
Yes, the series style information in the XML document creates the series for you so you can do something as simple as this:
Code: Select all
tChart1.Series.Clear(true);
Steema.TeeChart.Data.XmlSource xmlSource1 = new Steema.TeeChart.Data.XmlSource(tChart1.Chart);
xmlSource1.Load(DataFile);
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 |