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 FusionCharts XT 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 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.

I have upgraded to FusionCharts XT and now my existing JavaScript charts of PowerCharts XT and FusionWidgets XT pack are not working!

Starting FusionCharts XT, the JavaScript files which handle JavaScript chart rendering for each of our products (FusionCharts XT, PowerCharts XT, FusionWidgets XT) are segregated. FusionCharts.HC.Charts.js handlers rendering of all FusionCharts XT JavaScript charts. FusionCharts.HC.PowerCharts.js handlers rendering of all PowerCharts XT JavaScript charts. FusionCharts.HC.Charts.js handlers rendering of all FusionCharts XT JavaScript charts. FusionCharts.HC.Widgets.js handlers rendering of FusionWidgets XT JavaScript charts.

FusionCharts.HC.PowerCharts.js is updated in the PowerCharts XT pack. You need to download or update to the latest PowerCharts XT pack, copy and use FusionCharts.HC.PowerCharts.js from the Charts folder of the downloaded PowerCharts XT pack.

FusionCharts.HC.Widgets.js is updated in the FusionWidgets XT pack. You need to download or update to the latest FusionWidgets XT pack, copy and use FusionCharts.HC.Widgets.js from the Charts folder of the downloaded FusionWidgets XT pack.

How to enable JavaScript Debug mode?

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

FusionCharts.debugMode.enabled(true);

Also, you will 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 XT and 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 will need to check whether the file 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 Column3D.swf, you cannot use column3d.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 or 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 XT will load here!</div>
<script type="text/javascript">
    var chart = new FusionCharts("Column2D.swf", "ChartId", "100%", "100%", "0", "1"); 
    chart.setXMLUrl("Data.xml");    
    chart.render("chartdiv");         
</script>
 
The chart can not load JSON from URL although the path to the JSON file is correct.

Many web servers like IIS6, does not serve .json (no wildcard MIME type) files by default. You will need to setup your web server to serve 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 will 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 the web page or 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 will 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 or extra quotes (") mentioned in the XML of the chart. Although, the Flash chart ignores duplicate attributes, the JavaScript chart does 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 will 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 website 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 does 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 Data URL method (setXMLUrl, setJSONUrl, setDataURL 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.

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 to disable only the "Save as PDF" option, you can define exportFormats="JPG|PNG" in <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 is containing UTF-8 encoded strings. Also, please note that specifying the encoding setting that is, <?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 FusionCharts XT supports only left-to-right languages, as of now. It does not have native support for right-to-left languages like Hebrew. So, if you want to use Hebrew with FusionCharts XT, you will have to programmatically reverse the sequence of words or characters and then provide the same to FusionCharts XT.

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 FusionCharts XT does not support mailing of charts directly, as of now. But it allows exporting to image and saving on server. So, you can write your own script to automatically e-mail 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 FusionCharts 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.

Why can't I show set alternate grid color in the Bar 2D chart when the same XML works for Column 2D chart?

Please note that the Bar 2D chart is a horizontal rendering of the Column 2D chart. The alternate grid color in case of Column 2D is referred to the Horizontal bands, whereas in case of Bar 2D, the bands are located vertically. Hence the attribute for achieving the same in Bar 2D is setting showAlternateVGridColor to 1 in the <chart> element.

Chart is rendering values beyond the maximum limit which I have set using yAxisMaxValue attribute. Why is the max limit is not working?

Please note that in case there is any data-value in the XML that is larger than the explicitly set yAXisMaxValue, FusionCharts XT automatically adjusts the y-axis scale in order to fit and show all the data values in the chart canvas, ignoring the mentioned limit.

I am unable to find a single setting which can apply a single color to all the columns of a chart. Please help.

Please try setting a single color or the desired color (e.g. - "FF0000" for Red color) to the paletteColors attribute in the <chart> element, in order to apply the same color to all the dataplots of the chart.

I want to show only the points/anchors of a line chart and hide all the lines? I have tried with alpha='0'. No result.

Please try setting the attribute lineAlpha='0.1' (a near zero value but not zero) in the <chart> or the <dataset> element of the chart data. This will draw near-invisible lines, but the anchors will be displayed properly.

How to display legends on a Pie chart (both flash and JavaScript)?

Please try setting the attribute showLegend to 1 in the <chart> element to display the legends on a Pie chart.

I have 4 charts with same width. The chart is rendering different width of the canvas boxes. I want to fix the width of the canvas boxes for all the charts. Please help.

Please try explicitly setting common maximum values of canvasLeftMargin, canvasRightMargin, canvasTopMargin and canvasBottomMargin attributes in the <chart> element.

I am using Bar 2D chart and have very long labels which is taking up more space on the chart. How can I give more space to the chart canvas?

You can configure the chart to limit the space allotment of the labels of a Bar chart using the attribute maxLabelWidthPercent in the <chart> element. This attribute takes value in percentage. It sets the maximum width of data labels in terms of percentage of the total chart's width. This determines the maximum horizontal space which the data labels can occupy. If a data label is longer than the specified percentage width then it will either be wrapped or get truncated, subject to availability of vertical space.

Unnecessary space is not reserved for the data labels. Hence, in case, the labels are shorter than the specified maximum width, this setting is ignored.