You are viewing documentation for an older version. For current documentation - click here.

In this section, we explore some of the common issues faced by users.

Why are the JavaScript charts not working when running from local file system? Same code works fine in server.

You seem to be using the Data URL method (provide data to chart from files or streams) to provide chart data. Many browsers restrict JavaScript from accessing local file system owing to security reasons. The JavaScript charts, when running locally, will not be able to access data provided as a URL. If you run the files from a server, it will run absolutely fine, as the data is then read and streamed by the server, without the need for JavaScript to directly access local file system. When running locally, however, if you provide the data as string (using the Data String method), it works fine.

How to enable JavaScript Debug mode?

To enable the JavaScript Debug Mode, you need to write the following lines of code

FusionCharts.debugMode.enabled(true);

Also, you need to specify where you will like to display the "debugMode" output. In case you want to see the error within the browser’s JavaScript console, you need to write the following lines of code:

FusionCharts.debugMode.outputTo( function() { console.log(arguments); } );

Please note that, depending upon your browser, you may need to specifically enable "JavaScript Console". For further details on the above, please refer to Debugging your charts > Using JavaScript page.

I cannot understand the error codes which are shown when my chart fails. How do I comprehend them?

For your reference, we have created a table with all the errors and description of each. Please refer to the table from FusionCharts & JavaScript > Handling errors page.

Charts are rendering fine in Windows, but when I copy the same folder to my Linux or Mac server, they stop working

You need to check whether the files names which you are referring in the code using proper cases. Please note that, in Windows file names are not case-sensitive. But, in Mac or Linux, file names are case-sensitive. Hence, if the actual file name is AngularGauge.swf, you cannot use angulargauge.swf in your code. Although, this will work in Windows, but will fail in Mac or Linux.

Charts stop rendering if I set the height in percentage

When you set percent size to a chart, it tries to get the width/height of its parent container. It seems that the container where you are rendering the chart is not set with a proper height when the chart is rendered into it.

For example, if you have a container <div id="chartContainer"> and this DIV is not set with an absolute or relative height, the DIV's height will be zero. When a chart is rendered in this DIV with 100% height, the chart will try to derive the height of the parent DIV which is zero. The chart will render zero pixel as height. Please try once setting absolute height to the chart or the constrainer element and check. An example is give below:

<div id="chartContainer" style="width:100%; height:800px;">FusionCharts will load here!</div>
<script type="text/javascript">
    var chart = new FusionCharts("Pyramid.swf", "ChartId", "100%", "100%", "0", "1"); 
    chart.setXMLUrl("Data.xml");    
    chart.render("chartdiv");         
</script>
 
The chart cannot load JSON from URL although the path to the JSON file is correct.

Many web servers like IIS6, do not serve .json (no wildcard MIME type) files by default. You need to setup your web server to server json files. In IIS6 you can do this using these steps:

  • Open the properties for the server in IIS Manager and click MIME Types Click "New"
  • Enter "JSON" for the extension and "application/json" for the MIME type
 
JavaScript links are not working although I have set the correct value e.g., link='JavaScript:alert(1234);' The links however, works when I run the code from my server

Due to Flash Player security implementation, links from charts will not work if you run the chart from local file system. To make the links work, as well make all the chart API's work, you need to configure Flash Player Global Security Settings. We have discussed more on how to configure this in the next topic.

How do I configure Flash Player Global Security Settings?

Flash Player's Global Security implementation blocks JavaScript to interact with charts (Flash charts) when you are running the web page/application with charts from local file system. To configure Flash Player Global Security Settings (to enable links and chart APIs) and enable JavaScript calls from charts, you need to add the folder containing the chart SWF files to Flash Player's Trusted Zone.

Please refer to How to Setup Flash Player Global Security Settings page for a detailed step-by-step guide.

JavaScript chart shows 'Invalid Data' even though the Flash charts work fine with the same data. Why?

