โœฆ StealThis .dev

Geographic Distribution Chart

A geographic distribution chart with a country map and horizontal region bars. Features configurable regions, animated bars, color-coded map areas, and a responsive layout for dashboard analytics.

Open in Lab
vanilla-js svg
Targets: JS HTML

Code

Geographic Distribution Chart

A configurable geographic distribution chart combining a real SVG map with animated horizontal bar charts. Designed for dashboard analytics showing regional data breakdowns.

Features

  • Real SVG map โ€” Uses a detailed Colombia departments map from MapSVG (Creative Commons)
  • Two-column layout: interactive SVG map on the left, horizontal bar chart on the right
  • Departments are grouped into 10 macro-regions and colored by value
  • Animated bar chart with staggered entrance animations
  • Hover sync โ€” hovering a bar highlights its departments on the map, and vice versa
  • Tooltip shows department name and region on map hover
  • Responsive layout โ€” stacks vertically on narrow viewports
  • Zero dependencies โ€” vanilla JS

Customization

Edit the REGIONS array in script.js to change region names, values, and which departments belong to each region. Each region has a depts array with department IDs matching the SVG (e.g. CO-ANT for Antioquia).

To use a different country, replace the SVG file and update the REGIONS array with the new department/region IDs from your SVG.

Map Source

The Colombia SVG map is from MapSVG โ€” Colombia, licensed under Creative Commons.

Color Palette

The green gradient ranges from #064e3b (highest value) to #86efac (lowest value), automatically interpolated based on each regionโ€™s relative value.