Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map): support regions[].silent and update map data in tests #20566

Merged
merged 9 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Ovilia marked this conversation as resolved.
Show resolved Hide resolved
z != null && (compoundPath.attr('z', z));
Ovilia marked this conversation as resolved.
Show resolved Hide resolved

const silent = (regionModel as Model<RegionOption>).get('silent', true);
Ovilia marked this conversation as resolved.
Show resolved Hide resolved
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;
Ovilia marked this conversation as resolved.
Show resolved Hide resolved

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
95 changes: 95 additions & 0 deletions test/data/map/js/china-map.js

Large diffs are not rendered by default.

55 changes: 30 additions & 25 deletions test/effectScatter.html

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

Loading