<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<!-- This sample shows the event parameters, and their values, when dataUpdateCancelled event is triggered-->
<div id="indicatorDiv">Event name: <b> dataUpdateCancelled </b>
<br>
<br>Triggered when the default behavior of the beforeDataUpdate 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>Click the <b> Update Chart Data </b> button to trigger the dataUpdateCancelled 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>
<button id="update-chart">Update Chart Data</button>
<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 chartConfiguration = {
"caption": "Sales of Liquor",
"subCaption": "Last week",
"xAxisName": "Day",
"yAxisName": "Sales (In USD)",
"numberPrefix": "$",
"paletteColors": "#0075c2",
"bgColor": "#ffffff",
"showBorder": "0",
"showCanvasBorder": "0",
"plotBorderAlpha": "10",
"usePlotGradientColor": "0",
"plotFillAlpha": "50",
"showXAxisLine": "1",
"axisLineAlpha": "25",
"divLineAlpha": "10",
"showValues": "1",
"showAlternateHGridColor": "0",
"captionFontSize": "14",
"subcaptionFontSize": "14",
"subcaptionFontBold": "0",
"toolTipColor": "#ffffff",
"toolTipBorderThickness": "0",
"toolTipBgColor": "#000000",
"toolTipBgAlpha": "80",
"toolTipBorderRadius": "2",
"toolTipPadding": "5"
};
var updateBtn = document.getElementById('update-chart');
// Event Listener for the update-chart button. Updating the chart with another random set of data. In real life use cases, this could be a different set of data like data for current week..etc
updateBtn.addEventListener('click', function (e) {
this.disabled = true;
// Try to update the chart without giving the actual data. This will be caught in the beforeDataUpdate event
salesChart.setJSONData({
chart: chartConfiguration
});
});
var salesChart = new FusionCharts({
type: 'area2d',
renderAt: 'chart-container',
width: '400',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": chartConfiguration,
"data": [{
"label": "Mon",
"value": "4123"
}, {
"label": "Tue",
...
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.