• Open in:

Mekko chart

Mekko or Marimekko chart is a variation of stacked column chart with a varied column width.

Demo source

<!-- Styles -->
<style>
#chartdiv {
	width		: 100%;
	height		: 500px;
	font-size	: 11px;
}		
</style>

<!-- Resources -->
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />

<!-- Chart code -->
<script>
var chart = AmCharts.makeChart("chartdiv", {
    "theme": "none",
    "type": "serial",
    "dataProvider": [{
        "continent": "North America",
        "trucks": 40000,
        "SUVs": 180000,
        "cars": 90000,
        "total": 310000
    }, {
        "continent": "Asia",
        "trucks": 90000,
        "SUVs": 40000,
        "cars": 110000,
        "total": 240000
    }, {
        "continent": "Europe",
        "trucks": 30000,
        "SUVs": 50000,
        "cars": 110000,
        "total": 190000
    }],


    "categoryField": "continent",

    "categoryAxis": {
        "gridAlpha": 0.1,
        "axisAlpha": 0,
        "widthField": "total",
        "gridPosition": "start"
    },

    "valueAxes": [{
        "stackType": "100% stacked",
        "gridAlpha": 0.1,
        "unit": "%",
        "axisAlpha": 0
    }],

    "graphs": [
        {
            "title": "Trucks",
            "labelText": "[[value]]",
            "valueField": "trucks",
            "type": "column",
            "fillAlphas": 1
        }, {
            "title": "SUVs",
            "labelText": "[[value]]",
            "valueField": "SUVs",
            "type": "column",
            "fillAlphas": 1
        },

        {
            "title": "Cars",
            "labelText": "[[value]]",
            "valueField": "cars",
            "type": "column",
            "fillAlphas": 1
        }
    ],

    "legend": {},
    "export":
     {
     "enabled":true
     }
});
</script>

<!-- HTML -->
<div id="chartdiv"></div>