Stacked Column Chart

Stacked bar charts are useful to demonstrate how a larger data category is comprised of smaller categories, and what part each of the smaller categories plays in the total of a larger one.

by alcosbarco

HTML

<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
<script src="https://cdn.amcharts.com/lib/4/themes/animated.js"></script>
<div id="chartdiv"></div>

CSS

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

#chartdiv {
  width: 100%;
  height: 500px;
}

JavaScript

/**
 * ---------------------------------------
 * This demo was created using amCharts 4.
 * 
 * For more information visit:
 * https://www.amcharts.com/
 * 
 * Documentation is available at:
 * https://www.amcharts.com/docs/v4/
 * ---------------------------------------
 */

// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end

// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);


// Add data

chart.data = 
 [
    {
      "25 -- AFRICA":7369751.61,
      "year":"2020",
      "51 -- REGIONES POLARES":7369751.61,
      "33 -- AMERICA":7369751.61,
      "38 -- ASIA":7369751.61,
      "45 -- EUROPA":7369751.61,
      "50 -- OCEANIA":7369751.61
    },
    {
      "25 -- AFRICA":9663439.66,
      "year":"2019",
      "51 -- REGIONES POLARES":9663439.66,
      "33 -- AMERICA":9663439.66,
      "38 -- ASIA":9663439.66,
      "45 -- EUROPA":9663439.66,
      "50 -- OCEANIA":9663439.66
    },
    {
      "25 -- AFRICA":9199598.9,
      "year":"2018",
      "51 -- REGIONES POLARES":9199598.9,
      "33 -- AMERICA":9199598.9,
      "38 -- ASIA":9199598.9,
      "45 -- EUROPA":9199598.9,
      "50 -- OCEANIA":9199598.9
    },
    {
      "25 -- AFRICA":8802143.98,
      "year":"2017",
      "51 -- REGIONES POLARES":8802143.98,
      "33 -- AMERICA":8802143.98,
      "38 -- ASIA":8802143.98,
      "45 -- EUROPA":8802143.98,
      "50 -- OCEANIA":8802143.98
    }
  ]
;

chart.data = 
[{"25 -- AFRICA":7369751.61,"year":"2020","51 -- REGIONES POLARES":0,"33 -- AMERICA":1.258356866E7,"38 -- ASIA":1.157351859E7,"45 -- EUROPA":9.043172126E7,"50 -- OCEANIA":719164.37},{"25 -- AFRICA":9663439.66,"year":"2019","51 -- REGIONES POLARES":831.75,"33 -- AMERICA":1.547590025E7,"38 -- ASIA":1.301024118E7,"45 -- EUROPA":1.061291925E8,"50 -- OCEANIA":1039099.03},{"25 -- AFRICA":9199598.9,"year":"2018","51 -- REGIONES POLARES":0,"33 -- AMERICA":1.492029072E7,"38 -- ASIA":1.282040971E7,"45 -- EUROPA":1.0577788523E8,"50 -- OCEANIA":1012765.09},{"25...