From the repo
How it works
Vue 2 component that colors countries on a world map from ISO codes (heatmap style), with gradients you control and optional legend slots.
Read the full readme on GitHubInstall
npm install vue2-map-chartUsage
Give `countryData` as an object keyed by ISO 3166 country codes. Values can be simple numbers or objects with count and text for the legend.
import MapChart from 'vue2-map-chart'
// Example: numeric shorthand
<MapChart
:country-data="{ US: 4, CA: 7, GB: 8, IE: 14, ES: 21 }"
high-color="#ff0000"
low-color="#aaaaaa"
country-stroke-color="#909090"
default-country-fill-color="#dadada"
/>
// Object values (per README)
const countryData = {
US: { count: 100, percentage: '25%' },
CA: { count: 240, percentage: '40%' },
GB: { count: 180, percentage: '35%' },
}Slots
When a country is selected, the country name shows in this header slot.
Where code, count, and percentage show in the legend body.
Props
ISO-keyed map of values (numbers or { count, percentage }).
requiredColor for lower values in the heat scale.
optionalColor for higher values in the heat scale.
optionalFill for countries with no data.
optionalBorder color around country shapes.
optionalLegend border (work in progress).
WIPLegend header background.
WIPLegend content background.
WIPIf true, show an on-screen legend when a country is selected.
WIPRoadmap
- More map types (world, Europe, single country)
- Click events on countries
- Extra styling options
- Export to PDF or CSV