Slice piechart slice on button click

Created using FusionCharts Suite XT - www.fusioncharts.com

by Nabajeet Sonowal

HTML

<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>
<div id="chart-container">FusionCharts will render here</div>
<div id="tableCont">
     <h3>Click on the pie slices to highlight the index of the slice.</h3>
    <input type="button" value="1" id="button-getChartData" />
    
</div>

JavaScript

FusionCharts.ready(function () {
    var revenueChart = new FusionCharts({
        id:'mychart',
        type: 'pie2d',
        renderAt: 'chart-container',
        width: '450',
        height: '300',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "caption": "Split of revenue by product categories",
                "subCaption": "Last year",
                "numberPrefix": "$",                
                "theme": "fint"
            },
            "data": [{
                "label": "Food",
                "value": "285040"
            }, {
                "label": "Apparels",
                "value": "146330"
            }, {
                "label": "Electronics",
                "value": "105070"
            }, {
                "label": "Household",
                "value": "49100"
            }]
        }
    }).render();
     document.getElementById('button-getChartData').onclick = function () {
        var revenueChart = FusionCharts('mychart');
          
        revenueChart.slicePlotItem("1");
     };

});