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 2021/03/21 14:40:28 UTC
[echarts] branch fix/geo-svg updated (30c861c -> 152ab8e)
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a change to branch fix/geo-svg
in repository https://gitbox.apache.org/repos/asf/echarts.git.
from 30c861c feature: [geo] (1) "geoselectchanged" event: add param: allSelected: { geoIndex: number, name: string[] }[] (2) geoSVG resource support: + label + emphasis/select/blur state + "geoselectchanged" event (on geo component) + "selectchanged" event (on map series) (3) some refactor to make those happen: + The original `Region` is migrated to `GeoJSONRegion`. And make `Region` as the base class of `GeoJSONRegion` and `GeoSVGRegion`. + Modify the constructor of `Geo`.
new f2c35fa fix: [geo] tweak a little.
new 86522a1 fix: [geo] modified default item color for geoSVG and some tweak.
add 9fe6263 Fix: endLabel color support 'auto' 'inherit'
add 08d55f6 chore: endlabel color is string type
add 3bad840 Merge pull request #14000 from susiwen8/endlabel-color-inherit
add f5dfa5d fix(type): optimize event param types
add 893255e Merge pull request #14155 from apache/fix-echarts-types
add 2801c17 Feat: dev-fase use esbuild watch mode
add 51aab9e chore: use banner and footer to wrap code
add cf89ecc Merge pull request #14177 from susiwen8/esbuild-watch
add 2b55862 fix(showLoading): #14188 text of loading covered by charts
add 0b33193 Merge pull request #14191 from apache/fix-14188
add b04772d Update LegendModel.ts
add 28bffa0 Merge pull request #14263 from thesiti92/patch-1
add b72fa40 Merge pull request #14160 from apache/master
add 8a9d8f6 test: add gauge regression test case
add 6bb9d73 Merge pull request #14164 from apache/add-gauge-regression-case
add 11d77c1 fix: error thrown when `toolbox.feature.dataZoom: { show: false, yAxisIndex: false }`. (brought in 5.0)
add 1693e93 Merge pull request #14175 from apache/fix/toolbox-datazoom
add 1ea6586 fix: tweak chalk for error thrown in the recently version.
add 0c1ffeb release: 5.0.2
add 03bee99 Merge pull request #14178 from apache/release-dev
add 52b9ed5 Improve French translation
add a44926a Merge pull request #14283 from apache/release
add 55384ad fix(type): exporting more necessary types
add 6a7ac85 Merge pull request #14289 from apache/export-types
add 2a49feb This code has been modified in 8c2267d45 (see #11854) and merge into next branch in dd3d83cc4, but in 58dc3f701 the merge was not correct enough (it cause the drillDownIcon displayed repeatedly in some case). So fix it according to 8c2267d45. And add the missing test case.
add e893d90 Merge pull request #14299 from apache/fix/treemap-expand
add 27449d3 fix(markLine): fix axis type in markLine data and close #14300
add a302c0c Merge pull request #14314 from apache/fix-14300
add 1c6d63c fix(markArea): markArea background color disappeared. close #13647
add 8e8ed75 chore: simplify code
add 474c759 improve: rename variable and add sort compare func
add 8b17abb Merge pull request #14343 from Nick22nd/fix-13647
add f03dfad Export union members of option types separately
add cc8a94a Merge pull request #14353 from twittwer/feat/export-PiecewiseVisualMapOption
add 9e647d3 fix(dataZoom):fix dataZoom setting no effect
add a7ce768 Merge pull request #14388 from apache/fix-14285
add a1a3fa3 Fix(sankey): sankey label has higher z2
add 31a6de8 Merge pull request #14417 from susiwen8/14287
add 13f1f03 fix(series): fix series data type judgment bug. close #14293 (#14413)
add 64c0bbe fix file names in license (#14456)
add cd84535 feat(i18n): added czech translation
add 773d87e Merge pull request #14468 from JiriBalcar/czech_translation
add 0456847 fix(tooltip): fix time axis formatter #14470
add b9c7e9e feature: [tooltip] (1) Make component tooltip inherit cascade correct: itemOption.tooltip -> componentOption.tooltip -> globalOption.tooltip (previous incorrect cascade: itemOption.tooltip -> globalOption.tooltip (2) Enable trigger component tooltip by chart.dispatchAction({ type: 'showTip', legendIndex: 0, name: 'some' });
add 91e8e47 fix: [tooltip] add test case for the last commit.
add 35d9f60 fix: [tooltip] escape series from component finder.
add 438f403 fix: [tooltip] keep support tooltip on graphic component.
add 3dea90f fix: [tooltip] (1) keep support string tooltip on each component item. (2) some tiny refactor.
add 88d2ad7 Merge pull request #14473 from apache/fix/component-tooltip
new 886d041 Merge branch 'master' into fix/geo-svg
new 152ab8e fix: [geo] (1) fix contain point calculation. (2) remove Geo['_nameCoordMap'], instead, calculate center on demand. (3) fix that some API missing nameProperty and geoJSON should cached not only by mapName but also by nameProperty. (4) do not support nameMap in geoSVG until some real requirements come. (5) svg line polyline use 'region.lineStyle' rather than 'region.itemStyle' (6) svg text tspan image are enabled to trigger tooltip and user event (but not supported to cha [...]
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
LICENSE | 9 +-
build/addHeader.js | 8 +-
build/dev-fast.js | 69 +-
dist/echarts.common.js | 11349 ++++++++++--
dist/echarts.common.js.map | 2 +-
dist/echarts.common.min.js | 2 +-
dist/echarts.esm.js | 21511 +++++++++++++++++-----
dist/echarts.esm.js.map | 2 +-
dist/echarts.esm.min.js | 2 +-
dist/echarts.js | 21511 +++++++++++++++++-----
dist/echarts.js.map | 2 +-
dist/echarts.min.js | 2 +-
dist/echarts.simple.js | 7981 ++++++--
dist/echarts.simple.js.map | 2 +-
dist/echarts.simple.min.js | 2 +-
dist/extension/bmap.js | 67 +-
dist/extension/bmap.js.map | 2 +-
dist/extension/dataTool.js | 68 +-
dist/extension/dataTool.js.map | 2 +-
package-lock.json | 60 +-
package.json | 8 +-
src/chart/custom/install.ts | 7 +-
src/chart/graph/GraphSeries.ts | 5 +-
src/chart/line/LineView.ts | 13 +-
src/chart/sankey/SankeySeries.ts | 6 +-
src/chart/sankey/SankeyView.ts | 10 +-
src/chart/treemap/TreemapView.ts | 13 +-
src/component/axis/AxisBuilder.ts | 34 +-
src/component/brush/BrushModel.ts | 5 +
src/component/dataZoom/SliderZoomView.ts | 5 +-
src/component/geo/GeoView.ts | 10 +-
src/component/graphic/install.ts | 16 +-
src/component/helper/MapDraw.ts | 225 +-
src/component/legend/LegendModel.ts | 5 +
src/component/legend/LegendView.ts | 26 +-
src/component/marker/MarkAreaView.ts | 29 +-
src/component/marker/MarkLineModel.ts | 4 +-
src/component/toolbox/ToolboxModel.ts | 3 +-
src/component/toolbox/ToolboxView.ts | 28 +-
src/component/toolbox/feature/DataZoom.ts | 27 +-
src/component/tooltip/TooltipView.ts | 154 +-
src/coord/View.ts | 2 +
src/coord/geo/Geo.ts | 30 +-
src/coord/geo/GeoJSONResource.ts | 23 +-
src/coord/geo/GeoModel.ts | 50 +-
src/coord/geo/GeoSVGResource.ts | 158 +-
src/coord/geo/geoCreator.ts | 9 +-
src/coord/geo/geoSourceManager.ts | 2 +-
src/coord/geo/geoTypes.ts | 28 +-
src/core/echarts.ts | 61 +-
src/data/OrdinalMeta.ts | 2 +-
src/export/core.ts | 12 +-
src/export/option.ts | 27 +-
src/i18n/langCS.ts | 142 +
src/i18n/langFR.ts | 48 +-
src/loading/default.ts | 4 +-
src/model/Series.ts | 4 +-
src/model/mixin/lineStyle.ts | 2 +-
src/util/ECEventProcessor.ts | 4 +-
src/util/format.ts | 2 +-
src/util/graphic.ts | 56 +-
src/util/innerStore.ts | 17 +-
src/util/model.ts | 68 +-
src/util/types.ts | 48 +-
src/view/Chart.ts | 6 +-
src/view/Component.ts | 4 +-
test/{build/mktest-tpl.html => gauge-case.html} | 63 +-
test/geo-svg.html | 336 +-
test/line-endLabel.html | 6 +-
test/{allZero.html => line-non-continuous.html} | 46 +-
test/loading.html | 46 +
test/runTest/actions/__meta__.json | 1 +
test/tooltip-component.html | 467 +
test/treemap-action.html | 416 +
test/types/basic.ts | 2 +-
test/types/event.ts | 23 +
76 files changed, 52404 insertions(+), 13097 deletions(-)
create mode 100644 src/i18n/langCS.ts
copy test/{build/mktest-tpl.html => gauge-case.html} (61%)
copy test/{allZero.html => line-non-continuous.html} (66%)
create mode 100644 test/tooltip-component.html
create mode 100755 test/treemap-action.html
create mode 100644 test/types/event.ts
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 04/04: fix: [geo] (1) fix contain point calculation. (2)
remove Geo['_nameCoordMap'], instead,
calculate center on demand. (3) fix that some API missing nameProperty and
geoJSON should cached not only by mapName but also by nameProperty. (4) do
not support nameMap in geoSVG until some real requirements come. (5) svg
line polyline use 'region.lineStyle' rather than 'region.itemStyle' (6) svg
text tspan image are enabled to trigger tooltip and user event (but not
supported to change state and style yet).
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/geo-svg
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 152ab8ec311e096110be2874a259c1d573d24698
Author: 100pah <su...@gmail.com>
AuthorDate: Sun Mar 21 22:37:59 2021 +0800
fix: [geo]
(1) fix contain point calculation.
(2) remove Geo['_nameCoordMap'], instead, calculate center on demand.
(3) fix that some API missing nameProperty and geoJSON should cached not only by mapName but also by nameProperty.
(4) do not support nameMap in geoSVG until some real requirements come.
(5) svg line polyline use 'region.lineStyle' rather than 'region.itemStyle'
(6) svg text tspan image are enabled to trigger tooltip and user event (but not supported to change state and style yet).
---
src/component/helper/MapDraw.ts | 216 +++++++++++++++++++++++++++-----------
src/coord/View.ts | 2 +
src/coord/geo/Geo.ts | 30 +++---
src/coord/geo/GeoJSONResource.ts | 23 ++--
src/coord/geo/GeoModel.ts | 12 ++-
src/coord/geo/GeoSVGResource.ts | 158 +++++++++++++++++++++-------
src/coord/geo/geoCreator.ts | 9 +-
src/coord/geo/geoSourceManager.ts | 2 +-
src/coord/geo/geoTypes.ts | 28 ++++-
src/data/OrdinalMeta.ts | 2 +-
src/model/mixin/lineStyle.ts | 2 +-
test/geo-svg.html | 112 ++++++++++++++------
12 files changed, 425 insertions(+), 171 deletions(-)
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index 8be9155..738edb5 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -29,7 +29,7 @@ import ExtensionAPI from '../../core/ExtensionAPI';
import GeoModel, { GeoCommonOptionMixin, GeoItemStyleOption } from '../../coord/geo/GeoModel';
import MapSeries from '../../chart/map/MapSeries';
import GlobalModel from '../../model/Global';
-import { Payload, ECElement } from '../../util/types';
+import { Payload, ECElement, LineStyleOption } from '../../util/types';
import GeoView from '../geo/GeoView';
import MapView from '../../chart/map/MapView';
import Geo from '../../coord/geo/Geo';
@@ -38,11 +38,14 @@ import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
import { getECData } from '../../util/innerStore';
import { createOrUpdatePatternFromDecal } from '../../util/decal';
import { ViewCoordSysTransformInfoPart } from '../../coord/View';
-import { GeoSVGResource } from '../../coord/geo/GeoSVGResource';
+import { GeoSVGGraphicRecord, GeoSVGResource } from '../../coord/geo/GeoSVGResource';
import Displayable from 'zrender/src/graphic/Displayable';
-import Element, { ElementTextConfig } from 'zrender/src/Element';
+import { ElementTextConfig } from 'zrender/src/Element';
import List from '../../data/List';
import { GeoJSONRegion } from '../../coord/geo/Region';
+import { RegionGraphic } from '../../coord/geo/geoTypes';
+import { ItemStyleProps } from '../../model/mixin/itemStyle';
+import { LineStyleProps } from '../../model/mixin/lineStyle';
interface RegionsGroup extends graphic.Group {
@@ -58,6 +61,11 @@ interface ViewBuildContext {
transformInfoRaw: ViewCoordSysTransformInfoPart;
}
+interface GeoStyleableOption {
+ itemStyle?: GeoItemStyleOption;
+ lineStyle?: LineStyleOption;
+}
+
function getFixedItemStyle(model: Model<GeoItemStyleOption>) {
const itemStyle = model.getItemStyle();
const areaColor = model.get('areaColor');
@@ -98,7 +106,7 @@ class MapDraw {
private _svgGroup: graphic.Group;
- private _svgRegionElements: Displayable[];
+ private _svgRegionGraphics: GeoSVGGraphicRecord['regionGraphics'];
constructor(api: ExtensionAPI) {
@@ -244,10 +252,15 @@ class MapDraw {
});
const centerPt = transformPoint(region.getCenter());
-
- this._resetSingleRegionGraphic(
- viewBuildCtx, compoundPath, regionGroup, region.name, centerPt, null
- );
+ const regionGraphic: RegionGraphic = {
+ name: region.name,
+ el: compoundPath,
+ styleOptionKey: 'itemStyle',
+ stateTrigger: regionGroup,
+ eventTrigger: regionGroup,
+ useLabel: true
+ };
+ this._resetSingleRegionGraphic(viewBuildCtx, regionGraphic, centerPt, null, false);
regionsGroup.add(regionGroup);
@@ -268,76 +281,72 @@ class MapDraw {
this._useSVG(mapName);
}
- zrUtil.each(this._svgRegionElements, function (el: Displayable) {
+ zrUtil.each(this._svgRegionGraphics, function (regionGraphic) {
// Note that we also allow different elements have the same name.
// For example, a glyph of a city and the label of the city have
// the same name and their tooltip info can be defined in a single
// region option.
this._resetSingleRegionGraphic(
- viewBuildCtx, el, el, el.name, [0, 0], 'inside'
+ viewBuildCtx, regionGraphic, [0, 0], 'inside',
+ // 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.
+ true
);
}, this);
}
private _resetSingleRegionGraphic(
viewBuildCtx: ViewBuildContext,
- displayable: Displayable,
- elForStateChange: Element,
- regionName: string,
+ regionGraphic: RegionGraphic,
labelXY: number[],
- labelPosition: ElementTextConfig['position']
+ labelPosition: ElementTextConfig['position'],
+ noZ2EmphasisLift: boolean
): void {
+ const regionName = regionGraphic.name;
const mapOrGeoModel = viewBuildCtx.mapOrGeoModel;
const data = viewBuildCtx.data;
const isVisualEncodedByVisualMap = viewBuildCtx.isVisualEncodedByVisualMap;
const isGeo = viewBuildCtx.isGeo;
- const regionModel = mapOrGeoModel.getRegionModel(regionName) || mapOrGeoModel;
-
- // @ts-ignore FIXME:TS fix the "compatible with each other"?
- const itemStyleModel = regionModel.getModel('itemStyle');
- // @ts-ignore FIXME:TS fix the "compatible with each other"?
- const emphasisModel = regionModel.getModel('emphasis');
- const emphasisItemStyleModel = emphasisModel.getModel('itemStyle');
- // @ts-ignore FIXME:TS fix the "compatible with each other"?
- const blurItemStyleModel = regionModel.getModel(['blur', 'itemStyle']);
- // @ts-ignore FIXME:TS fix the "compatible with each other"?
- const selectItemStyleModel = regionModel.getModel(['select', 'itemStyle']);
-
- // NOTE: DONT use 'style' in visual when drawing map.
- // This component is used for drawing underlying map for both geo component and map series.
- const itemStyle = getFixedItemStyle(itemStyleModel);
- const emphasisItemStyle = getFixedItemStyle(emphasisItemStyleModel);
- const blurItemStyle = getFixedItemStyle(blurItemStyleModel);
- const selectItemStyle = getFixedItemStyle(selectItemStyleModel);
-
- let dataIdx;
+ const dataIdx = data ? data.indexOfName(regionName) : null;
+ const regionModel = mapOrGeoModel.getRegionModel(regionName);
+ const styles = makeStyleForRegion(regionGraphic.styleOptionKey, regionModel);
+
// Use the itemStyle in data if has data
- if (data) {
- dataIdx = data.indexOfName(regionName);
+ if (styles && styles.styleOptionKey === 'itemStyle' && data) {
// Only visual color of each item will be used. It can be encoded by visualMap
// But visual color of series is used in symbol drawing
- //
+
// Visual color for each series is for the symbol draw
const style = data.getItemVisual(dataIdx, 'style');
const decal = data.getItemVisual(dataIdx, 'decal');
if (isVisualEncodedByVisualMap && style.fill) {
- itemStyle.fill = style.fill;
+ styles.normal.fill = style.fill;
}
if (decal) {
- itemStyle.decal = createOrUpdatePatternFromDecal(decal, viewBuildCtx.api);
+ styles.normal.decal = createOrUpdatePatternFromDecal(decal, viewBuildCtx.api);
}
}
- displayable.setStyle(itemStyle);
- displayable.style.strokeNoScale = true;
- displayable.culling = true;
+ // PENDING: SVG text, tspan and image can be named but not supporeted
+ // to be styled by region option yet.
+ if (styles && regionGraphic.el instanceof graphic.Path) {
+ regionGraphic.el.setStyle(styles.normal);
+ regionGraphic.el.style.strokeNoScale = true;
+ regionGraphic.el.ensureState('emphasis').style = styles.emphasis;
+ regionGraphic.el.ensureState('select').style = styles.select;
+ regionGraphic.el.ensureState('blur').style = styles.blur;
+ }
- displayable.ensureState('emphasis').style = emphasisItemStyle;
- displayable.ensureState('blur').style = blurItemStyle;
- displayable.ensureState('select').style = selectItemStyle;
+ if (regionGraphic.el instanceof Displayable) {
+ regionGraphic.el.culling = true;
+ }
+ if (noZ2EmphasisLift) {
+ (regionGraphic.el as ECElement).z2EmphasisLift = 0;
+ }
let showLabel = false;
for (let i = 0; i < DISPLAY_STATES.length; i++) {
@@ -357,10 +366,13 @@ class MapDraw {
// In the following cases label will be drawn
// 1. In map series and data value is NaN
// 2. In geo component
- // 4. Region has no series legendSymbol, which will be add a showLabel flag in mapSymbolLayout
+ // 3. Region has no series legendSymbol, which will be add a showLabel flag in mapSymbolLayout
if (
- (isGeo || isDataNaN && (showLabel))
- || (itemLayout && itemLayout.showLabel)
+ regionGraphic.useLabel
+ && (
+ ((isGeo || isDataNaN) && showLabel)
+ || (itemLayout && itemLayout.showLabel)
+ )
) {
const query = !isGeo ? dataIdx : regionName;
let labelFetcher;
@@ -391,21 +403,31 @@ class MapDraw {
} }
);
- displayable.setTextContent(textEl);
- displayable.setTextConfig({
+ regionGraphic.el.setTextContent(textEl);
+ regionGraphic.el.setTextConfig({
local: true,
insideFill: textEl.style.fill,
position: labelPosition
});
-
- (displayable as ECElement).disableLabelAnimation = true;
+ (regionGraphic.el as ECElement).disableLabelAnimation = true;
+ }
+ else {
+ regionGraphic.el.removeTextContent();
+ regionGraphic.el.removeTextConfig();
+ (regionGraphic.el as ECElement).disableLabelAnimation = null;
}
-
// setItemGraphicEl, setHoverStyle after all polygons and labels
// are added to the rigionGroup
if (data) {
- data.setItemGraphicEl(dataIdx, elForStateChange);
+ // FIXME: when series-map use a SVG map, and there are duplicated name specified
+ // on different SVG elements, after `data.setItemGraphicEl(...)`:
+ // (1) all of them will be mounted with `dataIndex`, `seriesIndex`, so that tooltip
+ // can be triggered only mouse hover. That's correct.
+ // (2) only the last element will be kept in `data`, so that if trigger tooltip
+ // by `dispatchAction`, only the last one can be found and triggered. That might be
+ // not correct. We will fix it in future if anyone demanding that.
+ data.setItemGraphicEl(dataIdx, regionGraphic.eventTrigger);
}
// series-map will not trigger "geoselectchange" no matter it is
// based on a declared geo component. Becuause series-map will
@@ -413,9 +435,8 @@ class MapDraw {
// If users call `chart.dispatchAction({type: 'toggleSelect'})`,
// it not easy to also fire event "geoselectchanged".
else {
- const regionModel = mapOrGeoModel.getRegionModel(regionName);
// Package custom mouse event for geo component
- getECData(displayable).eventData = {
+ getECData(regionGraphic.eventTrigger).eventData = {
componentType: 'geo',
componentIndex: mapOrGeoModel.componentIndex,
geoIndex: mapOrGeoModel.componentIndex,
@@ -424,10 +445,25 @@ class MapDraw {
};
}
- // @ts-ignore FIXME:TS fix the "compatible with each other"?
- elForStateChange.highDownSilentOnTouch = !!mapOrGeoModel.get('selectedMode');
- enableHoverEmphasis(elForStateChange, emphasisModel.get('focus'), emphasisModel.get('blurScope'));
+ if (!data) {
+ graphic.setTooltipConfig({
+ el: regionGraphic.el,
+ componentModel: mapOrGeoModel,
+ itemName: regionName,
+ // @ts-ignore FIXME:TS fix the "compatible with each other"?
+ itemTooltipOption: regionModel.get('tooltip')
+ });
+ }
+ if (regionGraphic.stateTrigger) {
+ // @ts-ignore FIXME:TS fix the "compatible with each other"?
+ regionGraphic.stateTrigger.highDownSilentOnTouch = !!mapOrGeoModel.get('selectedMode');
+ // @ts-ignore FIXME:TS fix the "compatible with each other"?
+ const emphasisModel = regionModel.getModel('emphasis');
+ enableHoverEmphasis(
+ regionGraphic.stateTrigger, emphasisModel.get('focus'), emphasisModel.get('blurScope')
+ );
+ }
}
remove(): void {
@@ -447,7 +483,7 @@ class MapDraw {
if (resource && resource.type === 'geoSVG') {
const svgGraphic = (resource as GeoSVGResource).useGraphic(this.uid);
this._svgGroup.add(svgGraphic.root);
- this._svgRegionElements = svgGraphic.regionElements;
+ this._svgRegionGraphics = svgGraphic.regionGraphics;
this._svgMapName = mapName;
}
}
@@ -461,7 +497,7 @@ class MapDraw {
if (resource && resource.type === 'geoSVG') {
(resource as GeoSVGResource).freeGraphic(this.uid);
}
- this._svgRegionElements = null;
+ this._svgRegionGraphics = null;
this._svgGroup.removeAll();
this._svgMapName = null;
}
@@ -516,7 +552,7 @@ class MapDraw {
}, this);
controller.setPointerChecker(function (e, x, y) {
- return geo.getViewRectAfterRoam().contain(x, y)
+ return geo.containPoint([x, y])
&& !onIrrelevantElement(e, api, mapOrGeoModel);
});
}
@@ -563,4 +599,60 @@ function labelTextAfterUpdate(this: graphic.Text) {
m[3] /= scaleY;
}
+function makeStyleForRegion(
+ styleOptionKey: RegionGraphic['styleOptionKey'],
+ regionModel: Model<
+ GeoStyleableOption & {
+ emphasis?: GeoStyleableOption;
+ select?: GeoStyleableOption;
+ blur?: GeoStyleableOption;
+ }
+ >
+): {
+ styleOptionKey: 'itemStyle';
+ normal: ItemStyleProps;
+ emphasis: ItemStyleProps;
+ select: ItemStyleProps;
+ blur: ItemStyleProps;
+} | {
+ styleOptionKey: 'lineStyle';
+ normal: LineStyleProps;
+ emphasis: LineStyleProps;
+ select: LineStyleProps;
+ blur: LineStyleProps;
+} {
+ if (!styleOptionKey) {
+ return;
+ }
+
+ const normalStyleModel = regionModel.getModel(styleOptionKey);
+ const emphasisStyleModel = regionModel.getModel(['emphasis', styleOptionKey]);
+ const blurStyleModel = regionModel.getModel(['blur', styleOptionKey]);
+ const selectStyleModel = regionModel.getModel(['select', styleOptionKey]);
+
+ // NOTE: DONT use 'style' in visual when drawing map.
+ // This component is used for drawing underlying map for both geo component and map series.
+ if (styleOptionKey === 'itemStyle') {
+ return {
+ styleOptionKey,
+ normal: getFixedItemStyle(normalStyleModel),
+ emphasis: getFixedItemStyle(emphasisStyleModel),
+ select: getFixedItemStyle(selectStyleModel),
+ blur: getFixedItemStyle(blurStyleModel)
+ };
+ }
+ else if (styleOptionKey === 'lineStyle') {
+ return {
+ styleOptionKey,
+ normal: normalStyleModel.getLineStyle(),
+ emphasis: emphasisStyleModel.getLineStyle(),
+ select: selectStyleModel.getLineStyle(),
+ blur: blurStyleModel.getLineStyle()
+ };
+ }
+}
+
export default MapDraw;
+
+
+// @ts-ignore FIXME:TS fix the "compatible with each other"?
diff --git a/src/coord/View.ts b/src/coord/View.ts
index 93fa411..f6a68f9 100644
--- a/src/coord/View.ts
+++ b/src/coord/View.ts
@@ -50,6 +50,8 @@ class View extends Transformable implements CoordinateSystemMaster, CoordinateSy
/**
* Represents the transform brought by roam/zoom.
+ * If `View['_viewRect']` applies roam transform,
+ * we can get the final displayed rect.
*/
private _roamTransformable = new Transformable();
/**
diff --git a/src/coord/geo/Geo.ts b/src/coord/geo/Geo.ts
index 1f29cc5..430bdf4 100644
--- a/src/coord/geo/Geo.ts
+++ b/src/coord/geo/Geo.ts
@@ -55,6 +55,7 @@ class Geo extends View {
readonly map: string;
readonly resourceType: GeoResource['type'];
+ // Only store specified name coord via `addGeoCoord`.
private _nameCoordMap: zrUtil.HashMap<number[]>;
private _regionsMap: zrUtil.HashMap<Region>;
private _invertLongitute: boolean;
@@ -71,6 +72,7 @@ class Geo extends View {
opt: {
// Specify name alias
nameMap?: NameMap;
+ nameProperty?: string;
aspectScale?: number;
}
) {
@@ -78,13 +80,12 @@ class Geo extends View {
this.map = map;
- const source = geoSourceManager.load(map, opt.nameMap);
+ const source = geoSourceManager.load(map, opt.nameMap, opt.nameProperty);
const resource = geoSourceManager.getGeoResource(map);
this.resourceType = resource ? resource.type : null;
const defaultParmas = GEO_DEFAULT_PARAMS[resource.type];
- this._nameCoordMap = source.nameCoordMap;
this._regionsMap = source.regionsMap;
this._invertLongitute = defaultParmas.invertLongitute;
this.regions = source.regions;
@@ -97,16 +98,17 @@ class Geo extends View {
/**
* Whether contain the given [lng, lat] coord.
*/
- containCoord(coord: number[]) {
- const regions = this.regions;
- for (let i = 0; i < regions.length; i++) {
- const region = regions[i];
- if (region.type === 'geoJSON' && (region as GeoJSONRegion).contain(coord)) {
- return true;
- }
- }
- return false;
- }
+ // Never used yet.
+ // containCoord(coord: number[]) {
+ // const regions = this.regions;
+ // for (let i = 0; i < regions.length; i++) {
+ // const region = regions[i];
+ // if (region.type === 'geoJSON' && (region as GeoJSONRegion).contain(coord)) {
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
protected _transformTo(x: number, y: number, width: number, height: number): void {
let rect = this.getBoundingRect();
@@ -162,7 +164,9 @@ class Geo extends View {
* Get geoCoord by name
*/
getGeoCoord(name: string): number[] {
- return this._nameCoordMap.get(name);
+ const region = this._regionsMap.get(name);
+ // calcualte center only on demand.
+ return this._nameCoordMap.get(name) || (region && region.getCenter());
}
dataToPoint(data: number[], noRoam?: boolean, out?: number[]): number[] {
diff --git a/src/coord/geo/GeoJSONResource.ts b/src/coord/geo/GeoJSONResource.ts
index e5aea61..9a5fbb4 100644
--- a/src/coord/geo/GeoJSONResource.ts
+++ b/src/coord/geo/GeoJSONResource.ts
@@ -30,6 +30,8 @@ import { GeoJSONRegion } from './Region';
import { GeoJSON, GeoJSONCompressed, GeoJSONSourceInput, GeoResource, GeoSpecialAreas, NameMap } from './geoTypes';
+const DEFAULT_NAME_PROPERTY = 'name' as const;
+
export class GeoJSONResource implements GeoResource {
readonly type = 'geoJSON';
@@ -37,10 +39,10 @@ export class GeoJSONResource implements GeoResource {
private _specialAreas: GeoSpecialAreas;
private _mapName: string;
- private _parsed: {
+ private _parsedMap = createHashMap<{
regions: GeoJSONRegion[];
boundingRect: BoundingRect;
- };
+ }, string>();
constructor(
mapName: string,
@@ -54,19 +56,24 @@ export class GeoJSONResource implements GeoResource {
this._geoJSON = parseInput(geoJSON);
}
+ /**
+ * @param nameMap can be null/undefined
+ * @param nameProperty can be null/undefined
+ */
load(nameMap: NameMap, nameProperty: string) {
- let parsed = this._parsed;
+ nameProperty = nameProperty || DEFAULT_NAME_PROPERTY;
+
+ let parsed = this._parsedMap.get(nameProperty);
if (!parsed) {
const rawRegions = this._parseToRegions(nameProperty);
- parsed = this._parsed = {
+ parsed = this._parsedMap.set(nameProperty, {
regions: rawRegions,
boundingRect: calculateBoundingRect(rawRegions)
- };
+ });
}
const regionsMap = createHashMap<GeoJSONRegion>();
- const nameCoordMap = createHashMap<ReturnType<GeoJSONRegion['getCenter']>>();
const finalRegions: GeoJSONRegion[] = [];
each(parsed.regions, function (region) {
@@ -79,14 +86,12 @@ export class GeoJSONResource implements GeoResource {
finalRegions.push(region);
regionsMap.set(regionName, region);
- nameCoordMap.set(regionName, region.getCenter());
});
return {
regions: finalRegions,
boundingRect: parsed.boundingRect || new BoundingRect(0, 0, 0, 0),
- regionsMap: regionsMap,
- nameCoordMap: nameCoordMap
+ regionsMap: regionsMap
};
}
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index d18a249..96d14c3 100644
--- a/src/coord/geo/GeoModel.ts
+++ b/src/coord/geo/GeoModel.ts
@@ -61,7 +61,7 @@ interface GeoLabelFormatterDataParams {
export interface RegoinOption extends GeoStateOption, StatesOptionMixin<GeoStateOption> {
name?: string
selected?: boolean
- tooltip?: Partial<Pick<CommonTooltipOption<GeoTooltipFormatterParams>, 'show'>>
+ tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>
}
export interface GeoTooltipFormatterParams {
@@ -93,6 +93,7 @@ export interface GeoCommonOptionMixin extends RoamOptionMixin {
boundingCoords?: number[][];
nameMap?: NameMap;
+ nameProperty?: string;
}
export interface GeoOption extends
@@ -227,15 +228,16 @@ class GeoModel extends ComponentModel<GeoOption> {
optionUpdated(): void {
const option = this.option;
- const self = this;
- option.regions = geoCreator.getFilledRegions(option.regions, option.map, option.nameMap);
+ option.regions = geoCreator.getFilledRegions(
+ option.regions, option.map, option.nameMap, option.nameProperty
+ );
const selectedMap: Dictionary<boolean> = {};
- this._optionModelMap = zrUtil.reduce(option.regions || [], function (optionModelMap, regionOpt) {
+ this._optionModelMap = zrUtil.reduce(option.regions || [], (optionModelMap, regionOpt) => {
const regionName = regionOpt.name;
if (regionName) {
- optionModelMap.set(regionName, new Model(regionOpt, self));
+ optionModelMap.set(regionName, new Model(regionOpt, this, this.ecModel));
if (regionOpt.selected) {
selectedMap[regionName] = true;
}
diff --git a/src/coord/geo/GeoSVGResource.ts b/src/coord/geo/GeoSVGResource.ts
index 0099161..8162879 100644
--- a/src/coord/geo/GeoSVGResource.ts
+++ b/src/coord/geo/GeoSVGResource.ts
@@ -17,22 +17,41 @@
* under the License.
*/
-import {parseSVG, makeViewBoxTransform} from 'zrender/src/tool/parseSVG';
+import { parseSVG, makeViewBoxTransform, SVGNodeTagLower } from 'zrender/src/tool/parseSVG';
import Group from 'zrender/src/graphic/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
-import {assert, createHashMap, HashMap} from 'zrender/src/core/util';
+import {assert, createHashMap, HashMap, hasOwn} from 'zrender/src/core/util';
import BoundingRect from 'zrender/src/core/BoundingRect';
-import { GeoResource, GeoSVGGraphicRoot, GeoSVGSourceInput, NameMap } from './geoTypes';
+import { GeoResource, GeoSVGGraphicRoot, GeoSVGSourceInput, RegionGraphic } from './geoTypes';
import { parseXML } from 'zrender/src/tool/parseXML';
-import Displayable from 'zrender/src/graphic/Displayable';
import { GeoSVGRegion } from './Region';
-interface GeoSVGGraphicRecord {
+export interface GeoSVGGraphicRecord {
root: Group;
boundingRect: BoundingRect;
- regionElements: Displayable[];
+ regionGraphics: RegionGraphic[];
}
+const REGION_AVAILABLE_SVG_TAG_MAP = createHashMap<number, SVGNodeTagLower>([
+ 'rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'text', 'tspan', 'path'
+]);
+const STYLE_OPTION_KEY = createHashMap<'itemStyle' | 'lineStyle', SVGNodeTagLower>({
+ 'rect': 'itemStyle',
+ 'circle': 'itemStyle',
+ 'line': 'lineStyle',
+ 'ellipse': 'itemStyle',
+ 'polygon': 'itemStyle',
+ 'polyline': 'lineStyle',
+ // 'image': '?', // TODO
+ // 'text': '?', // TODO
+ // 'tspan': '?', // TODO
+ 'path': 'itemStyle'
+});
+const LABEL_HOST_MAP = createHashMap<number, SVGNodeTagLower>([
+ 'rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'path'
+]);
+
+
export class GeoSVGResource implements GeoResource {
readonly type = 'geoSVG';
@@ -44,8 +63,6 @@ export class GeoSVGResource implements GeoResource {
private _regions: GeoSVGRegion[] = [];
// Key: region.name
private _regionsMap: HashMap<GeoSVGRegion> = createHashMap<GeoSVGRegion>();
- // Key: region.name
- private _nameCoordMap: HashMap<number[]> = createHashMap<number[]>();
// All used graphics. key: hostKey, value: root
private _usedGraphicMap: HashMap<GeoSVGGraphicRecord> = createHashMap();
@@ -67,7 +84,7 @@ export class GeoSVGResource implements GeoResource {
this._parsedXML = parseXML(svg);
}
- load(nameMap: NameMap, nameProperty: string) {
+ load(/* nameMap: NameMap */) {
// In the "load" stage, graphic need to be built to
// get boundingRect for geo coordinate system.
let firstGraphic = this._firstGraphic;
@@ -84,41 +101,41 @@ export class GeoSVGResource implements GeoResource {
this._boundingRect = this._firstGraphic.boundingRect.clone();
- // Create resions only for the first graphic, see coments below.
- const regionElements = firstGraphic.regionElements;
- for (let i = 0; i < regionElements.length; i++) {
- const el = regionElements[i];
-
- // Try use the alias in geoNameMap
- let regionName = el.name;
- if (nameMap && nameMap.hasOwnProperty(regionName)) {
- regionName = nameMap[regionName];
- }
-
- const region = new GeoSVGRegion(regionName, el);
-
+ const regionGraphics = firstGraphic.regionGraphics;
+ // PENDING: `nameMap` will not be supported until some real requirement come.
+ // if (nameMap) {
+ // regionGraphics = applyNameMap(regionGraphics, nameMap);
+ // }
+
+ // Create resions only for the first graphic.
+ for (let i = 0; i < regionGraphics.length; i++) {
+ const regionGraphic = regionGraphics[i];
+ const region = new GeoSVGRegion(regionGraphic.name, regionGraphic.el);
+ // PENDING: if `nameMap` supported, this region can not be mounted on
+ // `this`, but can only be created each time `load()` called.
this._regions.push(region);
- this._regionsMap.set(regionName, region);
+ this._regionsMap.set(regionGraphic.name, region);
}
}
return {
boundingRect: this._boundingRect,
regions: this._regions,
- regionsMap: this._regionsMap,
- nameCoordMap: this._nameCoordMap
+ regionsMap: this._regionsMap
};
}
- // Consider:
- // (1) One graphic element can not be shared by different `geoView` running simultaneously.
- // Notice, also need to consider multiple echarts instances share a `mapRecord`.
- // (2) Converting SVG to graphic elements is time consuming.
- // (3) In the current architecture, `load` should be called frequently to get boundingRect,
- // and it is called without view info.
- // So we maintain graphic elements in this module, and enables `view` to use/return these
- // graphics from/to the pool with it's uid.
- useGraphic(hostKey: string): GeoSVGGraphicRecord {
+ /**
+ * Consider:
+ * (1) One graphic element can not be shared by different `geoView` running simultaneously.
+ * Notice, also need to consider multiple echarts instances share a `mapRecord`.
+ * (2) Converting SVG to graphic elements is time consuming.
+ * (3) In the current architecture, `load` should be called frequently to get boundingRect,
+ * and it is called without view info.
+ * So we maintain graphic elements in this module, and enables `view` to use/return these
+ * graphics from/to the pool with it's uid.
+ */
+ useGraphic(hostKey: string /*, nameMap: NameMap */): GeoSVGGraphicRecord {
const usedRootMap = this._usedGraphicMap;
let svgGraphic = usedRootMap.get(hostKey);
@@ -130,7 +147,17 @@ export class GeoSVGResource implements GeoResource {
// use the first boundingRect to avoid duplicated boundingRect calculation.
|| buildGraphic(this._parsedXML, this._boundingRect);
- return usedRootMap.set(hostKey, svgGraphic);
+ usedRootMap.set(hostKey, svgGraphic);
+
+ // PENDING: `nameMap` will not be supported until some real requirement come.
+ // `nameMap` can only be obtained from echarts option.
+ // The original `regionGraphics` must not be modified.
+ // if (nameMap) {
+ // svgGraphic = extend({}, svgGraphic);
+ // svgGraphic.regionGraphics = applyNameMap(svgGraphic.regionGraphics, nameMap);
+ // }
+
+ return svgGraphic;
}
freeGraphic(hostKey: string): void {
@@ -203,9 +230,60 @@ function buildGraphic(
(root as GeoSVGGraphicRoot).isGeoSVGGraphicRoot = true;
- return {
- root: root,
- boundingRect: boundingRect,
- regionElements: result.namedElements
- };
+ const regionGraphics = [] as GeoSVGGraphicRecord['regionGraphics'];
+ const named = result.named;
+ for (let i = 0; i < named.length; i++) {
+ const namedItem = named[i];
+ const svgNodeTagLower = namedItem.svgNodeTagLower;
+
+ if (REGION_AVAILABLE_SVG_TAG_MAP.get(svgNodeTagLower) != null) {
+ const styleOptionKey = STYLE_OPTION_KEY.get(svgNodeTagLower);
+ const el = namedItem.el;
+
+ regionGraphics.push({
+ name: namedItem.name,
+ el: el,
+ styleOptionKey: styleOptionKey,
+ stateTrigger: styleOptionKey != null ? el : null,
+ // text/tspan/image do not suport style but support event.
+ eventTrigger: el,
+ useLabel: LABEL_HOST_MAP.get(svgNodeTagLower) != null
+ });
+
+ // Only named element has silent: false, other elements should
+ // act as background and has no user interaction.
+ el.silent = false;
+ // text|tspan will be converted to group.
+ if (el.isGroup) {
+ el.traverse(child => {
+ child.silent = false;
+ });
+ }
+ }
+ }
+
+ return { root, boundingRect, regionGraphics };
}
+
+
+// PENDING: `nameMap` will not be supported until some real requirement come.
+// /**
+// * Use the alias in geoNameMap.
+// * The input `regionGraphics` must not be modified.
+// */
+// function applyNameMap(
+// regionGraphics: GeoSVGGraphicRecord['regionGraphics'],
+// nameMap: NameMap
+// ): GeoSVGGraphicRecord['regionGraphics'] {
+// const result = [] as GeoSVGGraphicRecord['regionGraphics'];
+// for (let i = 0; i < regionGraphics.length; i++) {
+// let regionGraphic = regionGraphics[i];
+// const name = regionGraphic.name;
+// if (nameMap && nameMap.hasOwnProperty(name)) {
+// regionGraphic = extend({}, regionGraphic);
+// regionGraphic.name = name;
+// }
+// result.push(regionGraphic);
+// }
+// return result;
+// }
diff --git a/src/coord/geo/geoCreator.ts b/src/coord/geo/geoCreator.ts
index 49ae8d5..618d098 100644
--- a/src/coord/geo/geoCreator.ts
+++ b/src/coord/geo/geoCreator.ts
@@ -141,6 +141,7 @@ class GeoCreator implements CoordinateSystemCreator {
const geo = new Geo(name + idx, name, {
nameMap: geoModel.get('nameMap'),
+ nameProperty: geoModel.get('nameProperty'),
aspectScale: geoModel.get('aspectScale')
});
@@ -186,6 +187,7 @@ class GeoCreator implements CoordinateSystemCreator {
const geo = new Geo(mapType, mapType, {
nameMap: zrUtil.mergeAll(nameMapList),
+ nameProperty: mapSeries[0].get('nameProperty'),
aspectScale: mapSeries[0].get('aspectScale')
});
@@ -213,7 +215,10 @@ class GeoCreator implements CoordinateSystemCreator {
* Fill given regions array
*/
getFilledRegions(
- originRegionArr: RegoinOption[], mapName: string, nameMap?: NameMap
+ originRegionArr: RegoinOption[],
+ mapName: string,
+ nameMap: NameMap,
+ nameProperty: string
): RegoinOption[] {
// Not use the original
const regionsArr = (originRegionArr || []).slice();
@@ -223,7 +228,7 @@ class GeoCreator implements CoordinateSystemCreator {
dataNameMap.set(regionsArr[i].name, regionsArr[i]);
}
- const source = geoSourceManager.load(mapName, nameMap);
+ const source = geoSourceManager.load(mapName, nameMap, nameProperty);
zrUtil.each(source.regions, function (region) {
const name = region.name;
!dataNameMap.get(name) && regionsArr.push({name: name});
diff --git a/src/coord/geo/geoSourceManager.ts b/src/coord/geo/geoSourceManager.ts
index f13d9ec..4cb5fb8 100644
--- a/src/coord/geo/geoSourceManager.ts
+++ b/src/coord/geo/geoSourceManager.ts
@@ -131,7 +131,7 @@ export default {
&& (resource as GeoJSONResource).getMapForUser();
},
- load: function (mapName: string, nameMap: NameMap, nameProperty?: string): ReturnType<GeoResource['load']> {
+ load: function (mapName: string, nameMap: NameMap, nameProperty: string): ReturnType<GeoResource['load']> {
const resource = storage.get(mapName);
if (!resource) {
diff --git a/src/coord/geo/geoTypes.ts b/src/coord/geo/geoTypes.ts
index 303db25..773cf1c 100644
--- a/src/coord/geo/geoTypes.ts
+++ b/src/coord/geo/geoTypes.ts
@@ -19,8 +19,9 @@
import BoundingRect from 'zrender/src/core/BoundingRect';
import { HashMap } from 'zrender/src/core/util';
-import { Group } from '../../util/graphic';
+import { Group, Path } from '../../util/graphic';
import { Region } from './Region';
+import Element from 'zrender/src/Element';
export type GeoSVGSourceInput = 'string' | Document | SVGElement;
@@ -125,16 +126,35 @@ interface GeoJSONGeometryMultiPolygonCompressed {
export interface GeoResource {
readonly type: 'geoJSON' | 'geoSVG';
- load(nameMap: NameMap, nameProperty: string): {
+ load(
+ nameMap: NameMap,
+ nameProperty: string
+ ): {
boundingRect: BoundingRect;
regions: Region[];
// Key: region.name
regionsMap: HashMap<Region>;
- // Key: region.name
- nameCoordMap: HashMap<number[]>;
};
}
export interface GeoSVGGraphicRoot extends Group {
isGeoSVGGraphicRoot: boolean;
}
+
+export type RegionGraphic = {
+ // Region name. Can not be null/undefined.
+ name: string;
+ // Main el.
+ el: Element;
+ // If it specified, use it to trigger state
+ // style change (emphasis/select/blur)
+ // Can be null/undefined.
+ stateTrigger: Element;
+ // If it specified, use it to trigger event to users
+ // Can be null/undefined.
+ eventTrigger: Element;
+ // Whether to set label on `el.textContent`.
+ useLabel: boolean;
+ // Use this key to obtain style config in echarts option.
+ styleOptionKey: 'itemStyle' | 'lineStyle';
+};
diff --git a/src/data/OrdinalMeta.ts b/src/data/OrdinalMeta.ts
index 511d54f..f2fd790 100644
--- a/src/data/OrdinalMeta.ts
+++ b/src/data/OrdinalMeta.ts
@@ -113,7 +113,7 @@ class OrdinalMeta {
// Consider big data, do not create map until needed.
private _getOrCreateMap(): HashMap<OrdinalNumber> {
return this._map || (
- this._map = createHashMap(this.categories)
+ this._map = createHashMap<OrdinalNumber>(this.categories)
);
}
}
diff --git a/src/model/mixin/lineStyle.ts b/src/model/mixin/lineStyle.ts
index 168102e..712b2fc 100644
--- a/src/model/mixin/lineStyle.ts
+++ b/src/model/mixin/lineStyle.ts
@@ -54,7 +54,7 @@ type LineStyleKeys = 'lineWidth'
| 'lineJoin'
| 'miterLimit';
-type LineStyleProps = Pick<PathStyleProps, LineStyleKeys>;
+export type LineStyleProps = Pick<PathStyleProps, LineStyleKeys>;
class LineStyleMixin {
diff --git a/test/geo-svg.html b/test/geo-svg.html
index 86d4961..2d52f33 100644
--- a/test/geo-svg.html
+++ b/test/geo-svg.html
@@ -49,20 +49,34 @@ under the License.
<script>
- function listenAndPrintSelectChanged(chart) {
+ function listenAndPrintEvent(chart) {
if (!chart) {
return;
}
const out = {
};
chart.on('geoselectchanged', function (params) {
- out.allSelected = params.allSelected;
- console.log('geoselectechanged');
+ out.geoselectechanged = {
+ allSelected: params.allSelected
+ };
+ console.log('geoselectechanged', params);
chart.__testHelper.updateInfo(out, 'event');
});
chart.on('selectchanged', function (params) {
- out.selected = params.selected;
- console.log('selectechanged');
+ out.selectechanged = {
+ selected: params.selected
+ };
+ console.log('selectechanged', params);
+ chart.__testHelper.updateInfo(out, 'event');
+ });
+ chart.on('click', function (params) {
+ out.click = {
+ componentIndex: params.componentIndex,
+ componentType: params.componentType,
+ geoIndex: params.geoIndex,
+ name: params.name
+ };
+ console.log('click', params);
chart.__testHelper.updateInfo(out, 'event');
});
}
@@ -124,7 +138,7 @@ under the License.
height: 300
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
});
</script>
@@ -176,7 +190,7 @@ under the License.
height: 300
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
});
</script>
@@ -247,7 +261,7 @@ under the License.
// recordCanvas: true,
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
});
@@ -313,7 +327,7 @@ under the License.
// recordCanvas: true,
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
});
@@ -383,7 +397,7 @@ under the License.
// recordCanvas: true,
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
});
@@ -416,18 +430,28 @@ under the License.
itemStyle: {
color: null
},
+ tooltip: {
+ show: true,
+ confine: true,
+ formatter: function (params) {
+ return [
+ 'This is the introduction:',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx',
+ 'xxxxxxxxxxxxxxxxxxxxx'
+ ].join('<br>');
+ }
+ },
emphasis: {
- // itemStyle: {
- // borderColor: 'red',
- // borderWidth: 5
- // },
- // areaStyle: {
- // borderColor: 'red',
- // borderWidth: 5
- // },
label: {
- textBorderColor: '#fff',
- textBorderWidth: 2
+ show: false
}
},
select: {
@@ -435,33 +459,55 @@ under the License.
color: '#b50205'
},
label: {
- show: false,
- textBorderColor: '#fff',
- textBorderWidth: 2
+ show: false
}
},
+ regions: [{
+ name: 'Sikeloi',
+ tooltip: {
+ formatter: 'Sikeloi',
+ textStyle: { color: '#555' },
+ backgroundColor: '#ccc'
+ }
+ }, {
+ name: 'Sikanoi',
+ tooltip: {
+ formatter: 'Sikanoi',
+ textStyle: { color: '#555' },
+ backgroundColor: '#ccc'
+ }
+ }, {
+ name: 'Elymoi',
+ tooltip: {
+ formatter: 'Elymoi',
+ textStyle: { color: '#555' },
+ backgroundColor: '#ccc'
+ }
+ }],
z: 0
}],
- series: {
- type: 'map',
- selectedMode: 'multiple',
- coordinateSystem: 'geo',
- geoIndex: 0
- }
+ // series: {
+ // type: 'map',
+ // selectedMode: 'multiple',
+ // coordinateSystem: 'geo',
+ // geoIndex: 0
+ // }
};
var chart = testHelper.create(echarts, 'main_geo_svg_regions', {
title: [
- 'map series on declared geo with svg resource',
- 'Hover seat: check **tooltip** correct.'
+ 'symbol and label use the same name in SVG.',
+ 'Hover each symbol and text, tooltip should be displayed.',
+ 'Hover the three area, tooltip should be displayed.',
+ 'Click, check **selected**.'
],
option: option,
info: {},
infoKey: 'event',
- height: 400
+ height: 500
});
- listenAndPrintSelectChanged(chart);
+ listenAndPrintEvent(chart);
if (chart) {
chart.on('georoam', function (params) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 03/04: Merge branch 'master' into fix/geo-svg
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/geo-svg
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 886d041461bad2fbcf0997398d8a53c66011ba7b
Merge: 86522a1 88d2ad7
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Mar 17 21:34:12 2021 +0800
Merge branch 'master' into fix/geo-svg
LICENSE | 9 +-
build/addHeader.js | 8 +-
build/dev-fast.js | 69 +-
dist/echarts.common.js | 11349 ++++++++++++---
dist/echarts.common.js.map | 2 +-
dist/echarts.common.min.js | 2 +-
dist/echarts.esm.js | 21511 ++++++++++++++++++++++------
dist/echarts.esm.js.map | 2 +-
dist/echarts.esm.min.js | 2 +-
dist/echarts.js | 21511 ++++++++++++++++++++++------
dist/echarts.js.map | 2 +-
dist/echarts.min.js | 2 +-
dist/echarts.simple.js | 7981 +++++++++--
dist/echarts.simple.js.map | 2 +-
dist/echarts.simple.min.js | 2 +-
dist/extension/bmap.js | 67 +-
dist/extension/bmap.js.map | 2 +-
dist/extension/dataTool.js | 68 +-
dist/extension/dataTool.js.map | 2 +-
package-lock.json | 60 +-
package.json | 8 +-
src/chart/custom/install.ts | 7 +-
src/chart/graph/GraphSeries.ts | 5 +-
src/chart/line/LineView.ts | 13 +-
src/chart/sankey/SankeySeries.ts | 6 +-
src/chart/sankey/SankeyView.ts | 10 +-
src/chart/treemap/TreemapView.ts | 13 +-
src/component/axis/AxisBuilder.ts | 34 +-
src/component/brush/BrushModel.ts | 5 +
src/component/dataZoom/SliderZoomView.ts | 5 +-
src/component/graphic/install.ts | 16 +-
src/component/legend/LegendModel.ts | 5 +
src/component/legend/LegendView.ts | 26 +-
src/component/marker/MarkAreaView.ts | 29 +-
src/component/marker/MarkLineModel.ts | 4 +-
src/component/toolbox/ToolboxModel.ts | 3 +-
src/component/toolbox/ToolboxView.ts | 28 +-
src/component/toolbox/feature/DataZoom.ts | 27 +-
src/component/tooltip/TooltipView.ts | 154 +-
src/core/echarts.ts | 61 +-
src/export/core.ts | 12 +-
src/export/option.ts | 27 +-
src/i18n/langCS.ts | 142 +
src/i18n/langFR.ts | 48 +-
src/loading/default.ts | 4 +-
src/model/Series.ts | 4 +-
src/util/ECEventProcessor.ts | 4 +-
src/util/format.ts | 2 +-
src/util/graphic.ts | 56 +-
src/util/innerStore.ts | 17 +-
src/util/model.ts | 68 +-
src/util/types.ts | 48 +-
src/view/Chart.ts | 6 +-
src/view/Component.ts | 4 +-
test/gauge-case.html | 93 +
test/line-endLabel.html | 6 +-
test/line-non-continuous.html | 75 +
test/loading.html | 46 +
test/runTest/actions/__meta__.json | 1 +
test/tooltip-component.html | 467 +
test/treemap-action.html | 416 +
test/types/basic.ts | 2 +-
test/types/event.ts | 23 +
63 files changed, 51824 insertions(+), 12859 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 02/04: fix: [geo] modified default item color for geoSVG
and some tweak.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/geo-svg
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 86522a1b54843e06562138caf00114561539caed
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Mar 17 21:32:29 2021 +0800
fix: [geo] modified default item color for geoSVG and some tweak.
---
src/component/helper/MapDraw.ts | 4 ++
src/coord/geo/GeoModel.ts | 19 ++++-
test/geo-svg.html | 150 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 167 insertions(+), 6 deletions(-)
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index e64631e..8be9155 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -269,6 +269,10 @@ class MapDraw {
}
zrUtil.each(this._svgRegionElements, function (el: Displayable) {
+ // Note that we also allow different elements have the same name.
+ // For example, a glyph of a city and the label of the city have
+ // the same name and their tooltip info can be defined in a single
+ // region option.
this._resetSingleRegionGraphic(
viewBuildCtx, el, el, el.name, [0, 0], 'inside'
);
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index 7fbccef..d18a249 100644
--- a/src/coord/geo/GeoModel.ts
+++ b/src/coord/geo/GeoModel.ts
@@ -39,6 +39,7 @@ import {
} from '../../util/types';
import { NameMap } from './geoTypes';
import GlobalModel from '../../model/Global';
+import geoSourceManager from './geoSourceManager';
export interface GeoItemStyleOption extends ItemStyleOption {
@@ -175,8 +176,11 @@ class GeoModel extends ComponentModel<GeoOption> {
itemStyle: {
borderWidth: 0.5,
- borderColor: '#444',
- color: '#eee'
+ borderColor: '#444'
+ // Default color:
+ // + geoJSON: #eee
+ // + geoSVG: null (use SVG original `fill`)
+ // color: '#eee'
},
emphasis: {
@@ -207,7 +211,16 @@ class GeoModel extends ComponentModel<GeoOption> {
};
init(option: GeoOption, parentModel: Model, ecModel: GlobalModel): void {
- super.init(option, parentModel, ecModel);
+ const source = geoSourceManager.getGeoResource(option.map);
+ if (source && source.type === 'geoJSON') {
+ const itemStyle = option.itemStyle = option.itemStyle || {};
+ if (!('color' in itemStyle)) {
+ itemStyle.color = '#eee';
+ }
+ }
+
+ this.mergeDefaultAndTheme(option, ecModel);
+
// Default label emphasis `show`
modelUtil.defaultEmphasis(option, 'label', ['show']);
}
diff --git a/test/geo-svg.html b/test/geo-svg.html
index 0994f51..86d4961 100644
--- a/test/geo-svg.html
+++ b/test/geo-svg.html
@@ -37,10 +37,12 @@ under the License.
- <div id="main_pure_geo_json"></div>
+ <div id="main_simple_geo_json"></div>
+ <div id="main_simple_geo_svg"></div>
<div id="main_pure_geo_svg"></div>
<div id="main_pure_map_svg"></div>
<div id="main_map_geo_svg"></div>
+ <div id="main_geo_svg_regions"></div>
@@ -68,6 +70,8 @@ under the License.
+
+
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
const testGeoJson1 = {
@@ -108,9 +112,9 @@ under the License.
}
};
- var chart = testHelper.create(echarts, 'main_pure_geo_json', {
+ var chart = testHelper.create(echarts, 'main_simple_geo_json', {
title: [
- 'pure geo geoJSON location:',
+ 'simple geo geoJSON location:',
'Should be a square and 80% of canvas height.',
'At the center of the canvas.'
],
@@ -127,6 +131,62 @@ under the License.
+
+
+
+
+
+ <script>
+ require(['echarts'/*, 'map/js/china' */], function (echarts) {
+ const svg = [
+ '<?xml version="1.0" encoding="utf-8"?>',
+ '<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" version="1.2" fill-rule="evenodd" xml:space="preserve">',
+ '<path d="M 0,0 L 0,100 100,100 100,0 Z" fill="none" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
+ '</svg>'
+ ].join('')
+
+ echarts.registerMap('testGeoSVG', { svg: svg });
+
+ option = {
+ tooltip: {
+ },
+ geo: {
+ map: 'testGeoSVG',
+ roam: true,
+ selectedMode: 'single',
+ // height: '100%',
+ // center
+ // layoutCenter: ['30%', 40],
+ // layoutSize: 40,
+ // boundingCoords
+ zoom: 1,
+ aspectScale: 1
+ }
+ };
+
+ var chart = testHelper.create(echarts, 'main_simple_geo_svg', {
+ title: [
+ 'simple geo geoSVG location:',
+ 'Should be a square and 80% of canvas height.',
+ 'At the center of the canvas.'
+ ],
+ option: option,
+ info: {},
+ infoKey: 'event',
+ height: 300
+ });
+
+ listenAndPrintSelectChanged(chart);
+
+ });
+ </script>
+
+
+
+
+
+
+
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
@@ -331,6 +391,90 @@ under the License.
</script>
+
+
+ <script>
+ require(['echarts'/*, 'map/js/china' */], function (echarts) {
+ var option;
+
+ $.ajax({
+ url: '../../vis-data/map/svg/geo-topo/Sicily_prehellenic_topographic_map.svg',
+ dataType: 'text'
+ }).done(function (svg) {
+
+ echarts.registerMap('sicily', {
+ svg: svg
+ });
+
+ option = {
+ tooltip: {
+ },
+ geo: [{
+ map: 'sicily',
+ roam: true,
+ selectedMode: 'multiple',
+ itemStyle: {
+ color: null
+ },
+ emphasis: {
+ // itemStyle: {
+ // borderColor: 'red',
+ // borderWidth: 5
+ // },
+ // areaStyle: {
+ // borderColor: 'red',
+ // borderWidth: 5
+ // },
+ label: {
+ textBorderColor: '#fff',
+ textBorderWidth: 2
+ }
+ },
+ select: {
+ itemStyle: {
+ color: '#b50205'
+ },
+ label: {
+ show: false,
+ textBorderColor: '#fff',
+ textBorderWidth: 2
+ }
+ },
+ z: 0
+ }],
+ series: {
+ type: 'map',
+ selectedMode: 'multiple',
+ coordinateSystem: 'geo',
+ geoIndex: 0
+ }
+ };
+
+ var chart = testHelper.create(echarts, 'main_geo_svg_regions', {
+ title: [
+ 'map series on declared geo with svg resource',
+ 'Hover seat: check **tooltip** correct.'
+ ],
+ option: option,
+ info: {},
+ infoKey: 'event',
+ height: 400
+ });
+
+ listenAndPrintSelectChanged(chart);
+
+ if (chart) {
+ chart.on('georoam', function (params) {
+ // console.log(params);
+ });
+ }
+
+ });
+
+ });
+ </script>
+
+
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 01/04: fix: [geo] tweak a little.
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/geo-svg
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit f2c35faa3eaddcb2a4aad7105c29619f0e45f4e5
Author: 100pah <su...@gmail.com>
AuthorDate: Fri Mar 12 01:32:08 2021 +0800
fix: [geo] tweak a little.
---
src/component/geo/GeoView.ts | 10 +--
src/component/helper/MapDraw.ts | 5 ++
src/coord/geo/GeoModel.ts | 21 +++++-
test/geo-svg.html | 156 +++++++++++++++++++++++++++++-----------
4 files changed, 142 insertions(+), 50 deletions(-)
diff --git a/src/component/geo/GeoView.ts b/src/component/geo/GeoView.ts
index a3e1c71..961b541 100644
--- a/src/component/geo/GeoView.ts
+++ b/src/component/geo/GeoView.ts
@@ -25,6 +25,7 @@ import ExtensionAPI from '../../core/ExtensionAPI';
import GeoModel from '../../coord/geo/GeoModel';
import { Payload, ZRElementEvent, ECEventData } from '../../util/types';
import { getECData } from '../../util/innerStore';
+import { findEventDispatcher } from '../../util/event';
class GeoView extends ComponentView {
@@ -66,12 +67,11 @@ class GeoView extends ComponentView {
}
private _handleRegionClick(e: ZRElementEvent) {
- let current = e.target;
let eventData: ECEventData;
- // TODO extract a util function
- while (current && (eventData = getECData(current).eventData) == null) {
- current = current.__hostTarget || current.parent;
- }
+
+ findEventDispatcher(e.target, current => {
+ return (eventData = getECData(current).eventData) != null;
+ }, true);
if (eventData) {
this._api.dispatchAction({
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index 15634f2..e64631e 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -403,6 +403,11 @@ class MapDraw {
if (data) {
data.setItemGraphicEl(dataIdx, elForStateChange);
}
+ // series-map will not trigger "geoselectchange" no matter it is
+ // based on a declared geo component. Becuause series-map will
+ // trigger "selectchange". If it trigger both the two events,
+ // If users call `chart.dispatchAction({type: 'toggleSelect'})`,
+ // it not easy to also fire event "geoselectchanged".
else {
const regionModel = mapOrGeoModel.getRegionModel(regionName);
// Package custom mouse event for geo component
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index 7095c6f..7fbccef 100644
--- a/src/coord/geo/GeoModel.ts
+++ b/src/coord/geo/GeoModel.ts
@@ -34,7 +34,8 @@ import {
RoamOptionMixin,
AnimationOptionMixin,
StatesOptionMixin,
- Dictionary
+ Dictionary,
+ CommonTooltipOption
} from '../../util/types';
import { NameMap } from './geoTypes';
import GlobalModel from '../../model/Global';
@@ -59,7 +60,15 @@ interface GeoLabelFormatterDataParams {
export interface RegoinOption extends GeoStateOption, StatesOptionMixin<GeoStateOption> {
name?: string
selected?: boolean
-};
+ tooltip?: Partial<Pick<CommonTooltipOption<GeoTooltipFormatterParams>, 'show'>>
+}
+
+export interface GeoTooltipFormatterParams {
+ componentType: 'geo'
+ geoIndex: number
+ name: string
+ $vars: ['name']
+}
export interface GeoCommonOptionMixin extends RoamOptionMixin {
// Map name
@@ -103,6 +112,8 @@ export interface GeoOption extends
selectedMode?: 'single' | 'multiple' | boolean
selectedMap?: Dictionary<boolean>
+
+ tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>
}
class GeoModel extends ComponentModel<GeoOption> {
@@ -188,7 +199,11 @@ class GeoModel extends ComponentModel<GeoOption> {
}
},
- regions: []
+ regions: [],
+
+ tooltip: {
+ show: false
+ }
};
init(option: GeoOption, parentModel: Model, ecModel: GlobalModel): void {
diff --git a/test/geo-svg.html b/test/geo-svg.html
index 70b6139..0994f51 100644
--- a/test/geo-svg.html
+++ b/test/geo-svg.html
@@ -37,14 +37,36 @@ under the License.
- <div id="main0"></div>
- <div id="main1"></div>
- <div id="main2"></div>
+ <div id="main_pure_geo_json"></div>
+ <div id="main_pure_geo_svg"></div>
+ <div id="main_pure_map_svg"></div>
+ <div id="main_map_geo_svg"></div>
+ <script>
+ function listenAndPrintSelectChanged(chart) {
+ if (!chart) {
+ return;
+ }
+ const out = {
+ };
+ chart.on('geoselectchanged', function (params) {
+ out.allSelected = params.allSelected;
+ console.log('geoselectechanged');
+ chart.__testHelper.updateInfo(out, 'event');
+ });
+ chart.on('selectchanged', function (params) {
+ out.selected = params.selected;
+ console.log('selectechanged');
+ chart.__testHelper.updateInfo(out, 'event');
+ });
+ }
+ </script>
+
+
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
@@ -70,6 +92,8 @@ under the License.
echarts.registerMap('testGeoJson1', testGeoJson1);
option = {
+ tooltip: {
+ },
geo: {
map: 'testGeoJson1',
roam: true,
@@ -84,29 +108,19 @@ under the License.
}
};
- var chart = testHelper.create(echarts, 'main0', {
+ var chart = testHelper.create(echarts, 'main_pure_geo_json', {
title: [
- 'geoJSON location:',
+ 'pure geo geoJSON location:',
'Should be a square and 80% of canvas height.',
'At the center of the canvas.'
],
option: option,
- info: [],
- infoKey: 'allSelected',
+ info: {},
+ infoKey: 'event',
height: 300
});
- if (chart) {
- if (chart) {
- chart.on('geoselectchanged', function (params) {
- chart.__testHelper.updateInfo(
- params.allSelected,
- 'allSelected'
- );
- });
- }
- }
-
+ listenAndPrintSelectChanged(chart);
});
</script>
@@ -126,6 +140,8 @@ under the License.
});
option = {
+ tooltip: {
+ },
geo: {
map: 'seatmap',
roam: true,
@@ -158,27 +174,20 @@ under the License.
// }
};
- var chart = testHelper.create(echarts, 'main1', {
+ var chart = testHelper.create(echarts, 'main_pure_geo_svg', {
title: [
- 'geo component with svg resource',
+ 'pure geo component with svg resource',
'click seat: check **allSelected** correct.'
],
option: option,
- info: [],
- infoKey: 'allSelected',
+ info: {},
+ infoKey: 'event',
height: 300
// buttons: [{text: 'btn-txt', onclick: function () {}}],
// recordCanvas: true,
});
- if (chart) {
- chart.on('geoselectchanged', function (params) {
- chart.__testHelper.updateInfo(
- params.allSelected,
- 'allSelected'
- );
- });
- }
+ listenAndPrintSelectChanged(chart);
});
@@ -231,27 +240,90 @@ under the License.
}
};
- var chart = testHelper.create(echarts, 'main2', {
+ var chart = testHelper.create(echarts, 'main_pure_map_svg', {
title: [
- 'map series with svg resource',
+ 'pure map series with svg resource',
'Hover seat: check **tooltip** correct.'
],
option: option,
- info: [],
- infoKey: 'allSelected',
+ info: {},
+ infoKey: 'event',
height: 300
// buttons: [{text: 'btn-txt', onclick: function () {}}],
// recordCanvas: true,
});
- if (chart) {
- chart.on('selectchanged', function (params) {
- chart.__testHelper.updateInfo(
- params.selected,
- 'selected'
- );
- });
- }
+ listenAndPrintSelectChanged(chart);
+
+ });
+
+ });
+ </script>
+
+
+
+
+
+ <script>
+ require(['echarts'/*, 'map/js/china' */], function (echarts) {
+ var option;
+ $.ajax({
+ url: '../../vis-data/map/svg/seats/seatmap-example.svg',
+ dataType: 'text'
+ }).done(function (svg) {
+
+ echarts.registerMap('seatmap', {
+ svg: svg
+ });
+
+ option = {
+ tooltip: {
+ },
+ geo: {
+ map: 'seatmap',
+ roam: true,
+ selectedMode: 'multiple',
+ // height: 100,
+ // zoom: 1.5
+ emphasis: {
+ label: {
+ textBorderColor: '#fff',
+ textBorderWidth: 2
+ }
+ },
+ select: {
+ itemStyle: {
+ color: '#b50205'
+ },
+ label: {
+ show: false,
+ textBorderColor: '#fff',
+ textBorderWidth: 2
+ }
+ }
+ },
+ series: {
+ type: 'map',
+ selectedMode: 'multiple',
+ coordinateSystem: 'geo',
+ geoIndex: 0
+ }
+ };
+
+ var chart = testHelper.create(echarts, 'main_map_geo_svg', {
+ title: [
+ 'map series on declared geo with svg resource',
+ 'Hover seat: check **tooltip** correct.'
+ ],
+ option: option,
+ info: {},
+ infoKey: 'event',
+ height: 300
+ // buttons: [{text: 'btn-txt', onclick: function () {}}],
+ // recordCanvas: true,
+ });
+
+ listenAndPrintSelectChanged(chart);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org