<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This sample shows how to use dataLoadError event when the data is loaded from an external URL-->
<div id="chart-container">FusionCharts will render here</div>
<div>
<div id="indicatorDiv">Event name: <b> dataLoadError </b>
<br>
<p>The dataLoadError event is raised when there is an error loading data to the chart object from the specified URL.</p>
<p>The following details can be obtained from the argObj parameter of the event when the data is loaded from the URL</p>
</br>
</div>
<div>
<div id="header">
<div class="parameter-name">Parameter Name</div>
<div class="parameter-value">Parameter Value</div>
</div>
<div id="attrs-table"></div>
</div>
</div>
FusionCharts.ready(function () {
var ageGroupChart = new FusionCharts({
type: 'pie2d',
renderAt: 'chart-container',
width: '450',
height: '250',
dataFormat: 'jsonurl',
dataSource: 'http://static.fusioncharts.com/fiddle/dummyURL.php',
"events": {
/**
* @description
* If the chart loads data from a URL instead of a static file(XML or JSON) on the system, then the dataLoadRequestCompleted event is fired after the data is loaded to the Fusion Charts class object.
*
* @param {Object} evt: An object containing all the details related to this event like eventId, sender (the chart object itself), etc.
* @param {Object} data: An object containing all the details related to the data being loaded like data format, url, actual data, etc.
*/
"dataLoadError": function (evtObj, argObj) {
var header = document.getElementById('header');
header.style.display = 'block';
var tempDiv = document.createElement('div');
var attrsTable = document.getElementById('attrs-table');
var titleDiv, valueDiv;
// Iterating through all the properties in argObj and adding it to the DOM
for (var prop in argObj) {
titleDiv = document.createElement('div');
titleDiv.className = 'title';
titleDiv.innerHTML = prop;
valueDiv = document.createElement('div');
valueDiv.className = 'value';
valueDiv.innerHTML = argObj[prop];
tempDiv.appendChild(titleDiv);
tempDiv.appendChild(valueDiv);
}
attrsTable.innerHTML = '';
attrsTable.appendChild(tempDiv);
}
}
});
ageGroupChart.render();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.