views:

20

answers:

1

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>
A: 

The issue was resolved by changing the backend and using multiple HTTPServices allowing for unique result handlers. Whether or not this is the best way I find to be irrelevant--my reporting program is so small that it will be near impossible to see a diminish in performance. HTTPService returns an object by default and you manipulate the object using dot operators to drill down in the XML. If you are having a similar issue send me a message and I will explain it in more detail.

Eric Reynolds