Page 1 of 1

How to combine 2 series in two chart into one chart?

Posted: Tue May 30, 2006 8:18 am
by 9529132
Hi, there,

If I have two charts displaying two series seperately, is there any way to combine them and display in only one chart?

Thanks!
David

Posted: Tue May 30, 2006 9:02 am
by narcis
Hi David,

Could you please gives us some more information on how would you like to combine the series?

Thanks in advance.

Posted: Tue May 30, 2006 10:16 am
by 9529132
Hi, Narcís,

For example, chart1 contains a fastline series fs1 displaying speed(Y) vs position (x) and x is from x1 to x2, and chart2 contains another fastline series fs2 also displaying speed vs position from x3 to x4. Is it possible to use chart3 to display fs1 and fs2 together with x ranging from min(x1,x3) to max(x2,x4)?

Thanks a lot!
David

Posted: Tue May 30, 2006 10:26 am
by narcis
Hi David,

The easiest way to achieve that may be exporting both series data to XML and then import data to chart3 use XML LoadMode set to lmAppend as here.

For more information on how to import and export charts please read Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials at TeeChart's program group.

Posted: Wed May 31, 2006 1:15 am
by 9529132
Hi, Narcís

If I export the series first, does that mean there has to be temporary files generated? And what is the difference between SeriesTextSource and SeriesXMLSource besides the file format? Also from the thread you suggested, I guessed that there is only one series in that XML file. If I have to load two xml files or even more, How should I realize it? A simple example will be greatly appreciated!

Thank you very much!

David

Posted: Wed May 31, 2006 9:12 am
by narcis
Hi David,
If I export the series first, does that mean there has to be temporary files generated?


Yes, you should create at least one xml file.
And what is the difference between SeriesTextSource and SeriesXMLSource besides the file format?


SeriesXMLSource only loads a xml file to a chart while SeriesTextSource lets you allows access to the properties and methods associated with the manipulation of data from text sources. I.e.: You can choose which columns to plot, which is the column separator, etc.
Also from the thread you suggested, I guessed that there is only one series in that XML file. If I have to load two xml files or even more, How should I realize it? A simple example will be greatly appreciated!
No, you can have more than one series in a xml file as you can see in the All Features\Welcome!\Components\XML Import Source\XML from Web example at TeeChart features demo, available at its program group.

Regarding on how to append data when importing an xml file you can do something like this:

Code: Select all

Private Sub Command1_Click()
    TChart1.Series(0).FillSampleValues 10
End Sub

Private Sub Command2_Click()
    TChart1.Export.asXML.SaveToFile ("C:\temp\chart.xml")
End Sub

Private Sub Command3_Click()
  With SeriesXMLSource1
    .FileName = "C:\temp\chart.xml"
    .Series = TChart1.Series(0)
    .SeriesNode = "Series0"
    .LoadMode = lmAppend
    .ValueSource = "Y"
    '.Open
    .Load
  End With
End Sub

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 10
End Sub

Posted: Wed May 31, 2006 9:47 am
by 9529132
Hi, Narcís,

Thank you very much for the reply. But still the old problem, would you please convert the VB code to VC code? I sometimes found it really difficult to do it myself because the teechart tutorial on VC app is too limited.

Thanks for your help.

David

Posted: Thu Jun 08, 2006 11:43 am
by Pep
Hi David,

I'm not sure if you still having problem with the Translation of the XmlSource seeing your other post. If you need help translating it please let me know (and also which part of code ) and I'll do it asap.

Posted: Fri Jun 09, 2006 1:29 am
by 9529132
Thank you very much, Pep. I have replied in http://www.teechart.net/support/viewtop ... 5217#15217.

I remember you also replied my previous questions on Teechart in VC++. It seems you are the only one that knows how to use Teechart in VC++.

Thanks again.
David