Life expectancy swarm
One dot per country, swarmed by continent, horizontal.
Open the chart without page chrome ↗
const options = {
chart: {
height: 420,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "beeswarm",
toolbar: {
show: false
}
},
series: [
{
name: "Life expectancy",
data: [
{
x: "Africa",
y: [63.9, 58.3, 63.2, 54.3, 63.2, 65.4, 67.7, 53.2, 65.2, 77.4, 67, 57.5, 60.5, 63.2, 61.2, 64.7, 65.6, 66.5, 70.5, 61.6, 57.9, 63.5, 54.4, 64.8, 56.6, 53.7, 71.1, 63, 75.9, 66.1, 66.5, 64.2, 70.7, 56.2, 62.7, 61, 72.6, 57, 73.6, 59.7, 71, 60.5, 62.1, 67.1, 60.9, 61.3, 65.9, 59.9, 67.2, 56.5, 64.7, 68.7, 56.8, 52.5]
},
{
x: "Americas",
y: [78, 75.1, 70.5, 75.1, 71.7, 76.4, 73.2, 71.7, 73.4, 74.9, 80.6, 72.8, 71.3, 74.8, 71.3, 72.8, 73, 77, 76.2, 74.2, 75.5, 72.7, 77.3, 80.1, 73.1, 69.1, 71.3, 81.6, 72.2, 68.3, 74.5, 77.3, 73.5, 86, 75.2, 72.7, 75.2, 73.3, 73.5, 76.3, 72.6, 82.7, 73.4, 77.1, 85.8, 79.9, 75.1, 76.2, 75.6, 72.9]
},
{
x: "Asia",
y: [71.2, 71.2, 74.6, 68, 74.1, 66.5, 73.7, 83, 67.6, 72.2, 76.9, 69.7, 69.9, 74.1, 68.1, 78.8, 76, 69.8, 69, 71.2, 70.2, 71.8, 77.2, 72.4, 70.3, 73.3, 73.9, 64.3, 65, 69, 70.9, 68.3, 70.4, 69.4, 63.5, 72.9, 76.8, 70.5, 68.8, 74.1, 65.6, 71.4, 68, 67.3, 64.5, 67.6, 68.9, 69.5]
},
{
x: "Europe",
y: [79.3, 77.4, 81.9, 81.6, 81.2, 80.9, 78.7, 78.7, 81.8, 77.9, 82, 78.7, 80.3, 73.6, 78.8, 80.6, 82, 73.1, 83.4, 79.2, 80.3, 76.1, 79.5, 86, 78.2, 75.1, 77.2, 80.2, 79.1, 79.7, 82.3, 80.8, 78.4, 79.4, 80.7, 79, 76.1, 79.9, 75.7, 75.6, 75.7, 76.3, 83.5, 84.4]
},
{
x: "Oceania",
y: [70.8, 71.1, 82.8, 72.6, 80.7, 75.7, 72.6, 74.6, 73.4, 74.3, 74.1, 77.7, 71.9, 73]
}
]
}
],
plotOptions: {
bar: {
horizontal: true,
distributed: true
}
},
xaxis: {
title: {
text: "years"
}
},
title: {
text: "Life expectancy by continent (our sample data)"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()import WestCoastCharts from 'west-coast-charts'
import types from 'west-coast-charts/types'
WestCoastCharts.use(types)
const options = {
chart: {
height: 420,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "beeswarm",
toolbar: {
show: false
}
},
series: [
{
name: "Life expectancy",
data: [
{
x: "Africa",
y: [63.9, 58.3, 63.2, 54.3, 63.2, 65.4, 67.7, 53.2, 65.2, 77.4, 67, 57.5, 60.5, 63.2, 61.2, 64.7, 65.6, 66.5, 70.5, 61.6, 57.9, 63.5, 54.4, 64.8, 56.6, 53.7, 71.1, 63, 75.9, 66.1, 66.5, 64.2, 70.7, 56.2, 62.7, 61, 72.6, 57, 73.6, 59.7, 71, 60.5, 62.1, 67.1, 60.9, 61.3, 65.9, 59.9, 67.2, 56.5, 64.7, 68.7, 56.8, 52.5]
},
{
x: "Americas",
y: [78, 75.1, 70.5, 75.1, 71.7, 76.4, 73.2, 71.7, 73.4, 74.9, 80.6, 72.8, 71.3, 74.8, 71.3, 72.8, 73, 77, 76.2, 74.2, 75.5, 72.7, 77.3, 80.1, 73.1, 69.1, 71.3, 81.6, 72.2, 68.3, 74.5, 77.3, 73.5, 86, 75.2, 72.7, 75.2, 73.3, 73.5, 76.3, 72.6, 82.7, 73.4, 77.1, 85.8, 79.9, 75.1, 76.2, 75.6, 72.9]
},
{
x: "Asia",
y: [71.2, 71.2, 74.6, 68, 74.1, 66.5, 73.7, 83, 67.6, 72.2, 76.9, 69.7, 69.9, 74.1, 68.1, 78.8, 76, 69.8, 69, 71.2, 70.2, 71.8, 77.2, 72.4, 70.3, 73.3, 73.9, 64.3, 65, 69, 70.9, 68.3, 70.4, 69.4, 63.5, 72.9, 76.8, 70.5, 68.8, 74.1, 65.6, 71.4, 68, 67.3, 64.5, 67.6, 68.9, 69.5]
},
{
x: "Europe",
y: [79.3, 77.4, 81.9, 81.6, 81.2, 80.9, 78.7, 78.7, 81.8, 77.9, 82, 78.7, 80.3, 73.6, 78.8, 80.6, 82, 73.1, 83.4, 79.2, 80.3, 76.1, 79.5, 86, 78.2, 75.1, 77.2, 80.2, 79.1, 79.7, 82.3, 80.8, 78.4, 79.4, 80.7, 79, 76.1, 79.9, 75.7, 75.6, 75.7, 76.3, 83.5, 84.4]
},
{
x: "Oceania",
y: [70.8, 71.1, 82.8, 72.6, 80.7, 75.7, 72.6, 74.6, 73.4, 74.3, 74.1, 77.7, 71.9, 73]
}
]
}
],
plotOptions: {
bar: {
horizontal: true,
distributed: true
}
},
xaxis: {
title: {
text: "years"
}
},
title: {
text: "Life expectancy by continent (our sample data)"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render() Waiting for the chart.
Open Data & agent view to read this chart through chart.describe().
Read from the running library through its optional agent/describe module. Text, table and JSON share the same snapshot. Demo data only.
$ wcc chart export beeswarm-life-expectancy-swarm.json --out beeswarm-life-expectancy-swarm.svg --with-table Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm. Save a JSON spec first and check the loaded runtime and supported modules before rendering. Command reference
Loading /gallery/beeswarm/life-expectancy-swarm/index.md …