JSFiddle - React, Tailwind, and code Playground

Fiddle to showcase the batchExport API method

by Venkatesan S

HTML

<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.zune.js"></script>
<center>
  <button id="export_charts" onclick='exportCharts();'>
    Export Charts
  </button>
</center>
<br>
<div id="chart-container1">FusionCharts will render here</div>
<div id="chart-container2">FusionCharts will render here</div>
<div id="chart-container3">FusionCharts will render here</div>
<div id="chart-container4">FusionCharts will render here</div>

CSS

#indicatorDiv {
  width: 500px;
  font-family: 'Arial', 'Helvetica';
  font-size: 13px;
}

#export_charts {
  display: inline-block;
  height: 25px;
  font-size: 13px;
  margin-left: -85%;
  margin-top: 1%;
  cursor: pointer;
}

#indicatorDiv {
  width: 500px;
  font-family: 'Arial', 'Helvetica';
  font-size: 13px;
}

JavaScript

exportCharts = function() {
  var arr = ['chart-1','chart-4','chart-3','chart-2'];

 for(var index = 0 ; index < arr.length ; index++){
    if(FusionCharts(arr[index])){
    console.log(arr[index]);	FusionCharts.items[arr[index]].exportChart({"exportFormat": "png"});
    }
 }
}
FusionCharts.ready(function() {
  var revenueChart = new FusionCharts({
    id: 'chart-1',
    type: 'column2d',
    renderAt: 'chart-container1',
    width: '450',
    height: '300',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "caption": "Sales report of Apple products",
        "subcaption": "2015",
        "chartTopMargin": "5",
        "subCaptionFontBold": "1",
        "rotatevalues": "0",
        "numberprefix": "$",
        "numbersuffix": "B",
        "yAxisMaxValue": "250",
        "plotToolText": "<div>Revenue : <b>$datavalue</b></div>",
        "theme": "zune",
        "exportEnabled": "1"
      },
      "data": [{
        "label": "iPhone",
        "value": "231.22"
      }, {
        "label": "iPad",
        "value": "54.85"
      }, {
        "label": "iPod",
        "value": "20.38"
      }]
    }
  }).render();
  var revenueChart = new FusionCharts({
    id: 'chart-2',
    type: 'column2d',
    renderAt: 'chart-container2',
    width: '450',
    height: '300',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "subcaption": "2014",
        "chartTopMargin": "2",
        "subCaptionFontBold": "1",
        "rotatevalues": "0",
        "numberprefix": "$",
        "numbersuffix": "B",
        "yAxisMaxValue": "250",
        "plotToolText": "<div>Revenue : <b>$datavalue</b></div>",
        "theme": "zune",
        "exportEnabled": "1"
      },
      "data": [{
        "label": "iPhone",
        "value": "169.22"
      }, {
        "label": "iPad",
        "value": "67.99"
      }, {
        "label": "iPod",
        "value": "26.38"
      }]
    }
  }).render();
  var revenueChart3D = new FusionCharts({
    id: 'chart-3',
    type:...