diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts index cc8fe4e80e..635b998f88 100644 --- a/src/component/helper/MapDraw.ts +++ b/src/component/helper/MapDraw.ts @@ -302,6 +302,10 @@ class MapDraw { ? mapOrGeoModel.getRegionModel(regionName) : (data ? data.getItemModel(dataIdx) as Model : null); + // allow specified echarts style in GeoJSON data + const specifiedRegionStyle = region.properties && region.properties.echartsStyle; + specifiedRegionStyle && zrUtil.merge(regionModel.option, specifiedRegionStyle); + regionsInfoByName.set(regionName, { dataIdx, regionModel }); } diff --git a/src/coord/geo/Region.ts b/src/coord/geo/Region.ts index 095efcd4b8..e03863dcd7 100644 --- a/src/coord/geo/Region.ts +++ b/src/coord/geo/Region.ts @@ -23,8 +23,9 @@ import * as vec2 from 'zrender/src/core/vector'; import * as polygonContain from 'zrender/src/contain/polygon'; import { GeoJSON, GeoProjection, GeoSVGGraphicRoot } from './geoTypes'; import * as matrix from 'zrender/src/core/matrix'; -import Element from 'zrender/src/Element'; +import type Element from 'zrender/src/Element'; import { each } from 'zrender/src/core/util'; +import type { RegoinOption } from './GeoModel'; const TMP_TRANSFORM = [] as number[]; @@ -135,7 +136,9 @@ export class GeoJSONRegion extends Region { readonly geometries: (GeoJSONPolygonGeometry | GeoJSONLineStringGeometry)[]; // Injected outside. - properties: GeoJSON['features'][0]['properties']; + properties: GeoJSON['features'][0]['properties'] & { + echartsStyle?: Omit + }; constructor( name: string, diff --git a/test/geo-map.html b/test/geo-map.html index dfe1fca0c4..5c7da0ecc2 100644 --- a/test/geo-map.html +++ b/test/geo-map.html @@ -26,438 +26,418 @@ + + - -
- + + - \ No newline at end of file +