1.设置ChartNoDataToDiaplay
new FusionChart("Pie3D.swf?ChartNoDataToDiaplay=没有数据信息","chartId","600","250","1");
注意,第五个参数一定要设置为1
2.这样的提示视乎还不够友好,那么还可以用js函数,进行需要的操作
function FC_NoDataToDiaplay(DOMId){
}
其中DOMId是够着图标时候设定的ID。
参考:其实,fusionchart还有一些可以自动触发的函数,合理应用可以使自己的设计更友好更人性化。例如:
Event Name | When is it raised? | What to use it for? |
FC_Loaded(DOMId) | When the chart SWF has finished downloading in the user's browser. | To hide any loader components that you might have on your page. |
FC_Rendered(DOMId) | When the chart has finished rendering. This call is made only once per loaded chart SWF (even if new data is supplied to it via setDataURL or setDataXML method). | To invoke any further JavaScript methods on chart, or to change the data of chart. |
FC_DataLoaded(DOMId) | When the data of the chart has finished loading - both in dataXML or dataURL method. | To further process data in any other components in your page. |
FC_DataLoadError(DOMId) | When there was an error in loading data from the specified URL | To show an error message to user, or to take a corrective measure |
FC_NoDataToDisplay(DOMId) | When the XML data loaded by chart didn't contain any data to display | To show an error message to user, or to take a corrective measure |
FC_DataXMLInvalid(DOMId) | When the XML data loaded by chart was invalid (wrong XML structure) | To show an error message to user, or to take a corrective measure |
How to track these events? |
The events raised by FusionCharts are simple JavaScript functions that are invoked, and the DOMId of the invoking chart is passed to the function to help you identify the source. For example, the FC_Rendered event for a chart can be tracked using following code: |
<HTML> <HEAD> <TITLE>FusionCharts & JavaScript - Basic Example</TITLE> <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> //FC_Rendered method is called whenever a FusionCharts chart on the page //has finished initial rendering. To this function, the chart passes its //own DOM Id. function FC_Rendered(DOMId){ //If it's our required chart if (DOMId=="chart1Id"){ //Simply alert window.alert("Look Ma! I am Column3D and I've finished loading and rendering."); return; } } </SCRIPT> </HEAD> <BODY> <div id="chart1div"> FusionCharts </div> <script language="JavaScript"> var chart1 = new FusionCharts("../../FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1"); chart1.setDataXML("<chart><set label='A' value='10' /><set label='B' value='11' /></chart>"); chart1.render("chart1div"); </script> </BODY> </HTML> |