2 Replies Latest reply on Nov 2, 2007 7:07 AM by curtkauf

    Chart from .Net Web Service

      Can anyone help me I'm pretty new to flex. I am pulling data from a C#.net web service. It is a simple chart that has four vertical bars. How do I get the data to populate the chart. ArrayCollection? if so how? I think I have tried everything and I can't get it to work. I'm sure it's me and I am making it more complicated then it really is. Any help would be appreciated. Thanks!
        • 2. Re: Chart from .Net Web Service
          curtkauf Level 1
          There is something simple I don't understand. The webservice is a simple select from a SQL database that brings back a small dataset that I convert into an array and dumb into xml. It has the following fields:


          It works fine in a data grid, but does nothing in a chart. Here is my Flex code...

          l version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          backgroundGradientColors="[#8000ff, #8000ff]">

          <mx:Style source="main.css"/>

          <mx:WebService id="wsReports"
          wsdl=" http://localhost:1602/CS_Webservice/Reports.asmx?wsdl"
          fault="Alert.show(event.fault.faultString), 'Error'">

          <!-- this operation determines if the user is valid -->
          <mx:operation name="DailyReport">


          import mx.controls.Alert;
          import mx.collections.ArrayCollection;
          import mx.utils.ArrayUtil;

          private var dailyRevenue:ArrayCollection;

          public function runService():void{

          dailyRevenue = wsReports.DailyReport.lastResult;


          <mx:ApplicationControlBar width="100%">
          <mx:DateField width="99" id="dteDate"/>
          <mx:Button label="Run" id="btnDailyRun" click="{runService()}"/>
          <mx:Label text="Label" width="116" height="20" id="lbl"/>

          <mx:DataGrid dataProvider="{wsReports.DailyReport.lastResult}" width="100%">

          <mx:DataGridColumn headerText="Product" dataField="product_offering"/>
          <mx:DataGridColumn headerText="Shipments" dataField="shipment_count"/>
          <mx:DataGridColumn headerText="Revenue" dataField="total_revenue"/>
          <mx:DataGridColumn headerText="Weight" dataField="total_weight"/>

          <mx:ColumnChart id="dailyRevChart" width="100%" height="100%" dataProvider="{dailyRevenue}">

          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="Dock Drop Distribution" />
          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="Dated Release" />
          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="Miscellaneous" />
          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="U.S. Postal Service" />
          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="Consolidation" />
          <mx:ColumnSeries xField="total_revenue" yField="total_revenue" displayName="Expedited" />

          <mx:Legend dataProvider="{dailyRevChart}" autoLayout="false" width="100%" height="30" horizontalAlign="center" direction="horizontal"/>


          Please give me any help you can. I know I'm missing something simple.