Page 1 of 1

Totally beaten by SeriesXMLSource

Posted: Wed May 31, 2006 8:55 am
by 9529132
Hi, there,

Here is part of the code in the Tutorial 15 - MS VC++ Applications:
m_SeriesXMLSource1.SetFileName("http://www.steema.com/SampleData.xml");
m_SeriesXMLSource1.SetSeries(SourceSeries);
m_SeriesXMLSource1.SetSeriesNode("USA");
m_SeriesXMLSource1.SetValueSource("Bar");
m_SeriesXMLSource1.Open();

It can works. But when I changed it to

m_SeriesXMLSource1.SetFileName("http://www.steema.com/SampleData.xml");
m_SeriesXMLSource1.SetSeries(SourceSeries);
m_SeriesXMLSource1.SetSeriesNode("Revenue");
m_SeriesXMLSource1.SetValueSource("Line");
m_SeriesXMLSource1.Open();

(<series title="Revenue" type="Line" color="#FF0000"> as in the http://www.steema.com/SampleData.xml)

It won't work. Why? And that's the only VC++ code on SeriesXMLSource I could find. I tried so many times trying to use the VC code in the tutorial with my own xml files but I just could make it.

Would anyone please give me an example of how to import a xml file that has several series data and display in one chart? Is it possible to import several different xml files each of which has only one series, then display in one chart?

VC++ code please!!

Thank you very much!
David

Posted: Thu Jun 08, 2006 11:40 am
by Pep
Hi David,
It won't work. Why? And that's the only VC++ code on SeriesXMLSource I could find. I tried so many times trying to use the VC code in the tutorial with my own xml files but I just could make it.
The correct code for Line Series should be :

Code: Select all

m_SeriesXMLSource1.SetFileName("http://www.steema.com/SampleData.xml"); 
m_SeriesXMLSource1.SetSeries(SourceSeries); 
m_SeriesXMLSource1.SetSeriesNode("Revenue"); 
m_SeriesXMLSource1.SetValueSource("Y"); 
m_SeriesXMLSource1.Open(); 
Could you please check if it works fine for you using the above code ?
Would anyone please give me an example of how to import a xml file that has several series data and display in one chart?
You can use the following code (vb code) :

Code: Select all

Private Sub Command3_Click()
  With SeriesXMLSource1
    .FileName = "http://www.steema.com/SampleData.xml"
    .Chart = TChart1
    .Load      '<-- retrieve data and create series
  End With
End Sub
Is it possible to import several different xml files each of which has only one series, then display in one chart?
Yes, this can be done using one SeriesXMLSource, by assigning the parameters every time the Open is called, i.e :

Code: Select all

TChart1.AddSeries scLine
TChart1.AddSeries scBar

SeriesXMLSource1.LoadMode = lmAppend

with SeriesXMLSource1
.FileName = "http://www.steema.com/SampleData.xml"
.Series = TChart1.Series(0)
.SeriesNode = "Revenue"
.ValueSource = "Y"
.Open

.FileName = "http://www.steema.com/SampleData2.xml"
.Series = TChart1.Series(1)
.SeriesNode = "USA"
.ValueSource = "Bar"
.Open
end with

Posted: Fri Jun 09, 2006 1:25 am
by 9529132
Hi, Pep,

Thank you very much for your help. I tried to translate the last part of your post to C++ as below

VARIANT SourceSeries;
m_chart2.AddSeries(0);
m_chart2.AddSeries(0);
m_chart2.GetLegend().SetCheckBoxes(TRUE);

SourceSeries.vt=VT_DISPATCH;
CSeries InputSeries=m_chart2.Series(0);
SourceSeries.pdispVal=InputSeries;

m_XMLSource1.SetFileName("http://www.steema.com/SampleData.xml"); //This can also be a local file
m_XMLSource1.SetSeries(SourceSeries);
m_XMLSource1.SetSeriesNode("Expenses");
m_XMLSource1.SetValueSource("Y");
m_XMLSource1.Open();

InputSeries=m_chart2.Series(1);
SourceSeries.pdispVal=InputSeries;
m_XMLSource1.SetFileName("http://www.steema.com/SampleData.xml"); //This can also be a local file
m_XMLSource1.SetSeries(SourceSeries);
m_XMLSource1.SetSeriesNode("Revenue");
m_XMLSource1.SetValueSource("Y");
m_XMLSource1.Open();

It seems working, but I can't find the corresponding code for
SeriesXMLSource1.LoadMode = lmAppend
Is it needed in C++? Did I come up with the correct way to import several different xml files and display them in one chart?

thanks again.
David

Posted: Fri Jun 09, 2006 1:34 am
by 9529132
BTW, I also asked another question in C++. Would you please help me have a look?
http://www.teechart.net/support/viewtopic.php?t=4154