Skip to content

Commit

Permalink
Merge pull request #20566 from apache/fix-map
Browse files Browse the repository at this point in the history
feat(map): support `regions[].silent` and update map data in tests
  • Loading branch information
plainheart authored Dec 10, 2024
2 parents ab5de8e + 4e84f15 commit 70a5f3f
Show file tree
Hide file tree
Showing 35 changed files with 916 additions and 368 deletions.
1 change: 1 addition & 0 deletions src/chart/map/MapSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface MapDataItemOption extends MapStateOption,
StatesOptionMixin<MapStateOption, StatesMixinBase>,
OptionDataItemObject<OptionDataValueNumeric> {
cursor?: string
silent?: boolean
}

export type MapValueCalculationType = 'sum' | 'average' | 'min' | 'max';
Expand Down
6 changes: 6 additions & 0 deletions src/component/helper/MapDraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ class MapDraw {
? mapOrGeoModel.getRegionModel(regionName)
: (data ? data.getItemModel(dataIdx) as Model<MapDataItemOption> : null);

const silent = (regionModel as Model<RegionOption>).get('silent', true);
silent != null && (regionGroup.silent = silent);

regionsInfoByName.set(regionName, { dataIdx, regionModel });
}

Expand Down Expand Up @@ -421,6 +424,9 @@ class MapDraw {
el.culling = true;
}

const silent = (regionModel as Model<RegionOption>).get('silent', true);
silent != null && (el.silent = silent);

// We do not know how the SVG like so we'd better not to change z2.
// Otherwise it might bring some unexpected result. For example,
// an area hovered that make some inner city can not be clicked.
Expand Down
1 change: 1 addition & 0 deletions src/coord/geo/GeoModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface RegionOption extends GeoStateOption, StatesOptionMixin<GeoState
name?: string
selected?: boolean
tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>
silent?: boolean
}

/**
Expand Down
15 changes: 8 additions & 7 deletions src/coord/geo/geoCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 23 additions & 3 deletions test/brush.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 57 additions & 1 deletion test/data/map/js/china.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion test/data/map/json/china-cities.json

This file was deleted.

1 change: 0 additions & 1 deletion test/data/map/json/china-new.json

This file was deleted.

1 change: 0 additions & 1 deletion test/data/map/json/china.json

This file was deleted.

22 changes: 19 additions & 3 deletions test/dataZoom-geo.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 51 additions & 51 deletions test/dataset-charts.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 30 additions & 12 deletions test/effectScatter.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions test/geo-data-stream.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 70a5f3f

Please sign in to comment.