3 Replies Latest reply on Dec 2, 2008 8:06 AM by Newsgroup_User

    HTTPService and PieChart

    Johnking08 Level 1
      My XML data:

      <myshop>
      <inventory>
      <quantity id="1" manufacturer="Coke">650</quantity>
      <quantity id="2" manufacturer="Pepsi">741</quantity>
      <quantity id="3" manufacturer="Cadbury Schweppes Americas Beverages">70</quantity>
      <quantity id="4" manufacturer="Ozarka">210</quantity>
      <quantity id="5" manufacturer="Nestle">220</quantity>
      <quantity id="6" manufacturer="Glaceau">120</quantity>
      <quantity id="7" manufacturer="REXAM">20</quantity>
      <quantity id="8" manufacturer="Starbucks">21</quantity>
      </inventory>
      </myshop>



      <mx:Canvas>
      <mx:Form>
      <mx:PieChart id="byManufacturer" height="100%" width="100%"
      dataProvider="{myservice.lastResult.inventory.quantity}" showDataTips="true">
      <mx:series>
      <mx:PieSeries field="." nameField="@manufacturer"
      startAngle="0" labelPosition="callout"/>
      </mx:series>
      </mx:PieChart>
      </mx:Form>
      <mx:HTTPService id="myservice" resultFormat="e4x" url=" http://www.xyz.com/inventory.xml" />
      </mx:Canvas>

      Somehow I can not display the data because the XML is not parsed correctly. Any suggestions?
        • 1. Re: HTTPService and PieChart
          Level 7

          "Johnking08" <webforumsuser@macromedia.com> wrote in message
          news:gh2h0m$dqj$1@forums.macromedia.com...
          > My XML data:
          >
          > <myshop>
          > <inventory>
          > <quantity id="1" manufacturer="Coke">650</quantity>
          > <quantity id="2" manufacturer="Pepsi">741</quantity>
          > <quantity id="3" manufacturer="Cadbury Schweppes Americas
          > Beverages">70</quantity>
          > <quantity id="4" manufacturer="Ozarka">210</quantity>
          > <quantity id="5" manufacturer="Nestle">220</quantity>
          > <quantity id="6" manufacturer="Glaceau">120</quantity>
          > <quantity id="7" manufacturer="REXAM">20</quantity>
          > <quantity id="8" manufacturer="Starbucks">21</quantity>
          > </inventory>
          > </myshop>
          >
          >
          >
          > <mx:Canvas>
          > <mx:Form>
          > <mx:PieChart id="byManufacturer" height="100%" width="100%"
          > dataProvider="{myservice.lastResult.inventory.quantity}"
          > showDataTips="true">
          > <mx:series>
          > <mx:PieSeries field="." nameField="@manufacturer"
          > startAngle="0" labelPosition="callout"/>
          > </mx:series>
          > </mx:PieChart>
          > </mx:Form>
          > <mx:HTTPService id="myservice" resultFormat="e4x"
          > url=" http://www.xyz.com/inventory.xml" />
          > </mx:Canvas>
          >
          > Somehow I can not display the data because the XML is not parsed
          > correctly.
          > Any suggestions?

          Try taking out field="."

          HTH;

          Amy


          • 2. HTTPService and PieChart
            Johnking08 Level 1
            I tried it. It did not work.

            What I need to do is to retrieve the text value of <quantity> element as well as its manufacturer attribute value. In general, it is related to read the content of the current element.

            It looks like the XML structure needs modified. I hope that Flex can parse
            any kind of XML structures..
            • 3. Re: HTTPService and PieChart
              Level 7

              "Johnking08" <webforumsuser@macromedia.com> wrote in message
              news:gh3jrm$qi9$1@forums.macromedia.com...
              > What I need to do is to retrieve the text value of <quantity> element as
              > well
              > as its manufacturer attribute value.
              >
              > It looks like the XML structure needs modified. I hope that Flex can parse
              > any kind of XML structures..

              Use a dataFunction to return the text() of the nodes.

              HTH;

              Amy