Please make sure that there are no duplicate attributes, invalid XML entities or extra quotes (") mentioned in the XML of the chart. Although, the Flash charts ignore duplicate attributes, the JavaScript charts apply a strict XML validation.

In case the issue still persists please enable the "debugMode" of the chart in the HTML page and check with the XML invoked.

Charts work fine if my HTML and all SWF and JavaScript files are in the same folder. But, fails if they are segregated to separate folders.

You need to keep the points stated below:

  • If you are getting the data from another domain, this will not work, as Flash charts block cross domain data transfer
  • If you are putting the files in any folder, which is not accessible by your web-site the charts are likely to fail
  • Since you have segregated the files in separate folders, please make sure you are putting the correct relative paths of the files in your code
 
Why is the word "Chart" displayed instead of the chart?

Any of these listed reasons can cause this error to occur:

  1. You have not set correct path of FusionCharts.js in your code
  2. The page contains JavaScript error
  3. If you are setting the data as XML/JSON String, you might be including new-line characters in the XML/JSON string. New line characters in XML/JSON string cause JavaScript error.
 
Why do the JavaScript charts show "Retrieving data.." if I run them locally while the Flash charts renders fine?

JavaScript charts use AJAX to load data from the URL data sources. Some browsers do not allow AJAX data loading to function when running from local file system (using file:/// protocol). Hence, when you run the JavaScript charts from local file system and you are using the Data URL method (setXMLUrl, setJSONUrl or similar functions) to provide data to charts where physical xml or json files are involved, this error occurs.

To over-come this situation you need to render the JavaScript charts using Data String method.

Charts do not work in my Flex Applications

FusionCharts/FusionWidgets XT or lower does not work directly in Flex (AS3) based applications. To use FusionCharts in Flex (AS3) based applications, you need to use FusionCharts for Flex.

FusionCharts/FusionWidgets XT (core) had been coded in ActionScript 2 (Flash 8 - AVM1). We haven't ported them to ActionScript 3 (AVM2); instead, we have modified the existing FusionCharts/FusionWidgets XT SWF files - so that, they can load efficiently in your Flex solutions and then be controlled by your Flex code. As such, you need not bother about cross AVM issues. All that is to be done is to load the FusionCharts specialized SWF and SWC files, provide the data, and control it from your Flex project. For further details, please refer to FusionCharts for Flex Documentation.

Why does the "Waiting" button never become "Save" button while exporting my chart?

Please make sure you have done the following while exporting a chart to avoid the situation:

  • You have defined the correct client-side export handler's id in the data (XML/JSON) of the chart

    To provide cross-browser compatibility, we recommend you not to start the ID with a numerical value, nor use space as part of the ID.

  • You have passed the correct client-side export handler's ID while calling the exportChart() function
  • Flash Player 10 or above is installed in the system
  • You have Flash Player Global Security settings configured to run the samples from local file system
 
I cannot remove the 'Save as PDF' option from the right-click menu. Please help.

If you wish to remove all "Save as..." options from the right-click menu, please try setting the attribute exportShowMenuItem to 0 in the <chart> element.

If you wish disable only the "Save as PDF" option, you can define exportFormats="JPG|PNG" in the <chart> element. Using similar method, you can disable any of the other options.

I cannot display multi-lingual or accented characters in chart, although in the XML I have declared <?xml version="1.0" encoding="utf-8"?> in the XML

Please note that in order to use any multi-lingual characters on the chart, you necessarily need to use UTF-8 encoded XML/JSON. More importantly, the XML/JSON file or stream requires UTF-8 BOM stamp to be present as the very first 3 Bytes of the file. Most of the text editors like Notepad can do this automatically. To know more on how to BOM mark a file, please read Using Multi-lingual text page in Advanced Charting > Using special characters section.

Please note the two basic thumb rules:

  • For Data URL method - the XML/JSON should be having the BOM stamp
  • For Data String method - the HTML/application file containing the XML/JSON should have the BOM stamp.

BOM is Byte Order Mark. It is 'EF BB EF' - these 3 bytes in case of UTF-8 encoded files, the BOM being placed at the very beginning of the file. It is an indicator that the file contains UTF-8 encoded strings. Also, please note that specifying the encoding setting i.e., <?xml version="1.0" encoding="UTF-8"?> in the XML header region does not add the Byte Order Mark (BOM) to the XML/JSON file.

However, please note that FusionWidgets XT supports only left-to-right languages, as of now. It doesn't have native support for right-to-left languages like Hebrew. So, if you want to use Hebrew with FusionWidgets XT, you'll have to programmatically reverse the sequence of words/characters and then provide the same to FusionCharts.

When I pass multi-lingual or accented characters to JavaScript functions from link, they get broken. Do you have a fix for this?

Please try setting unescapeLinks='0' in the <chart> element in order to pass the multi-lingual or accented characters to JavaScript functions from links perfectly from a chart.

I want to generate the chart automatically at server at a given interval and keep sending email containing the latest charts. Please help.

Please note that FusionWidgets XT does not support mailing of charts directly, as of now. But since FusionWidgets XT allows exporting to image and saving on server, you can write your own script to automatically email the saved image.

Also, if you are willing to export the charts directly as images (JPG/JPEG/PNG directly) without rendering it in the browser, please note that our developers have created a .NET based server-side Image Saver Assembly that allows exporting charts as images without rendering it in the browser. Please note that this works only using .Net framework of Windows. This is an internal implementation, which is not included and/or associated with the FusionWidgets XT pack. For receiving the same, drop us a mail requesting for this assembly at support[@]fusioncharts.com.

I cannot change chart message after a chart has been rendered?

As of now, you cannot directly set a message to an already rendered chart.

However, as work-around, you can use a private JavaScript function to change the chart message after the chart has been rendered. The syntax to use this function is :

FusionCharts("chartDOMId").ref.showChartMessage("your message as string");

An example can be :

FusionCharts("myChartId").ref.showChartMessage("message");

Please note that this function will remove any existing chart from the canvas before showing the message.