1) I am attempting to draw a bar chart using a RemoteObject.
2) My RemoteObject is a Java class that returns a List of simple POJO
instances.The class has 2 fields xValue & yValue.
3) The RemoteObject's method invocation returns a List of these POJO
instances.
4) I am using following MXML to render the tag.I could see the data in
the DataGrid placed above barchart.
But, Barchart is just empty ...!!! Can anybody help me ?

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
applicationComplete="init(event)">

    <mx:DataGrid id="dataGrid" dataProvider="{graphDataProvider}"
width="30%" height="30%"/>

    <mx:RemoteObject id="dataSource" destination="flexRequestHandler"
result="graphResultHandler(event)" fault="faultHandler(event)"/>

      <mx:Panel title="Column Chart">
         <mx:BarChart id="myChart"  showDataTips="true"
dataProvider="{graphDataProvider}">
            <mx:verticalAxis>
               <mx:CategoryAxis dataProvider="{graphDataProvider}"
id="horizAxis" categoryField="xValue" />
            </mx:verticalAxis>

            <mx:series>
               <mx:BarSeries id="chartSeries" xField="xValue"
yField="yValue" displayName="Data" />
            </mx:series>
         </mx:BarChart>
         <mx:Legend dataProvider="{myChart}"/>
      </mx:Panel>

  <mx:Script>
    <![CDATA[

       import mx.rpc.events.FaultEvent;
       import mx.rpc.events.ResultEvent;
       import mx.controls.Alert;
       import mx.utils.ObjectUtil;
       import mx.collections.ArrayCollection;
       import mx.charts.events.ChartItemEvent;
       import mx.rpc.http.HTTPService;

    private var helloResult:String;
    [Bindable] private var graphDataProvider:ArrayCollection;

    private function resultHandler(event:ResultEvent):void{
        var result:Object = event.result;
        trace(result);
        dataGrid.dataProvider = event.result as ArrayCollection;
    }

    private function graphResultHandler(event:ResultEvent):void
{
        var result:Object = event.result;
        trace(result);
        dataGrid.dataProvider = event.result as ArrayCollection;
        graphDataProvider = event.result as ArrayCollection;
    }

    private function faultHandler(event:FaultEvent):void{
        Alert.show(ObjectUtil.toString(event.fault.faultString),
"Error");
    }

    private function init(event:Event):void{
        dataSource.getGraphData();
    }


  ]]></mx:Script>
</mx:Application>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to