How should I format an HTTPService result in Flex so that it is accessible for a pie chart?
Posted
by Eric Reynolds
on Stack Overflow
See other posts from Stack Overflow
or by Eric Reynolds
Published on 2010-06-15T14:05:35Z
Indexed on
2010/06/15
14:22 UTC
Read the original article
Hit count: 315
I feel like this should be simple, however everywhere I look online someone does something different. I am doing a small charting application to track download statistics, and want to put the data into a pie chart. I am new to Flex, so if my code is horrible I apologize.
<s:HTTPService id="service"
url="admin/stats/totalstats.php"
fault="service_faultHandler(event)"
result="service_resultHandler(event)" />
What is the best resultFormat for this purpose, and if I am assigning the returned value to an ActionScript variable, should it be an ArrayList? ArrayCollection?
Heres a sample of the XML being returned from the HTTPService
<DownloadStats>
<year count="24522" year="2008">
<month count="20" month="5" year="2008" full="May 2008">
<day count="2" month="5" day="20" year="2008"/>
<day count="1" month="5" day="21" year="2008"/>
<day count="9" month="5" day="22" year="2008"/>
<day count="1" month="5" day="23" year="2008"/>
<day count="1" month="5" day="29" year="2008"/>
<day count="1" month="5" day="30" year="2008"/>
<day count="5" month="5" day="31" year="2008"/>
</month>
...
</year>
<DownloadStats>
Any help is appreciated,
Thanks,
Eric R.
EDIT: I decided that it would be helpful to see how I am transferring the data to the chart to make sure I am not doing something wrong there either.
<mx:PieChart id="pieChart">
<mx:PieSeries nameField="year"
field="count"
labelPosition="callout"
displayName="Total"
dataProvider="{graphData}"/>
</mx:PieChart>
© Stack Overflow or respective owner