diff --git a/src/chart/map/MapSeries.ts b/src/chart/map/MapSeries.ts index 83da5b0535..db3d1d7661 100644 --- a/src/chart/map/MapSeries.ts +++ b/src/chart/map/MapSeries.ts @@ -55,6 +55,8 @@ export interface MapDataItemOption extends MapStateOption, StatesOptionMixin, OptionDataItemObject { cursor?: string + z?: number + silent?: boolean } export type MapValueCalculationType = 'sum' | 'average' | 'min' | 'max'; diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts index b8bbb8676f..c72cf929f5 100644 --- a/src/component/helper/MapDraw.ts +++ b/src/component/helper/MapDraw.ts @@ -352,6 +352,12 @@ class MapDraw { viewBuildCtx, compoundPath, regionName, regionModel, mapOrGeoModel, dataIdx, centerPt ); + const z = (regionModel as Model).get('z', true); + z != null && (compoundPath.attr('z', z)); + + const silent = (regionModel as Model).get('silent', true); + silent != null && (compoundPath.silent = silent); + if (isLine) { fixLineStyle(compoundPath); zrUtil.each(compoundPath.states, fixLineStyle); diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts index 8caca01ea7..af8846d74c 100644 --- a/src/coord/geo/GeoModel.ts +++ b/src/coord/geo/GeoModel.ts @@ -63,6 +63,8 @@ export interface RegionOption extends GeoStateOption, StatesOptionMixin + z?: number + silent?: boolean } /** @@ -138,6 +140,8 @@ class GeoModel extends ComponentModel { static type = 'geo'; readonly type = GeoModel.type; + preventAutoZ = true; + coordinateSystem: Geo; static layoutMode = 'box' as const; diff --git a/src/coord/geo/geoCreator.ts b/src/coord/geo/geoCreator.ts index 4e948d771d..4247d394ae 100644 --- a/src/coord/geo/geoCreator.ts +++ b/src/coord/geo/geoCreator.ts @@ -271,16 +271,17 @@ class GeoCreator implements CoordinateSystemCreator { const source = geoSourceManager.load(mapName, nameMap, nameProperty); zrUtil.each(source.regions, function (region) { const name = region.name; - if (!dataNameMap.get(name)) { - const regionOption = { - name: name + let regionOption = dataNameMap.get(name); + // apply specified echarts style in GeoJSON data + const specifiedGeoJSONRegionStyle = (region as GeoJSONRegion).properties + && (region as GeoJSONRegion).properties.echartsStyle; + if (!regionOption) { + regionOption = { + name: name }; - // apply specified echarts style in GeoJSON data - const specifiedGeoJSONRegionStyle = (region as GeoJSONRegion).properties - && (region as GeoJSONRegion).properties.echartsStyle; - specifiedGeoJSONRegionStyle && zrUtil.merge(regionOption, specifiedGeoJSONRegionStyle); regionsArr.push(regionOption); } + specifiedGeoJSONRegionStyle && zrUtil.merge(regionOption, specifiedGeoJSONRegionStyle); }); return regionsArr; diff --git a/test/data/map/js/china-map.js b/test/data/map/js/china-map.js index 8971a39a5c..c99627cf6f 100644 --- a/test/data/map/js/china-map.js +++ b/test/data/map/js/china-map.js @@ -56,7 +56,9 @@ borderType: [5, 5], // Developers should set this to chart background color borderColor: '#fff' - } + }, + z: 10, + silent: true }; // Put this feature at the begining of the features so that // the line will be displayed at top. diff --git a/test/effectScatter.html b/test/effectScatter.html index e07cb7fa4d..291f642cc8 100644 --- a/test/effectScatter.html +++ b/test/effectScatter.html @@ -484,7 +484,13 @@ emphasis: { areaColor: '#2a333d' } - } + }, + regions: [{ + name: '新疆维吾尔自治区附近境界线', + itemStyle: { + borderColor: '#404a59' + } + }] }, series : [ { @@ -545,21 +551,21 @@ ] }); - setInterval(function () { - var rippleEffectCount = ~~(Math.random() * 9) + 1; - // console.log('rippleEffectCount', rippleEffectCount); - myChart.setOption({ - series: [{ - name: 'Top 5', - data: convertData(data.sort(function (a, b) { - return b.value - a.value; - }).slice(0, Math.round(6 * Math.random()))), - rippleEffect: { - count: rippleEffectCount - } - }] - }); - }, 2000); + // setInterval(function () { + // var rippleEffectCount = ~~(Math.random() * 9) + 1; + // // console.log('rippleEffectCount', rippleEffectCount); + // myChart.setOption({ + // series: [{ + // name: 'Top 5', + // data: convertData(data.sort(function (a, b) { + // return b.value - a.value; + // }).slice(0, Math.round(6 * Math.random()))), + // rippleEffect: { + // count: rippleEffectCount + // } + // }] + // }); + // }, 2000); });