Maplace.js

Data visualization dashboards

Map dashboards: viewers by region as cards with a period switch, each country's share as a badge, cities as bubbles sized by population, and countries shaded by a value.

Markdown

Examples

  • Audience dashboard

    Viewers by region as cards on the map, arcs from the studio, and a period switch.

  • Share by country

    Six countries in their own colours, a badge with each one's share, the list as legend.

  • Bubble map

    Cities as bubbles sized by population, a legend, and a count of what is in view.

  • Choropleth of the world

    Every country filled by its GDP per person, its value on hover, with a legend on the map.

Map images: © OpenStreetMap contributors, © OpenMapTiles, OpenFreeMap.

Reference

Markers, from the Locations reference

Field Type What In HTML
lat, lng number Where it is: lat from -90 to 90, lng from -180 to 180 lat, lng
icon Icon A custom marker in place of the provider’s own icon (a URL), or a <template data-icon> child
weight number Its weight on a heatmap, against the other markers’ (1.2); 1 when unset

Polylines, from the Locations reference

Field Type What In HTML
path { lat, lng }[] Its points, at least 2
curve number How far each segment bows from a straight line, for the look, -1 to 1: at 1, its middle sits half its length (in degrees) to the left going from the first point to the last; to the right when negative. Default 0, straight; not with geodesic or editable
geodesic boolean Draws each segment along its great circle, the shortest way on the earth: a flight’s path, a point a degree of arc. Default false; not with curve or editable
progress number How much of the line is travelled, 0 to 1 along it as drawn: that part is drawn in the travelled look, the rest as the line, and a click or hover on either is the line’s. Unset, the line is drawn whole; not with editable
travelledStyle LineStyle The travelled part’s style, over its look: the line’s own in its state, at 40% of its opacity
style LineStyle How it is drawn: a stroke, no fill shape-style (JSON)
selectedStyle LineStyle Drawn over style while selected selected-style (JSON)
hoveredStyle LineStyle Drawn over style while hovered and not selected hovered-style (JSON)
active boolean Marks it as the page’s current one: drawn in the hovered look while neither hovered nor selected, not lifted above other shapes active
activeStyle LineStyle Drawn over style while active, neither hovered nor selected active-style (JSON)

Multipolygons, from the Locations reference

Field Type What In HTML
polygons { path, holes? }[] Its polygons, at least one: each a polygon’s outer ring (path, at least 3 points) and its inner rings (holes, at least 3 points each)
style ShapeStyle How it is drawn, over the store’s style shape-style (JSON)
selectedStyle ShapeStyle Drawn over style while selected selected-style (JSON)
hoveredStyle ShapeStyle Drawn over style while hovered and not selected hovered-style (JSON)
active boolean Marks it as the page’s current one: drawn in the hovered look while neither hovered nor selected, not lifted above other shapes active
activeStyle ShapeStyle Drawn over style while active, neither hovered nor selected active-style (JSON)

List view options, from the Store reference

Option Type What
as "list" | "select" A listbox (default) or a native <select>
groupHeadings boolean Shows group headings; default true when any location has a group
groupCounts boolean After each group heading, how many are listed under it now, following the filter and scope: “North (3)”. Off by default; refused with groupHeadings: false
fitAll boolean Adds a first entry to the list, which clears the selection and fits all locations. On a select, the entry shows only while nothing is selected and all locations are fitted; otherwise no option shows, so the entry can be chosen. A map panned under the fit still shows it, and choosing it then does nothing.
fitAllLabel string The words of the list’s first entry, which clears the selection and fits all locations; default “All locations”; does nothing without fitAll
label string The list’s accessible name; default the heading, else “Locations”
heading string A visible heading above the entries
render (entry) => Node An entry’s content, for as: "list" only; the view keeps keyboard, focus and ARIA handling
scope "viewport" A switch above the list, “All” or “This area”, which lists only the locations in the map’s view and follows it; for as: "list" only
areaOnlyLabel string The words of the scope switch’s button that lists only the map’s view; default “This area”
showAllLabel string The words of the scope switch’s button that lists every location; default “All”
emptyAreaLabel string What a list with scope says when no location is in the map’s view; default “No locations in this area”
sort "distance" Once the store has an origin, nearest first, each entry saying how far (Distances)
distanceUnit "kilometer" | "mile" What sort writes a distance in; default kilometer
search boolean Shows a search box above the entries; for as: "list" only
searchLabel string The search box’s placeholder and accessible name; default “Search”; does nothing without search
noMatchesLabel string What the line under the search box says when nothing matches; default “No locations match”
matchesLabel string What the line under the search box says before the count of matches; default “Locations found”, as “Locations found: 3”
groupFilter boolean (1.2) A “Groups” button above the entries that opens a checkbox for each group, subgroups nested (Subgroups); for as: "list" only
groupFilterLabel string The boxes’ accessible name; default “Groups”; does nothing without groupFilter