2 Replies Latest reply on Aug 5, 2009 10:12 PM by Fis Forums

    Using Fusion chart to get 3D effects

    Fis Forums

      Hi,

           I have included fusionchart swc lib to generate 3dcharts in Flex...

      I have generated chart by creating a xml and storing it in an external source and fetching datas from that xml to Chart.i have done this using java to create xml and store it in Source.

       

      What i need is to send those xml as String and i have send those generated xml as string using .toString() from java to Flex.

      im getting the alert as object. and i need to pass those objects/Strings to Fusionchart

       

      i have tried it with by giving dataprovider as[dataProvider="{dimension.lastResult.chart.set}" ]

      here is my code :

       

      Flex code:

      <mx:Panel y="98" x="231" width="522" height="359" backgroundColor="black">
         <mx:Canvas id="chart_can" width="502" height="310"  backgroundColor="black">
                <ns1:FusionCharts id="FC1" x="0" y="0" FCChartType="Pie3D" width="418" height="268" FCDebugMode="true" dataProvider="{dimension.lastResult.chart.set}" >
         </ns1:FusionCharts>      

              </mx:Canvas>        
      </mx:Panel>

        My xml at Java side :

       

      <chart caption='3D Chart'> <set label='787 ' value ='4'/>
      <set label='Chicago' value ='3'/>
      <set label='Houston' value ='2'/>
      <set label='New York' value ='11'/>
      </chart>

       

       

      Please help me to send this xml values to fusion chart and generate charts

       

      Gopinath.A
      Software Developer,
      First Internet Systems Pvt. Ltd.,
      Chennai,
      Tamilnadu.

        • 1. Re: Using Fusion chart to get 3D effects
          Gregory Lafrance Level 6

          Please confirm that the problem you are facing is that you can't get the data in properly, and thus it is not available as the dataProvider.

           

          If that is the case, please post a complete subset of your data, and sample code of how you are getting the data (HTTPService ???).

           

          Then we will be able to help faster. It is generally better to use a result handler than to use lastResult.

           

          If this post answers your question or helps, please mark it as such.

          • 2. Re: Using Fusion chart to get 3D effects
            Fis Forums Level 1

            Hi,

             

            Thanks for reply,

             

            I have attached my entire code and my errors that i face when i run my application help me to get my charts displays using the xml i framed in java and returning it to flex fusionchart dataprovider/FCdataXml/FCData

            Here's the mxml code:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
                      xmlns:ns1="com.fusioncharts.components.*" initialize="getDimensiondata();">
                     
            <mx:HTTPService id="dimension" showBusyCursor="true" useProxy="false" url="../FlexAction.do?method=DimensiondChart" method="POST" result="Chartresult(event);">
            </mx:HTTPService>         
                    
                <mx:Script>
                  <![CDATA[
                      import com.fusioncharts.components.FCChartData;
                      import mx.collections.XMLListCollection;
                   //import com.events.FCEvent;
                    import mx.collections.ArrayCollection;
                    import mx.controls.Alert;
                    import mx.utils.ObjectUtil;
                    import mx.rpc.remoting.RemoteObject;
                    import mx.rpc.events.ResultEvent;
                    import mx.rpc.events.FaultEvent;       
                    public var xmldata:XML = new XML();

                    public var lStr:String ="";
                   
                     private function getDimensiondata():void {   
                                 var parameters:Object = {FlexActionType:"DimensiondChart"};                    
                                 dimension.send(parameters);   
                        }  
                        private function Chartresult(event:ResultEvent):void{
                            //Alert.show("result........"+ObjectUtil.toString(event.result));
                            //Alert.show(event.result.toString());"               
                            lStr  =dimension.lastResult.Chart.set
                            Alert.show("dataprovider.aaa....."+lStr);  
                         }

              ]]>

               </mx:Script>
                
               <mx:Panel y="0" x="407" width="522" height="359" backgroundColor="black" themeColor="black">
                <mx:Canvas id="chart_can" width="474" height="296"  backgroundColor="black">
                             <ns1:FusionCharts id="FC1" x="0" y="0" FCChartType="Pie3D" width="418" height="268" FCDebugMode="true" dataProvider="{dimension.lastResult.chart.set}" >                           
                              </ns1:FusionCharts>      
                    </mx:Canvas>      

            </mx:Panel>            
            </mx:Application>

            ------------------------------------------

            Here's my xml framed at Java side

            <chart caption='3dChart' >
                <set label="chennai" value="235"/>
                <set label="Delhi" value="123"/>
                <set label="Calcutta" value="129" />
                <set label="Mumbai" value="121"/>
                <set label="Hydreabad" value="110"/>
                <set label="Bangalore" value="90"/>
            </chart>

             

            The highlighted part of my code i get confused..

             

            i.e. in http service we can pass our result from java as  "dimension.lastresult.chart.set" in normal charts dataprovider,need to know how about in Fusion charts.  here we use FCDataXML and FCDataURL in FusionCharts charts and   FCData="{}" in FCChartData i  need to pass from xml to this properties to draw my chart

             

            And one more thing when i send use FCData in FCChartData im getting my xml as null to my charts,but my xml is framed at java side and return as String to Flex resulthandler,

             

            But when i run my application i get the debug error on screen as

             

            INFO: Chart registered with external script. However, the DOM Id of chart has not been defined. You need to define it if you want to interact with the chart using external scripting.
            INFO: XML Data provided using dataXML method.
            XML Data: <chart />
            No Data to Display: No data was found in the XML data document provided. Possible cases can be:
            There isn't any data generated by your system. If your system generates data based on parameters passed to it using dataURL, please make sure dataURL is URL Encoded.
            You might be using a Single Series Chart .swf file instead of Multi-series .swf file and providing multi-series data or vice-versa.

             

             

            Gopinath.A
            Software Developer,
            First Internet Systems Pvt. Ltd.,
            Chennai,
            Tamilnadu.