Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
Unable to load a chart using xml file
posted

I have an xml file with following format,

When I create an xml datasource and assign it to chart datasource, it is not populating the chart based on the values in xml file. I was looking at Columns chart, where X coordinate is Year and Y-Coordinate is Interval.

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

<ReportPeriod>

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

<Period Duration="1 Year">

<Dur>

     <Year> 2 </Year>

      <Interval>60</Interval>

</Dur>

<Dur>

     <Year> 3 </Year>

      <Interval>30</Interval>

</Dur>

<Dur>

     <Year> 4 </Year>

      <Interval>20</Interval>

</Dur>

<Dur>

     <Year> 5</Year>

      <Interval>90</Interval>

</Dur>

</Period>

</ReportPeriod>

Any help would be appreciated.

Thanks

Nat

  • 90
    posted

    Thank you

  • 28496
    Verified Answer
    Offline posted

    the chart won't infer the schema from that xml file, so it doesn't know that the Interval column is numeric.  this will work, though:

    DataSet ds = new DataSet();
                ds.Tables.Add("Dur");
                ds.Tables["Dur"].Columns.Add("Year", typeof(string));
                ds.Tables["Dur"].Columns.Add("Interval", typeof(double));
                ds.ReadXml("..\\..\\xmlfile1.xml", XmlReadMode.IgnoreSchema);
                this.ultraChart1.Data.DataSource = ds.Tables["Dur"];
                this.ultraChart1.Data.DataBind();