1 Reply Latest reply on Nov 4, 2006 2:19 PM by peterent

    External XML file for pie chart not displaying

    JoeFree999999
      Have the below external XML file titled "percent.xml" for a demo application with a pie chart:

      <?xml version="1.0"?>
      <percent percent="35" a="0.0" b="0.200"/>
      <percent percent="25" a="0.2" b="0.4"/>
      <percent percent="40" a="0.4" b="0.6"/>


      The XML file is specified as:

      <mx:XML id="dist" source="percent.xml"/>


      The pie chart is specified as:

      <mx:PieChart id="pieChart" dataProvider="{dist}"
      <mx:series>
      <mx:PieSeries labelPosition="callout" field="percent" />
      </mx:series>
      </mx:PieChart>

      When the data is in a ArrayCollection the pie chart displays.
      Why does the pie chart not display when the dataProvider is an external XML file?

      Thanks in advance.
        • 1. Re: External XML file for pie chart not displaying
          peterent Level 2
          Specifying XML data is different than for Arrays.

          dataProvider="{dist}" means that you have specified an XML document. What the chart is looking for is an array - a set of repeated items.

          dataProvider="{dist.percent}" will do the trick. The notation dist.percent is actually an XMLList. This is probably a strange way to indicate it, that's the way to do it.