dbasix

Members
  • Content count

    54
  • Joined

  • Last visited

About dbasix

  • Rank
    Advanced Member
  1. Hi, If possible, could you please provide us with the entire code. Looking forward to your reply. Thanks.
  2. Embed in flash

    Hi, Include the attached 'flx' folder into your project directrory. Thanks. flx.zip
  3. Embed in flash

    Hi, In your application swf (here project.swf), load the chart swf and pass the required parameters (like, xml/url, height, width etc) as query string. Follow the attached files for help. Thanks. charts_Fl_CS3.zip
  4. Hi, Check whether you have deployed the chart .swf files properly or not. Do not test your project in debugging mode. FusionCharts for Flex depends on External Interface and it doesn't works in debug mode. Thanks.
  5. Loading chart from AS3

    Hi, You will not get appropriate result within Flash IDE. Our solution highly depends on External Interface and its not work over there. Its good to test with generated SWF or in Browser. Thanks.
  6. Loading chart from AS3

    Hi, Download the attachment and try to understand. It will give you an idea to combine FusionCharts in Flash CS3/CS4. Thanks. charts_Fl_CS3.zip
  7. Angular Gauge not visible

    Hi, Its worked here perfectly. Which version of Flex Builder are u using - 2 / 3 / 4 ? Check whether string data (_xml2) declared in 'Script' block or not ? If error persist, supply the entire .mxml. Thanks, Debasish.
  8. Hi, From current framework it is not possible. You have to position the nodes at the most effective way manually. Whereas you can ask for custom development and modification in the current chart at [email protected] Thanks.
  9. May be u are not using FlashInterface (a third party API) or AS3 specific chart swf file. You can find those special chart swf file in 'FusionCharts for Flex' on www.fusioncharts.com/flex . I have attached the FlashInterface API. Thanks. FlashInterface.zip
  10. Create a Chart Loading class and named it ChartLoader.as package { import flash.display.*; import flash.events.*; import flash.net.URLRequest; // 3rd party API for AVM1-AVM2 communication as our charts are on flas 8 AVM1 version and // Flash 9 runs on AVM2. AVM stands for Actionscript Virtual Machine. import flx.external.FlashInterface; // Main Chartloader class public class ChartLoader extends Sprite { private var loader:Loader; private var Xpos:Number,Ypos:Number; private var Id:String; // Chartloader constructor public function ChartLoader(chartURL:String,XMLurl:String,XMLdata:String,chartWidth:Number,chartHeight:Number,xpos:Number,ypos:Number) { // Initialisation of varibles with supplied data. // chartURL - path of the chart swf //XMLurl - URL of the supplied data xml file //XMLdata - Supplied xml data as string // chartwidth, chartheight - specified width and height of the chart // xpos, ypos - x and y position of chart on stage. this.Xpos=xpos; this.Ypos=ypos; // Unique ID to separate and identify each chart object. Id=this.name; // Instantiation of Loader class. loader = new Loader(); // EventListener to track the completion of chart loading process loader.contentLoaderInfo.addEventListener(Event.INIT, loaded); // URLRequest instantiation by passing swf path and params var urlRequest:URLRequest = new URLRequest(chartURL+"?flashId="+Id+"&defaultdatafile="+XMLurl+"&dataXML="+XMLdata+"&chartwidth="+chartWidth+"&chartheight="+chartHeight+"&mode=flex"); // Loading of chart in loader loader.load(urlRequest); } // This function will execute after completion of loading of each chart private function loaded (e:Event):void { trace("loaded"); // Addition of loader object with dispaly child. addChild(loader); // Positioning of chart loader.x=Xpos; loader.y=Ypos; // Dispatching of event to track down the load of charts from outside dispatchEvent(new Event("chartInitialized")); } // setDataXML function to update the chart. // Arguments needed as XML string public function setDataXML(dataxml:String):void { FlashInterface.call(Id+".setDataXML",dataxml); } // Call setDataURL function from outside to update chart. // Argument as a URL string of a specific xml file. public function setDataURL(dataurl:String):void { FlashInterface.call(Id+".setDataURL",dataurl); } // Function to call saveAsImage from outside public function saveAsImage():void { FlashInterface.call(Id+".chart.saveAsImage"); } // Function to call printChart from outside public function printChart():void { FlashInterface.call(Id+".chart.printChart"); } } } And from Flash, use it like bellow- // Import the ChartLoader class import ChartLoader; // Demo XML data for setDataXML method. var xmlData:String=""; var xmlData_2:String=""; // ChartLoader instance creation var chart1:ChartLoader=new ChartLoader("charts/Line.swf","",xmlData,400,300,0,0); // Object added to Stage stage.addChild(chart1); // ChartLoader instance creation var chart2:ChartLoader=new ChartLoader("charts/Line.swf","data/chartData.xml","",400,300,410,0); // Object added to Stage stage.addChild(chart2); // Event listener for mouse event this.addEventListener(MouseEvent.CLICK,changeData); //Button click functions and chart function invocation function changeData(e:MouseEvent):void { switch(e.target.name) { case "buttA1": chart1.setDataXML(xmlData_2); break; case "buttA2": chart1.setDataURL("data/Data_2.xml"); break; case "buttB1": chart2.setDataXML(xmlData_2); break; case "buttB2": chart2.setDataURL("data/Data_2.xml"); break; default: trace("No job specified !"); } } Thanks.
  11. Label problems in drag node chart

    Hi, We have tested your xml with the latest version and found no error. Use 'debugmode' for any other issues regarding xml etc. USE THE ATTACHED CHART. Thanks. DragNode.zip
  12. FC and Flex

    Hi, If you have the chart code, change some portion of the 'Init.as' file (location: com>fusioncharts>includes) as shown below, and recompile. //Get chart width and height var _chartWidth : Number = Number (rootAttr ["chartwidth"]); var _chartHeight : Number = Number (rootAttr ["chartheight"]); //If chart width and chart height have registered as 0, we update to Flashvars value if (_chartWidth == 0 || _chartHeight == 0) { _chartWidth = Stage.width; _chartHeight = Stage.height; } For the mxml do the following: mySWFloader.source="MSLine.swf?chartwidth=600&chartheight=400" you can also set XML data like mySWFloader.source="MSLine.swf?chartwidth=600&chartheight=400&dataURL=your_xml.xml"
  13. Configure chart size through URL

    Hi, If you have the chart code, change some portion of the 'Init.as' file (location: com>fusioncharts>includes) as shown below, and recompile. //Get chart width and height var _chartWidth : Number = Number (rootAttr ["chartwidth"]); var _chartHeight : Number = Number (rootAttr ["chartheight"]); //If chart width and chart height have registered as 0, we update to Flashvars value if (_chartWidth == 0 || _chartHeight == 0) { _chartWidth = Stage.width; _chartHeight = Stage.height; } For the mxml do the following: mySWFloader.source="MSLine.swf?chartwidth=600&chartheight=400" thx.
  14. Label problems in drag node chart

    Hi, 1. If you are using latest DragNode chart, the issue has been solved. You can use the bellow xml structure for a image node- <set x='50' y='90' width='80' height='40' name='Demo Example' alpha='0' toolText='abc-xyz' id='a1' imageNode='1' imageurl='images/pix1.gif' imageAlign='top' labelAlign='bottom' imageHeight='16' imageWidth='16'/> Here width and height stands for the outer boundary of the node. Use the imageAlign and labelAlign according your requirement. 2. labelAlign works only with Images. If you want to manipulate, ask for a custom build chart ([email protected]). 3. Please use "name" instead of "label" in set.
  15. You cannot use FusionChart v3 AS files within Flex Builder 3.0 as FusionChart v3 AS files are Actionscript 2 files and Flex Builder uses Actionscript 3 format and also there is ActionScript Virtual Machine(AVM) problem exist. FusionChart swf files runs on AVM1 whereas Flex 3 swf runs on AVM2. We can use FC in flex in two ways - using Local Connection and FlashInterface (3rd paty API for AVM1 and AVM2 commnication). 1. Using Local Connection: When you have the codes of FC, you need to add a bit of script in DataLoad scene before the chart object creation: // LocalConnection object initialization var flash_flex:LocalConnection = new LocalConnection(); // Exposing the setDataXML and setDataURL method to remote localConnection // The main setDataXML method did not modified // Calling that method through JavaScript also possible flash_flex.setDataXML=function(strXML_flex : String):Void { setDataXML(strXML_flex); } flash_flex.setDataURL=function(strURL_flex : String):Void { setDataURL(strURL_flex); } // Exposing the printChart method to remote localConnection flash_flex.printChart=function():Void { chart.printChart(); } // Exposing the saveAsImage method to remote localConnection flash_flex.saveAsImage=function():Void { chart.saveAsImage(); } // Making the connection inter-domain flash_flex.allowDomain("*"); // Unique connection name that remote localConnection can identify flash_flex.connect("Column3D_connector"); Here the MXML : <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()"> <mx:VBox id="v1" paddingTop="5" paddingLeft="5"> <mx:Panel id="p1" title="LINE CHART" width="420"> <mx:SWFLoader id="chart_1"/> </mx:Panel> <mx:Button id="b1" label="call setDataXML" click="call_1()"/> <mx:Button id="b2" label="call setDataURL" click="call_2()"/> <mx:Button id="b3" label="Print chart" click="call_3()"/> <mx:Button id="b4" label="save as Image" click="call_4()"/> </mx:VBox> <mx:Script> <![CDATA[ import flash.external.*; import mx.controls.Alert; import flash.net.LocalConnection; // Local connection object declaration // This connection used by all loaded chart swf with different connection name private var flash_flex:LocalConnection; // Demo xml string for dataXML method private var dataXML:String="<chart><set label='B' value='12' /><set label='C' value='10' /><set label='D' value='18' /><set label='E' value='21' /></chart>"; private var dataURL:String="Data_2.xml"; // Initialization of connection object and chart loading private function initApp():void { flash_flex = new LocalConnection(); chart_1.source="Line.swf?chartWidth=400&chartHeight=300&registerWithJS=1"; } // Functions for setDataXML method invokation of loaded chart swf // Parameter 1 for uniqe connection name of loaded chart swf // Parameter 2 for the method name you are trying to invoke // Parameter 3 stands for any parameter value for invoking method private function call_1():void { flash_flex.send( "Column3D_connector", "setDataXML", dataXML); b1.enabled=false; } private function call_2():void { flash_flex.send( "Column3D_connector", "setDataURL", dataURL); b2.enabled=false; } private function call_3():void { flash_flex.send( "Column3D_connector", "printChart"); b3.enabled=false; } private function call_4():void { flash_flex.send( "Column3D_connector", "saveAsImage"); b4.enabled=false; } ]]> </mx:Script> </mx:Application> You can use multiple charts but remember to give them different connection name in chart file to idenify separately. Like, // Unique connection name that remote localConnection can identify flash_flex.connect("Column3D_connector"); or, flash_flex.connect("Pie3D_conn"); etc. 2. Using FlashInterface: Make a AS class file named chartLoader.as and put it on the same folder where main mxml file exist with FlashInterface API(here folder 'flx'). The content of the file is below, package { import flash.display.*; import flash.events.*; import flash.net.URLRequest; import flx.external.FlashInterface; public class ChartLoader extends Sprite { private var loader:Loader; private var chartWidth:Number,chartHeight:Number,Xpos:Number,Ypos:Number; private var Id:String; public function ChartLoader(url:String,chartwidth:Number,chartheight:Number,xpos:Number,ypos:Number) { Xpos=xpos; Ypos=ypos; chartWidth=chartwidth; chartHeight=chartheight; Id=this.name; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded); var urlRequest:URLRequest = new URLRequest(url+"?flashId="+Id+"&chartWidth="+chartWidth+"&chartHeight="+chartHeight); loader.load(urlRequest); } private function loaded (e:Event):void { trace("loaded"); addChild(loader); loader.x=Xpos; loader.y=Ypos; dispatchEvent(new Event("chartLoaded")); } public function setDataXML(dataxml:String):void { FlashInterface.call(Id+".setDataXML",dataxml); } public function setDataURL(dataurl:String):void { FlashInterface.call(Id+".setDataURL",dataurl); } public function saveAsImage():void { FlashInterface.call(Id+".chart.saveAsImage"); } public function printChart():void { FlashInterface.call(Id+".chart.printChart"); } } } In FusionChart, you need to add a bit of script in DataLoad scene before the chart object creation. Place the FlashInterface API folder(here 'flx_2') where FC as files resides. // 3rd party API for Flash 8 swf (AVM1) and // Flash 9 or Flex 2/3 swf (AVM2) communication import flx_2.external.FlashInterface; // Allowing this flash 8 swf to communicate with Flash 9 swf // or Flex 2/3 swf FlashInterface.publish(this, true); and here is the mxml file, <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()"> <mx:HBox x="10"> <mx:Button id="A1" label="setDataURL"/> <mx:Button id="A2" label="setDataXML"/> <mx:Button id="A3" label="saveAsImage"/> <mx:Button id="A4" label="printChart"/> </mx:HBox> <mx:Script> <![CDATA[ import ChartLoader; import mx.core.UIComponent; import mx.controls.Alert; import flash.display.*; private var chart1:ChartLoader; private var ui1:UIComponent; private var dataXML:String="<chart><set label='A' value='12' /><set label='B' value='10' /><set label='C' value='18' /><set label='D' value='21' /></chart>"; private function initApp():void { chart1=new ChartLoader("Line.swf",400,300,10,30); ui1=new UIComponent(); addChild(ui1); ui1.addChild(chart1); chart1.addEventListener("chartLoaded",loaded); addEventListener(MouseEvent.CLICK,func_call); } private function loaded(e:Event):void { trace(e.target.name+" loaded"); } private function func_call(e:MouseEvent):void { switch(e.target.name) { case "A1": chart1.setDataURL("Data_2.xml"); break; case "A2": chart1.setDataXML(dataXML); break; case "A3": chart1.saveAsImage(); break; case "A4": chart1.printChart(); break; } } ]]> </mx:Script> </mx:Application> You can add multiple chart by creating different chartLoader object by passing chart swf name, width, height, x and y position. --> [FlashInterface API attached]