You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2026/05/12 17:35:27 UTC
(echarts) 02/02: fixRegression(map,geo): Resolve circular dependencies introduced by this version.
This is an automated email from the ASF dual-hosted git repository.
100pah pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 21f17bec20d42623edcd66f91cf2344d2bced6b1
Author: 100pah <su...@gmail.com>
AuthorDate: Wed May 13 01:34:14 2026 +0800
fixRegression(map,geo): Resolve circular dependencies introduced by this version.
---
src/chart/map/MapSeries.ts | 57 ++++++++++++++++++++++++++++++++++++-
src/chart/map/MapView.ts | 3 +-
src/chart/map/mapDataStatistic.ts | 3 +-
src/chart/map/mapSymbolLayout.ts | 3 +-
src/component/geo/install.ts | 4 +--
src/coord/geo/geoCreator.ts | 60 ++-------------------------------------
6 files changed, 64 insertions(+), 66 deletions(-)
diff --git a/src/chart/map/MapSeries.ts b/src/chart/map/MapSeries.ts
index b3c350e55..b41f8c682 100644
--- a/src/chart/map/MapSeries.ts
+++ b/src/chart/map/MapSeries.ts
@@ -51,7 +51,7 @@ import {Group} from '../../util/graphic';
import { COORD_SYS_USAGE_KIND_BOX, decideCoordSysUsageKind } from '../../core/CoordinateSystem';
import { GeoJSONRegion } from '../../coord/geo/Region';
import tokens from '../../visual/tokens';
-import { MapSeriesGroup, mapSeriesNeedsDrawMap } from '../../coord/geo/geoCreator';
+import GlobalModel from '../../model/Global';
export interface MapStateOption<TCbParams = never> {
itemStyle?: GeoItemStyleOption<TCbParams>
@@ -66,6 +66,17 @@ export interface MapDataItemOption extends MapStateOption,
export type MapValueCalculationType = 'sum' | 'average' | 'min' | 'max';
+// See MAP_SERIES_GROUP
+export type MapSeriesGroup = {
+ // Raw (a group of series before series filtering)
+ // Never be empty.
+ r: MapSeries[];
+ // Filtered (a group of series after series filtering)
+ // If `getMainMapSeries(seriesGroup)` is falsy, `f` is an empty array.
+ f: MapSeries[];
+};
+type AllMapSeriesGroups = Dictionary<MapSeriesGroup>;
+
export interface MapSeriesOption extends
SeriesOption<MapStateOption<CallbackDataParams>, StatesMixinBase>,
MapStateOption<CallbackDataParams>,
@@ -362,4 +373,48 @@ class MapSeries extends SeriesModel<MapSeriesOption> implements RoamHostModel {
}
+/**
+ * Has exclusive geo, rahter than depends on a separate geo componet.
+ */
+export function mapSeriesGroupHasOwnGeo(groupKey: string): boolean {
+ return groupKey.indexOf('i') === 0;
+}
+
+export function mapSeriesNeedsDrawMap(mapSeries: MapSeries): boolean {
+ // Within a MAP_SERIES_GROUP, only `mainSeries` has `needsDrawMap: true`.
+ return getMainMapSeries(mapSeries.seriesGroup) === mapSeries && !mapSeries.getHostGeoModel();
+}
+
+export function getMainMapSeries(mapSeriesGroup: MapSeriesGroup): MapSeries | NullUndefined {
+ // The first series after filtering in a MAP_SERIES_GROUP.
+ return mapSeriesGroup.f[0];
+}
+
+
+/**
+ * @tutorial [MAP_SERIES_GROUP]
+ * - For map series that reference external geo components (typically via `geoIndex` or `geoId` in ec option),
+ * a map series group is all map series that reference to the same geo component.
+ * - For other map series,
+ * a map series group is all map series that use the same `map` in ec option.
+ * NOTICE: series filtering (typically by legend) matters:
+ * If this method is executed before series filtering, all series are included,
+ * otherwise, series filtered out are excluded.
+ * When legend disables the original first series, the original second series takes the responsibility
+ * to render map (via its `MapDraw`).
+ */
+export function buildAllMapSeriesGroups(ecModel: GlobalModel, beforeSeriesFiltering?: boolean): AllMapSeriesGroups {
+ const allMapSeriesGroups: AllMapSeriesGroups = {};
+ ecModel.eachRawSeriesByType(SERIES_TYPE_MAP, function (seriesModel: MapSeries) {
+ const hostGeoModel = seriesModel.getHostGeoModel();
+ const key = hostGeoModel ? 'o' + hostGeoModel.id : 'i' + seriesModel.getMapType();
+ const group = allMapSeriesGroups[key] = allMapSeriesGroups[key] || {f: [], r: []};
+ if (!ecModel.isSeriesFiltered(seriesModel) && !beforeSeriesFiltering) {
+ group.f.push(seriesModel);
+ }
+ group.r.push(seriesModel);
+ });
+ return allMapSeriesGroups;
+}
+
export default MapSeries;
diff --git a/src/chart/map/MapView.ts b/src/chart/map/MapView.ts
index 8edb7c749..41d3e4b0f 100644
--- a/src/chart/map/MapView.ts
+++ b/src/chart/map/MapView.ts
@@ -21,13 +21,12 @@
import * as graphic from '../../util/graphic';
import MapDraw from '../../component/helper/MapDraw';
import ChartView from '../../view/Chart';
-import MapSeries, { MapDataItemOption, SERIES_TYPE_MAP } from './MapSeries';
+import MapSeries, { getMainMapSeries, MapDataItemOption, mapSeriesNeedsDrawMap, SERIES_TYPE_MAP } from './MapSeries';
import GlobalModel from '../../model/Global';
import ExtensionAPI from '../../core/ExtensionAPI';
import { Payload, DisplayState, ECElement, RoamPayload } from '../../util/types';
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
import { setStatesFlag, Z2_EMPHASIS_LIFT } from '../../util/states';
-import { getMainMapSeries, mapSeriesNeedsDrawMap } from '../../coord/geo/geoCreator';
class MapView extends ChartView {
diff --git a/src/chart/map/mapDataStatistic.ts b/src/chart/map/mapDataStatistic.ts
index 62ac27565..2b7085bae 100644
--- a/src/chart/map/mapDataStatistic.ts
+++ b/src/chart/map/mapDataStatistic.ts
@@ -20,10 +20,9 @@
import * as zrUtil from 'zrender/src/core/util';
import SeriesData from '../../data/SeriesData';
-import { MapValueCalculationType, SERIES_TYPE_MAP } from './MapSeries';
+import { buildAllMapSeriesGroups, getMainMapSeries, MapValueCalculationType, SERIES_TYPE_MAP } from './MapSeries';
import GlobalModel from '../../model/Global';
import { createSimpleOverallStageHandler } from '../../util/model';
-import { buildAllMapSeriesGroups, getMainMapSeries } from '../../coord/geo/geoCreator';
// FIXME 公用?
function dataStatistics(datas: SeriesData[], statisticType: MapValueCalculationType): SeriesData {
diff --git a/src/chart/map/mapSymbolLayout.ts b/src/chart/map/mapSymbolLayout.ts
index c6e1de3e8..9a7951824 100644
--- a/src/chart/map/mapSymbolLayout.ts
+++ b/src/chart/map/mapSymbolLayout.ts
@@ -19,10 +19,9 @@
import GlobalModel from '../../model/Global';
-import { SERIES_TYPE_MAP } from './MapSeries';
+import { buildAllMapSeriesGroups, getMainMapSeries, mapSeriesGroupHasOwnGeo, SERIES_TYPE_MAP } from './MapSeries';
import { Dictionary } from '../../util/types';
import { createSimpleOverallStageHandler } from '../../util/model';
-import { buildAllMapSeriesGroups, getMainMapSeries, mapSeriesGroupHasOwnGeo } from '../../coord/geo/geoCreator';
import { each } from 'zrender/src/core/util';
diff --git a/src/component/geo/install.ts b/src/component/geo/install.ts
index b97bd6365..10f9dea7a 100644
--- a/src/component/geo/install.ts
+++ b/src/component/geo/install.ts
@@ -19,11 +19,11 @@
import { EChartsExtensionInstallRegisters } from '../../extension';
import GeoModel from '../../coord/geo/GeoModel';
-import geoCreator, { mapSeriesNeedsDrawMap } from '../../coord/geo/geoCreator';
+import geoCreator from '../../coord/geo/geoCreator';
import { ActionInfo, COMPONENT_MAIN_TYPE_SERIES, RoamHostModel, RoamPayload } from '../../util/types';
import { each } from 'zrender/src/core/util';
import GlobalModel from '../../model/Global';
-import MapSeries from '../../chart/map/MapSeries';
+import MapSeries, { mapSeriesNeedsDrawMap } from '../../chart/map/MapSeries';
import GeoView from './GeoView';
import geoSourceManager from '../../coord/geo/geoSourceManager';
import type ExtensionAPI from '../../core/ExtensionAPI';
diff --git a/src/coord/geo/geoCreator.ts b/src/coord/geo/geoCreator.ts
index e04b4aa77..ef0cd065c 100644
--- a/src/coord/geo/geoCreator.ts
+++ b/src/coord/geo/geoCreator.ts
@@ -23,11 +23,12 @@ import * as layout from '../../util/layout';
import * as numberUtil from '../../util/number';
import geoSourceManager from './geoSourceManager';
import GeoModel, { GeoCommonOptionMixin, GeoOption, RegionOption } from './GeoModel';
-import MapSeries, { MapSeriesOption, SERIES_TYPE_MAP } from '../../chart/map/MapSeries';
+import MapSeries, {
+ buildAllMapSeriesGroups, mapSeriesGroupHasOwnGeo, MapSeriesOption, SERIES_TYPE_MAP
+} from '../../chart/map/MapSeries';
import ExtensionAPI from '../../core/ExtensionAPI';
import { CoordinateSystemCreator } from '../CoordinateSystem';
import { NameMap } from './geoTypes';
-import { Dictionary, NullUndefined } from 'zrender/src/core/types';
import type Model from '../../model/Model';
import type GlobalModel from '../../model/Global';
import type ComponentModel from '../../model/Component';
@@ -43,17 +44,6 @@ import {
export type resizeGeoType = typeof resizeGeo;
export type MapOrGeoModel = (GeoModel | MapSeries) & ComponentModel<GeoOption | MapSeriesOption>;
-// See MAP_SERIES_GROUP
-export type MapSeriesGroup = {
- // Raw (a group of series before series filtering)
- // Never be empty.
- r: MapSeries[];
- // Filtered (a group of series after series filtering)
- // If `getMainMapSeries(seriesGroup)` is falsy, `f` is an empty array.
- f: MapSeries[];
-};
-type AllMapSeriesGroups = Dictionary<MapSeriesGroup>;
-
/**
* Resize method bound to the geo
*/
@@ -319,50 +309,6 @@ class GeoCreator implements CoordinateSystemCreator {
}
}
-
const geoCreator = new GeoCreator();
-/**
- * @tutorial [MAP_SERIES_GROUP]
- * - For map series that reference external geo components (typically via `geoIndex` or `geoId` in ec option),
- * a map series group is all map series that reference to the same geo component.
- * - For other map series,
- * a map series group is all map series that use the same `map` in ec option.
- * NOTICE: series filtering (typically by legend) matters:
- * If this method is executed before series filtering, all series are included,
- * otherwise, series filtered out are excluded.
- * When legend disables the original first series, the original second series takes the responsibility
- * to render map (via its `MapDraw`).
- */
-export function buildAllMapSeriesGroups(ecModel: GlobalModel, beforeSeriesFiltering?: boolean): AllMapSeriesGroups {
- const allMapSeriesGroups: AllMapSeriesGroups = {};
- ecModel.eachRawSeriesByType(SERIES_TYPE_MAP, function (seriesModel: MapSeries) {
- const hostGeoModel = seriesModel.getHostGeoModel();
- const key = hostGeoModel ? 'o' + hostGeoModel.id : 'i' + seriesModel.getMapType();
- const group = allMapSeriesGroups[key] = allMapSeriesGroups[key] || {f: [], r: []};
- if (!ecModel.isSeriesFiltered(seriesModel) && !beforeSeriesFiltering) {
- group.f.push(seriesModel);
- }
- group.r.push(seriesModel);
- });
- return allMapSeriesGroups;
-}
-
-/**
- * Has exclusive geo, rahter than depends on a separate geo componet.
- */
-export function mapSeriesGroupHasOwnGeo(groupKey: string): boolean {
- return groupKey.indexOf('i') === 0;
-}
-
-export function mapSeriesNeedsDrawMap(mapSeries: MapSeries): boolean {
- // Within a MAP_SERIES_GROUP, only `mainSeries` has `needsDrawMap: true`.
- return getMainMapSeries(mapSeries.seriesGroup) === mapSeries && !mapSeries.getHostGeoModel();
-}
-
-export function getMainMapSeries(mapSeriesGroup: MapSeriesGroup): MapSeries | NullUndefined {
- // The first series after filtering in a MAP_SERIES_GROUP.
- return mapSeriesGroup.f[0];
-}
-
export default geoCreator;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org