FusionCharts API-Methods: exportChart
Created using FusionCharts Suite XT - www.fusioncharts.com
HTML
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This sample shows the usage of the exportChart() method. -->
<div id="indicatorDiv">Method Name: <strong>exportChart()</strong>
<p>Exports a chart as an image or as a PDF document. Click <a href="http://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-methods.html#exportChart" target="_blank">here</a> to read more about the <strong>exportChart()</strong> method.</p>
<p>To export the chart, from the drop-down shown below, select a format to export the chart. Next, click <strong>Export Chart</strong>.</p>
<select id="format" class="mb-20">
<option value="png">png</option>
<option value="jpg">jpg</option>
<option value="pdf">pdf</option>
</select>
<button id="export">Export Chart</button>
</div>
<div id="chart-container">FusionCharts will render here</div>
CSS
body {
padding: 5px;
margin: 0 auto;
}
strong{
font-weight: bold;
}
.text-center {
text-align: center;
}
p {
margin: 10px auto;
}
.mb-20 {
margin-bottom: 20px;
}
#indicatorDiv {
width: 500px;
font-family:'Arial', 'Helvetica';
font-size: 13px;
}
#format {
height: 25px;
font-size: 12px;
}
#export {
height: 25px;
font-size: 13px;
}
JavaScript
FusionCharts.ready(function () {
var revenueChart = new FusionCharts({
type: 'mscombidy2d',
renderAt: 'chart-container',
width: '500',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Revenues and Profits",
"subCaption": "For last year",
"captionFontSize": "13",
"subCaptionFontSize": "12",
"xAxisname": "Month",
"pYAxisName": "Amount (In USD)",
"sYAxisName": "Profit %",
"numberPrefix": "$",
"sNumberSuffix": "%",
"sYAxisMaxValue": "50",
"primaryAxisOnLeft": "0",
"theme": "fint",
"exportEnabled": "1"
},
"categories": [{
"category": [{
"label": "Jan"
}, {
"label": "Feb"
}, {
"label": "Mar"
}, {
"label": "Apr"
}, {
"label": "May"
}, {
"label": "Jun"
}, {
"label": "Jul"
}, {
"label": "Aug"
}, {
"label": "Sep"
}, {
"label": "Oct"
}, {
"label": "Nov"
}, {
"label": "Dec"
}]
}],
"dataset": [{
"seriesName": "Revenues",
"data": [{
"value": "16000"
}, {
"value": "20000"
}, {
"value": "18000"
}, {
"value": "19000"
}, {
"value": "15000"
...