Bevölkerungspyramide (negative Werte)
Zweiseitige Balken um null mit absoluten Beschriftungen.
Diagramm ohne Website-Rahmen öffnen ↗
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "bar",
stacked: true,
toolbar: {
show: false
}
},
series: [
{
name: "Men",
data: [-2.1, -2.2, -3.1, -3.9, -4.7, -5, -5.9, -6.5, -7.6]
},
{
name: "Women",
data: [2.5, 2.7, 3.6, 4.1, 4.2, 5.1, 5.5, 6.2, 7.1]
}
],
xaxis: {
categories: ["85+", "75–84", "65–74", "55–64", "45–54", "35–44", "25–34", "15–24", "0–14"],
labels: {
formatter: (v) => Math.abs(Math.round(v)) + '%'
}
},
yaxis: {
min: -8,
max: 8
},
tooltip: {
y: {
formatter: (v) => Math.abs(v) + '%'
}
},
plotOptions: {
bar: {
horizontal: true,
barHeight: "82%"
}
},
dataLabels: {
enabled: false
},
grid: {
xaxis: {
lines: {
show: false
}
}
},
title: {
text: "Population by age (share)"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()import WestCoastCharts from 'west-coast-charts'
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "bar",
stacked: true,
toolbar: {
show: false
}
},
series: [
{
name: "Men",
data: [-2.1, -2.2, -3.1, -3.9, -4.7, -5, -5.9, -6.5, -7.6]
},
{
name: "Women",
data: [2.5, 2.7, 3.6, 4.1, 4.2, 5.1, 5.5, 6.2, 7.1]
}
],
xaxis: {
categories: ["85+", "75–84", "65–74", "55–64", "45–54", "35–44", "25–34", "15–24", "0–14"],
labels: {
formatter: (v) => Math.abs(Math.round(v)) + '%'
}
},
yaxis: {
min: -8,
max: 8
},
tooltip: {
y: {
formatter: (v) => Math.abs(v) + '%'
}
},
plotOptions: {
bar: {
horizontal: true,
barHeight: "82%"
}
},
dataLabels: {
enabled: false
},
grid: {
xaxis: {
lines: {
show: false
}
}
},
title: {
text: "Population by age (share)"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render() Warten auf das Diagramm.
Open Data & agent view to read this chart through chart.describe().
Aus der laufenden Bibliothek über das optionale agent/describe -Modul gelesen. Text, Tabelle und JSON zeigen denselben Zustand. Ausschließlich Demonstrationsdaten.
$ wcc chart export bar-bar-with-negative.json --out bar-bar-with-negative.svg --with-table Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm. Speichern Sie zuerst eine JSON-Spezifikation und prüfen Sie vor dem Rendern die geladene Runtime und die unterstützten Module. Befehlsreferenz
Loading /gallery/bar/bar-with-negative/index.md …