When to Use Map Charts
Map charts are ideal for visualizing geographic or spatial data. Common use cases include:- Regional data: Displaying metrics by country, state, province, or custom regions
- Heat maps: Showing data density or intensity across geographic areas
- Location markers: Plotting points of interest, store locations, or event locations
- Choropleth maps: Using color to represent data values across regions
- Geographic analysis: Comparing metrics across different territories
Basic Configuration
A map chart uses thetype: 'map' series option. Here’s the basic structure:
Complete Working Example
First, you need to register a GeoJSON map. Here’s an example using a USA map:Registering Maps
Before using a map, you must register it with ECharts:map option in the series must match the registered map name.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:136
Key Options and Properties
Map Selection
map
Type: stringRequired: Yes Name of the registered map. This must match a map previously registered with
echarts.registerMap().
Source: ~/workspace/source/src/chart/map/MapSeries.ts:289
nameProperty
Type: stringDefault:
'name'
Property name in GeoJSON features used to match with data items. By default, ECharts looks for a name property in the GeoJSON.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:99, 365
View Control
center
Type: [number, number]Default: Auto-calculated Center coordinates
[longitude, latitude] for the map view.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:326
zoom
Type: numberDefault:
1
Initial zoom level of the map.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:328
roam
Type: boolean | 'scale' | 'move'Default: Controlled by series Enables map roaming (pan and zoom). Set to
true for both, 'scale' for zoom only, or 'move' for pan only.
scaleLimit
Type: { min?: number, max?: number }
Limits for the zoom scale.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:330
boundingCoords
Type: [[number, number], [number, number]]
Defines the bounding box as [[leftTop], [rightBottom]] coordinates. Takes higher priority than center and zoom.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:323
Selection Mode
selectedMode
Type: boolean | 'single' | 'multiple'Default:
true
Controls how regions can be selected:
false: No selection allowedtrueor'multiple': Multiple regions can be selected'single': Only one region can be selected at a time
Data Processing
mapValueCalculation
Type: 'sum' | 'average' | 'min' | 'max'
When multiple series use the same map, this determines how values are calculated for each region.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:89
Styling
itemStyle
label
State Options
emphasis
Style when hovering over a region:
select
Style when a region is selected:
Data Item Options
Each data item represents a region on the map:Using with Geo Component
Map series can be used with a separategeo component for more advanced layouts:
geoIndex is specified, the series uses the referenced geo component instead of creating its own.
Source: ~/workspace/source/src/chart/map/MapSeries.ts:166-176
Coordinate System
Map series uses the'geo' coordinate system by default: