FusionCharts - Stacked Column 2D Chart in JavaScript

Created using FusionCharts Suite XT - www.fusioncharts.com

by Moonmi Sonowal

HTML

<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- Showing the Cumulative Sum of stacked data in Stacked Column Chart. This sample is showing product category wise revenue for current year using Stacked Column 2D Chart. 

# showSum - Set to 1
-->

<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function() {
    var revenueChart = new FusionCharts({
        type: 'stackedcolumn2d',
        renderAt: 'chart-container',
        width: '500',
        height: '300',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "theme": "fint",
                "caption": "Revenue split by product category",
                "subCaption": "For current year",
                "xAxisname": "Quarter",
                "yAxisName": "Revenues (In USD)",
                //Showing the Cumulative Sum of stacked data
                "showSum": "1",
                "numberPrefix": "$",
                "maxLabelHeight":"20"
            },
            "categories": [
                {
                    "category": [
                        {"label": "Q1LongLabelLongLabelLongLabelLongLabelLongLabelLongLabelLongLabelLongLabelLongLabelLongLabel"},
                        {"label": "Q2LongLabelLongLabelLongLabelLongLabelLongLabel"},
                        {"label": "Q3"},
                        {"label": "Q4"}
                    ]
                }
            ],
            "dataset": [
                {
                    "seriesname": "Food Products",
                    "data": [
                        {"value": "11000"},
                        {"value": "15000"},
                        {"value": "13500"},
                        {"value": "15000"}
                    ]
                }, 
                {
                    "seriesname": "Non-Food Products",
                    "data": [
                        {"value": "11400"},
                        {"value": "14800"},
                        {"value": "8300"},
                        {"value": "11800"}
                    ]
                }
            ]
        }
    }).render();
});