Carbon emissions around the world (2022)
by oysteinmoseng
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/modules/non-cartesian-zoom.js"></script>
<script src="https://code.highcharts.com/modules/mouse-wheel-zoom.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
This chart shows how packed bubble charts can be grouped by series,
creating a hierarchy.
</p>
</figure>
CSS
* {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
sans-serif;
}
.highcharts-figure {
min-width: 320px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-description {
margin: 0.3rem 10px;
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'packedbubble',
height: '100%',
zooming: {
type: 'xy'
}
},
title: {
text: 'Carbon emissions around the world (2022)',
align: 'left'
},
subtitle: {
text: 'Source: <a href="https://en.wikipedia.org/wiki/List_of_countries_by_carbon_dioxide_emissions" target="_blank">Wikipedia</a>',
align: 'left'
},
tooltip: {
pointFormat: '<b>{point.name}:</b> {point.value}m CO<sub>2</sub>'
},
plotOptions: {
packedbubble: {
minSize: '20%',
maxSize: '100%',
zMin: 0,
zMax: 1000,
layoutAlgorithm: {
gravitationalConstant: 0.05,
splitSeries: true,
seriesInteraction: false,
dragBetweenSeries: true,
parentNodeLimit: true
},
dataLabels: {
enabled: true,
format: '{point.name}',
filter: {
property: 'y',
operator: '>',
value: 250
},
style: {
color: 'black',
textOutline: 'none',
fontWeight: 'normal'
}
}
}
},
series: [{
name: 'Europe',
data: [{
name: 'Germany',
value: 673.6
}, {
name: 'Croatia',
value: 17.2
},
{
name: 'Belgium',
value: 90.4
},
{
name: 'Czech Republic',
value: 111.5
},
{
name: 'Netherlands',
value: 134.7
},
{
name: 'Spain',
value: 254.4
},
{
name: 'Ukraine',
value:...