Skip to content

Commit

Permalink
fix: add regions.silent and z for geo and map
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Dec 6, 2024
1 parent 9139d45 commit 04d412a
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 24 deletions.
2 changes: 2 additions & 0 deletions src/chart/map/MapSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export interface MapDataItemOption extends MapStateOption,
StatesOptionMixin<MapStateOption, StatesMixinBase>,
OptionDataItemObject<OptionDataValueNumeric> {
cursor?: string
z?: number
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 @@ -352,6 +352,12 @@ class MapDraw {
viewBuildCtx, compoundPath, regionName, regionModel, mapOrGeoModel, dataIdx, centerPt
);

const z = (regionModel as Model<RegionOption>).get('z', true);
z != null && (compoundPath.attr('z', z));

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

if (isLine) {
fixLineStyle(compoundPath);
zrUtil.each(compoundPath.states, fixLineStyle);
Expand Down
4 changes: 4 additions & 0 deletions src/coord/geo/GeoModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export interface RegionOption extends GeoStateOption, StatesOptionMixin<GeoState
name?: string
selected?: boolean
tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>
z?: number
silent?: boolean
}

/**
Expand Down Expand Up @@ -138,6 +140,8 @@ class GeoModel extends ComponentModel<GeoOption> {
static type = 'geo';
readonly type = GeoModel.type;

preventAutoZ = true;

coordinateSystem: Geo;

static layoutMode = 'box' as const;
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
4 changes: 3 additions & 1 deletion test/data/map/js/china-map.js

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

38 changes: 22 additions & 16 deletions test/effectScatter.html

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

0 comments on commit 04d412a

Please sign in to comment.