<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This example creates an annotation on line chart to reflect the weekend in a different block of color, and a label on top of it. Basic Structure for adding annotations to JSON: annotations: { attribute: value // Applicable to all annotations groups and items groups: [ { items: [ { attribute: value // applicable to the speciific annotation } ] } ] } -->
<div id="chart-container">FusionCharts will render here</div>
JavaScript
FusionCharts.ready(function () {
var visitChart = new FusionCharts({
type: 'column2d',
renderAt: 'chart-container',
width: '400',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Total footfall in Bakersfield Central",
"subCaption": "Last week",
"xAxisName": "Day",
"yAxisName": "No. of Visitors",
"theme": "fint"
},
"annotations": {
//Refers to the original width/height of the chart, based on which the absolute dimensions/positioning of this annotation was defined. Later, if you change the chart dimensions, the annotation will auto-adjust to the new dimensions, as it recalculates its own position/dimensions by taking into considersation original width/height of chart, and current width/height
"origw": "400",
"origh": "300",
"autoscale": "1",
"groups": [{
"items": [{
//Color block for weekend
"id": "zone",
"type": "rectangle",
//Starting at 6th data label (based on index)
"x": "$xaxis.label.6.x",
//Setting y position relative to canvas
"y": "$canvasEndY",
//Ending at 7th data label (based on index)
"tox": "$xaxis.label.7.x",
//Setting y position relative to canvas
"toy": "$canvasStartY",
"color": "#6baa01",
"alpha": "20",
}, {
//Label 'Weekend' on the color block
"id": "label",
"type": "text",
"text":...
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.