Configuration
Data Series
A series is a visual indicator used to represent data on the map by assigning colors to specific regions or markers.
Usage
This example applies a color-coded series to markers based on their geographic grouping.
It uses the fill attribute to visually distinguish Asian and Western countries and displays a legend to explain the color codes.
Each marker is assigned to a scale value (Asian or West) using the values object.
<div id="map"></div>
Vertical Legend
To display the legend vertically instead of the default horizontal layout, set the vertical option to true in the legend configuration:
const series = {
markers: [
{
...
legend: {
vertical: true,
},
...
},
],
}
Series For Markers
Options
The series option allows you to visually differentiate markers and regions using color-coded data scales, legends, and attributes.
This is useful for creating choropleth maps or categorizing elements based on data, each series entry can target either markers or regions, and supports the following options:
attribute
Defines which SVG attribute should be modified for each item in the series. Common values include:
fill
– Changes the fill color of markers or regions.stroke
– Changes the border color.
attributes (Regions only)
An object for directly assigning SVG attributes per region. Each key must be a region code.
attributes: {
EG: 'red', // Egypt gets a red fill
}
scale
Maps data keys to color values. This allows you to visually represent categories or ranges.
You can use any valid CSS color as the value.
scale: {
'Asian': '#e7000b',
'West': '#0084d1',
}
values
Assigns each region or marker to a specific key from the scale. Keys must be:
- For markers: numeric indexes (starting from 0).
- For regions: region codes (e.g., ‘US’, ‘FR’).
values: {
0: 'West', // Marker index 0 will be colored using 'West' scale
GB: 'Asian', // Region GB will be colored using 'Asian' scale
}
legend
Controls the appearance and layout of the legend for the series.
Available options:
- title (optional): Title text displayed above the legend.
- vertical: If true, lays out the legend vertically (default is horizontal).