cy163 Report post Posted June 17, 2011 Hi ALL, I am using FusionChart with Visual C++ to illustrate statistical reuslts(Column chart, Pie chart, etc.,). The statistical results are generated in VC side and then are passed into a FLEX swf file, which is created based on FusionChart by using FLEX Builder 3 SDK. Essentially, the system follows data driven mechanism. Data generated in VC box drives the renderring of charts in the flex flash side. The FLEX flash *.swf file is generated in the FLEX Builder 3 SDK. The following mxml file is a main file contained in the corresponding FLEX project. Attachments are VC side source code(testFlash_VC3.rar, generating statistical result and pass the result to flash) and FLEX source code(FusionChartBasedFlex.zip, generating flash file) <!-- events/TrapAllKeys.mxml --> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="com.fusioncharts.components.*" creationComplete="initApp();"> <ns1:FusionCharts x="0" y="0" width="652" height="659" id="FC1"/> <!--FCDataXML="{xmlData}" FCDataURL="Data6.xml" FCChartType="Pie3D" --> <mx:Script><![CDATA[ import com.dynamicflash.util.Base64; import com.fusioncharts.components.FCChartData; import mx.events.FlexEvent; import mx.binding.utils.ChangeWatcher; import mx.controls.Alert; import mx.events.CloseEvent; import flash.events.Event; import flash.external.ExternalInterface; import com.events.FCEvent; import flash.external.*; var xmlDataSourceName : XML; //callCPPlus to trigger ExternalInterface event OnFlashCallShockwaveflash4001 on VC side will response public function callCPPlus() : XML { var str : String = ""; if (ExternalInterface.available) { str = ExternalInterface.call("returnToFlex", "dummyinfo"); } else { Alert.show("fail","Alarm"); } var myXML:XML = new XML(str);//把str中的内容传给myXML return myXML; } private function initApp():void { xmlDataSourceName : XML; xmlDataSourceName = callCPPlus(); Security.allowDomain("*"); if(xmlDataSourceName.ChartData.length() > 0) { var decoded:String = Base64.decode(xmlDataSourceName.ChartData[0]);//xmlDataSourceName.ChartData[0] } Alert.show("Base64=!" + decoded); FC1.FCDataXML = decoded;// //FC1.FCDataXML = "<chart caption='ABC Bank Branches' subCaption='(In Asian Countries亚洲【中国香港1)' yaxislabel='Branches' xaxislabel='Country'><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/></chart>"; FC1.FCChartType = xmlDataSourceName.FlashType[0]; //FC1.FCChartType = "Column2D";//Column2D Pie3D } ]]></mx:Script> </mx:Application> NOTE: str = ExternalInterface.call("returnToFlex", "dummyinfo"); here, str receive the value sent from the VC side by using the SetReturnValue() function in the void CTestFlash_VCDlg::OnFlashCallShockwaveflash4001(LPCTSTR request) member funciton. It works fine, but not when ‘str’ is longer than a certain number of characters, (e.g. str="<chart caption='ABC Bank Branches' subCaption='(In Asian Countries亚洲【中国香港1)' yaxislabel='Branches' xaxislabel='Country'><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='Hong Kong' value='345' link=\"S-Week 4\"/><set label='New York' value='345' link=\"S-Week 4\"/></chart>" ) It works fine again if remove some <set……/> nodes (e.g. <set label='Hong Kong' value='345' link=\"S-Week 4\"/>) from the XML string. Also, it works fine if I assign the above long string to FC1.FCDataXML directly in the mxml file, (not passed from the VC side). I cannot figure out why. Please help me. The problem has stucked me for a long time. FusionChartBasedFlex.zip testFlash_VC3.zip Share this post Link to post Share on other sites
cy163 Report post Posted June 17, 2011 when I set FC1.FCDebugMode = true, I got the following message Info: Chart loaded and initialized. Initial Width: 652 Initial Height: 659 Scale Mode: noScale Debug Mode: Yes Application Message Language: EN Version: 3.1.1 Chart Type: Single Series 3D Column Chart Chart Objects: BACKGROUND CANVAS CAPTION SUBCAPTION YAXISNAME XAXISNAME DIVLINES YAXISVALUES DATALABELS DATAVALUES TRENDLINES TRENDVALUES DATAPLOT TOOLTIP VLINES VLINELABELS 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. WARNING: Could not find dataXML or dataURL parameter. Setting empty data for the chart. ERROR: No data to display. There isn't any node/element in the XML document. Please check if your dataURL is properly URL Encoded or, if XML has been correctly embedded in case of dataXML. 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. Share this post Link to post Share on other sites
cy163 Report post Posted June 18, 2011 Common Question implyes this is BUG???????? I see that another user had encounter the same problem. He discribed his problem in the following post http://forum.fusioncharts.com/topic/7384-no-data-to-display-when-number-of-records-exceeds-35-for-a-single-series-chart-in-flex/ No data to display when number of records exceeds 35 for a single series chart in flex Share this post Link to post Share on other sites