0 Replies Latest reply on Sep 28, 2006 1:29 PM by stratosnatcher

    Binding nested XML into Charts

    stratosnatcher
      I have the following XML structure:

      <Stations>
      <station name="Station 1" downtime="10">
      <reason name="Reason 1" value="10" />
      <reason name="Reason 2" value="20" />
      <reason name="Reason 3" value="30" />
      </station>
      <station name="Station 1" downtime="10">
      <reason name="Reason 1" value="10" />
      <reason name="Reason 2" value="20" />
      <reason name="Reason 3" value="30" />
      </station>
      <station name="Station 1" downtime="10">
      <reason name="Reason 1" value="10" />
      <reason name="Reason 2" value="20" />
      <reason name="Reason 3" value="30" />
      </station>
      </Station>

      I have an HTTPRequest called "srv" using resultFormat="e4x", and I have a LineGraph whose dataProvider is set as

      dataProvider="{srv.lastResult.station}"

      Apparently you have to skip the root node (Stations). I can access the name and downtime attributes of the station tags with no problem.

      Then I have a PieChart, and I want it to use the list of reasons under one station. I tried using dataProvider="{srv.lastResult.station[0].reason}" with success, but a warning says this cannot automatically update the chart because I use the [ ] operator.

      And I guess if I want to change, at runtime, which stations reasons to use, that is impractical unless I can use an index in the [ ]'s (and maybe I can). But at any rate, is there a way to make that binding without actually extracting data out into a collection using some other MXML, or just separating out the XML in some ActionScript?

      *Sigh* The binding mechanisms just seem very quirky...