<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 the event parameters, and their values, when dataLoadRequestCancelled event is triggered-->
<div id="indicatorDiv">Event name: <b> dataLoadRequestCancelled </b>
<br>
<br>Triggered when the default behavior of the dataLoadRequested event is cancelled by calling the eventObj.preventDefault() method.</br>
<br>All events, when triggered, will provide two parameters for the handler - eventObj (object containing information generic to all events) and dataObj (object containing information specific to an event)</br>
<br>Scroll down to the table rendered below the chart to view information contained in the dataObj object. To view information contained in the eventObj object, open the console.</br>
</br>
</div>
<div id="chart-container">FusionCharts will render here</div>
<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(eventObj, dataObj) {
// Cancel the dataLoad. This will trigger the dataLoadRequestCancelled event.
eventObj.preventDefault();
},
/**
* @description
* Triggered when the default behavior of the dataLoadRequested event is cancelled by calling the eventObj.preventDefault() method.
*
* @param {Object} eventObj: An object containing all the details related to this event like eventId, sender (the chart object itself), etc.
* @param {Object} dataObj: An object containing all the details related to the data being loaded like data format, url, etc.
*/
dataLoadRequestCancelled: function (eventObj, dataObj) {
console.log(eventObj);
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 dataObj) {
titleDiv = document.createElement('div');
titleDiv.className = 'title';
titleDiv.innerHTML = prop;
valueDiv = document.createElement('div');
valueDiv.className = 'value';
valueDiv.innerHTML = dataObj[prop];
tempDiv.appendChild(titleDiv);
...
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.