About the using of SeriesXMLSource

TeeChart for ActiveX, COM and ASP
Post Reply
Candy
Newbie
Newbie
Posts: 57
Joined: Mon Apr 26, 2010 12:00 am
Contact:

About the using of SeriesXMLSource

Post by Candy » Tue Mar 08, 2011 7:25 am

Hello,
I use the SeriesXMLSource1 to add the data to my chart ,but it happens a error . The following is my code:
code:
LPTSTR LP;
CString STR;
m_pIndex++;
//Chart1 *m_Chart2;
VARIANT SourceSeries;
//m_Chart1.AddSeries(1);
UpdateData(TRUE);
SourceSeries.vt=VT_DISPATCH;
CSeries InputSeries=m_Chart1.Series(0);
SourceSeries.pdispVal=InputSeries;
//x axis lable format set
CAxes Axes;
CAxis Axis;
Axes=m_Chart1.get_Axis();
CAxisLabels Axislabels=Axes.GetBottom().GetLabels();
Axislabels.SetDateTimeFormat(L"yy-mm-dd HH:mm:ss");
//databinding
m_SeriesXMLSource1.SetFileName(L"D:\\DEV-DEMO\\SampleData.xml"); //This can also be a local file
m_SeriesXMLSource1.SetSeries(SourceSeries);
m_SeriesXMLSource1.SetSeriesNode(L"USA");
m_SeriesXMLSource1.SetValueSource(L"Bar");
m_SeriesXMLSource1.Open();

The attachment is the screenshot of error and the xml file. Is there something wrong in my xml file (The "X" is seted to a date value )?
Attachments
teechart.rar
(15.08 KiB) Downloaded 641 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: About the using of SeriesXMLSource

Post by Yeray » Wed Mar 09, 2011 12:10 pm

Hi Candy,

I've loaded your XML into a VB6 chart without problems with the following code:

Code: Select all

Private Sub Form_Load()  
  TChart1.Aspect.View3D = False
  TChart1.Legend.Visible = False
  
  Dim i As Integer
  For i = 0 To 26
    With SeriesXMLSource1
      .FileName = "C:\tmp\SampleData.xml"
      
      Select Case i
      Case 0 To 25:
        TChart1.AddSeries scBar
        .ValueSource = "Bar"
      Case 26:
        TChart1.AddSeries scPoint
        .ValueSource = "Point"
      End Select
      
      .Series = TChart1.Series(i)
      TChart1.Series(i).Color = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
      
      Select Case i
      Case 0:
        .SeriesNode = "USA"
      Case 1 To 22:
        .SeriesNode = (i)
      Case 23:
        .SeriesNode = "Europe"
      Case 24:
        .SeriesNode = "Asia"
      Case 25:
        .SeriesNode = "Revenue"
      End Select
      
      .Open
    End With
  Next i
End Sub
Chart.png
Chart.png (16.19 KiB) Viewed 4891 times
The error message in your image makes me think that you could be loading an string directly as Xvalue without converting it to DateTime or Double.
If you still have problems with it, could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply