Drag Column Chart - Getting data in JSON format

Created using FusionCharts Suite XT - www.fusioncharts.com

by FusionCharts

HTML

<script src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<!-- Drag-able chart - Getting data in JSON format. This example enables retrieval of chart data in JSON format. Click the button below the chart to display the JSON data.

method:
    # getJSONData
    
-->
<div id="chart-container">FusionCharts will render here</div>

CSS

body {
  font-family: "Arial", "Verdana", "sans";
  font-size: 80%;
}

body>div {
  /*only one in this sample */
  width: 600px;
}

table {
  margin: 25px auto;
  border-collapse: collapse;
  border: 1px solid;
  border-bottom: 2px solid #6baa01;
}

th {
  background-color: #008ee4;
  color: #ffffff;
}

th,
td {
  border: 1px solid #6baa01;
  padding: 10px 5px;
  min-width: 70px;
  text-align: center;
}

tr:nth-child(1)>td:nth-child(1) {
  border-color: #fff;
}

tr:nth-child(2)>td {
  color: #6baa01;
}

tr:nth-child(2)>td:nth-child(1) {
  background-color: #6baa01;
  color: #fff;
}

#tableCont {
  width: 100%;
}

JavaScript

FusionCharts.ready(function() {
  var inventoryChart = new FusionCharts({
    type: 'dragcolumn2d',
    renderAt: 'chart-container',
    width: '500',
    height: '350',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "caption": "Inventory status - Bakersfield Central",
        "subCaption": "Top 5 Food items",
        "xAxisName": "Food Item",
        "yAxisName": "No. of Units",
        "theme": "fusion"
      },
      "categories": [{
        "category": [{
            "label": "Poultry"
          },
          {
            "label": "Rice"
          },
          {
            "label": "Peanut Butter"
          },
          {
            "label": "Salmon"
          },
          {
            "label": "Cereal"
          }
        ]
      }],
      "dataset": [{
          "seriesname": "Available Stock",
          "allowDrag": "0",
          "data": [{
              "value": "6000"
            },
            {
              "value": "9500"
            },
            {
              "value": "11900"
            },
            {
              "value": "8000"
            },
            {
              "value": "9700"
            }
          ]
        },
        {
          "seriesname": "Estimated Demand",
          "dashed": "1",
          "data": [{
              "value": "19000"
            },
            {
              "value": "16500"
            },
            {
              "value": "14300"
            },
            {
              "value": "10000"
            },
            {
              "value": "9800"
            }
          ]
        }
      ]
    },
    events: {
      'beforeRender': function(evt, args) {
        // creating div for controllers
        var controllers = document.createElement('div');

        // Create radio buttons inside div
        controllers.innerHTML = '<input type="button" value="Get Data" id="getdata_btn" style="margin-left:5px;padding-botom:15px;"/><div id="tableView" style="padding-top: 13px;"></div>';
...