1 Reply Latest reply on Mar 11, 2007 7:06 PM by mickey3

    Populate Charts from a Databsae

      I am using PHP and MySQL on the back-end. I know how to get information from the database in single rows using mysql_fetch_object. I am having a difficulty piping this into an array in Flex 2 though. Basically I don't know how to get the information from each field into the series or axes of the chart. It seems like putting the fields into an array would work best but I can't make it work.
      Would mysql_fetch_array work better for this?

      Both charts have the information stored as VARCHAR (Basically Strings) even though I need to use COUNT to measure the number of values for one of the charts. All the charts need to dynamically be updated by date, like the dashboard example in Flex 2 builder, so I have to find a way to read that in quickly as well.

      As usual any help would be appreciated

        • 1. Re: Populate Charts from a Databsae

          maybe the problem lies with your flex codes, this is how i show my data on my line chart:

          // this function gets called on httpservice callback functoin:

          private function resultHandler(event:ResultEvent):void
          revenueData = event.result.report.order;

          my xml data is something like this:

          <order id="1" total="153.23">

          then on my linechart:

          <mx:LineChart x="0" y="0" id="saleschart" width="100%" height="100%" showDataTips="true" dataProvider="{revenueData }">
          <mx:CategoryAxis categoryField="id" />
          <mx:LineSeries displayName="Total" yField="total"/>

          this should make your chart show some data now.