World population 2023
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sunburst.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/themes/adaptive.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
DEPENSES DE FONCTIONNEMENT : 8 655 498,26
</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,
.highcharts-data-table table {
min-width: 320px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid var(--highcharts-neutral-color-10, #e6e6e6);
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: var(--highcharts-neutral-color-60, #666);
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tbody tr:nth-child(even) {
background: var(--highcharts-neutral-color-3, #f7f7f7);
}
.highcharts-description {
margin: 0.3rem 10px;
}
JavaScript
const createChart = data => Highcharts.chart('container', {
chart: {
height: '100%'
},
// Let the center circle be white transparent
colors: ['#ffffff01'].concat(Highcharts.getOptions().colors),
title: {
text: 'DEPENSES DE FONCTIONNEMENT Coulounieix-Chamiers 2021'
},
subtitle: {
text: 'Source <a href="https://www.coulounieix-chamiers.fr/files/coulounieix-chamiers/ma_mairie/CA-2021.pdf">https://www.coulounieix-chamiers.fr/files/coulounieix-chamiers/ma_mairie/CA-2021.pdf</a>'
},
series: [{
type: 'sunburst',
data: data,
name: 'Root',
allowTraversingTree: true,
borderRadius: 3,
cursor: 'pointer',
dataLabels: {
format: '{point.name}',
filter: {
property: 'innerArcLength',
operator: '>',
value: 16
}
},
levels: [{
level: 1,
levelIsConstant: false,
dataLabels: {
filter: {
property: 'outerArcLength',
operator: '>',
value: 64
}
}
}, {
level: 2,
colorByPoint: true
},
{
level: 3,
colorVariation: {
key: 'brightness',
to: -1
}
}, {
level: 4,
colorVariation: {
key: 'brightness',
to: 0.5
}
}]
}],
tooltip: {
headerFormat: '',
pointFormat: '<b>{point.name}</b> : <b>' + '{point.value}</b>'
}
});
// Define the data
const data = [{ id: '0.0', parent: '', name: 'Dépenses de fonct. 8655498,26 '}, { id: '1.3', parent: '0.0', name: 'Total des dépenses de gestion courante'}, { id: '1.1', parent: '0.0', name: 'Total des dépenses...