<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 dataLoadCancelled 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> dataLoadCancelled </b>
<br>
<p>When the default action of dataLoadRequested event is cancelled using eventObject.preventDefault(), this event is raised. Subsequently, the associated AJAX requests are aborted.</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/getSampleJSON.php',
"events": {
"dataLoadRequested": function(evtObj, argObj) {
console.log(evtObj);
evtObj.cancelled = true;
evtObj.preventDefault();
evtObj.stopPropagation();
},
/**
* @description
* When the default action of dataLoadRequested event is cancelled using eventObject.preventDefault(), this event is raised. Subsequently, the associated AJAX requests are aborted.
*
* @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.
*/
"dataLoadCancelled": 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];
...
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.