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/04/30 19:22:03 UTC
[echarts-doc] 02/10: doc: registerMap and geoselectchanged.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-doc.git
commit 7abd9217fb98df0cdfdc09a33f6422780ca355b8
Author: 100pah <su...@gmail.com>
AuthorDate: Tue Apr 27 02:24:37 2021 +0800
doc: registerMap and geoselectchanged.
---
en/api/echarts.md | 104 +++++++++++++++++++++++++++++++++++-------------------
en/api/events.md | 10 +++++-
zh/api/echarts.md | 98 ++++++++++++++++++++++++++++++++------------------
zh/api/events.md | 10 +++++-
4 files changed, 149 insertions(+), 73 deletions(-)
diff --git a/en/api/echarts.md b/en/api/echarts.md
index 1f6ede8..e6d6580 100644
--- a/en/api/echarts.md
+++ b/en/api/echarts.md
@@ -124,7 +124,24 @@ See [Use ECharts with bundler and NPM](tutorial.html#Use%20ECharts%20with%20bund
## registerMap(Function)
```js
-(mapName: string, geoJson: Object, specialAreas?: Object)
+(
+ mapName: string,
+ opt: {
+ geoJSON: Object | string;
+ specialAreas?: Object;
+ }
+)
+| (
+ mapName: string,
+ opt: {
+ svg: Object | string;
+ }
+)
+| (
+ mapName: string,
+ geoJSON: Object | string,
+ specialAreas?: Object
+)
```
Registers available maps. This can only be used after including [geo](option.html#geo) component or chart series of [map](option.html#series-map).
@@ -135,40 +152,48 @@ Please refer to [option.geo](option.html#geo.map) for usage.
Map name, referring to `map` value set in [geo](option.html#geo) component or [map](option.html#series-map).
-+ `geoJson`
-
- Data in GeoJson format. See [https://geojson.org/](https://geojson.org/) for more format information.
-
-+ `specialAreas`
-
- Optional; zoomed part of a specific area in the map for better visual effect.
-
- **For example [USA Population Estimates](${galleryEditorPath}map-usa): **
- ```js
-echarts.registerMap('USA', usaJson, {
- // Move Alaska to the bottom left of United States
- Alaska: {
- // Upper left longitude
- left: -131,
- // Upper left latitude
- top: 25,
- // Range of longitude
- width: 15
- },
- // Hawaii
- Hawaii: {
- left: -110,
- top: 28,
- width: 5
- },
- // Puerto Rico
- 'Puerto Rico': {
- left: -76,
- top: 26,
- width: 2
- }
-});
- ```
++ `opt`
+
+ + `geoJSON`
+
+ Optional; Data in GeoJson format. See [https://geojson.org/](https://geojson.org/) for more format information. Can be a JSON string or a parsed object. This key can also be `geoJson`.
+
+ + `svg`
+
+ Optional; Data in SVG format. Can be a SVG string or a parsed SVG DOM object. See more info in SVG_a_a_a_a_a.
+
+ + `specialAreas`
+
+ Optional; zoomed part of a specific area in the map for better visual effect.
+
+ Only work for `geoJSON`, not work for `svg`.
+
+ **For example [USA Population Estimates](${galleryEditorPath}map-usa): **
+ ```js
+ echarts.registerMap('USA', usaJson, {
+ // Move Alaska to the bottom left of United States
+ Alaska: {
+ // Upper left longitude
+ left: -131,
+ // Upper left latitude
+ top: 25,
+ // Range of longitude
+ width: 15
+ },
+ // Hawaii
+ Hawaii: {
+ left: -110,
+ top: 28,
+ width: 5
+ },
+ // Puerto Rico
+ 'Puerto Rico': {
+ left: -76,
+ top: 26,
+ width: 2
+ }
+ });
+ ```
## getMap(Function)
```js
@@ -179,13 +204,18 @@ Get a registered map in the following format:
```js
{
- // geoJson data of the map
- geoJson: Object,
+ // geoJSON data of the map
+ geoJSON: Object,
// special area, see registerMap() for more information
specialAreas: Object
}
```
+Note:
++ `geoJSON` can also be `geoJson`, they have the same reference.
++ SVG registered by `registerMap` can not be obtained by this method yet.
+
+
## registerTheme(Function)
```js
(themeName: string, theme: Object)
diff --git a/en/api/events.md b/en/api/events.md
index e71944b..8449bf1 100644
--- a/en/api/events.md
+++ b/en/api/events.md
@@ -480,7 +480,15 @@ It will be triggered when user clicks to select.
seriesId: string
// data name
name: name,
- // table of all selected data.
+ // list for each ${componentType} component.
+ allSelected: ({
+ ${componentType}Index: number
+ // selected names of each ${componentType} component.
+ name: string[]
+ })[],
+ // (deprecated).
+ // all selected data.
+ // status of different ${componentType} components will be merged.
selected: {
[name: string]: boolean
}
diff --git a/zh/api/echarts.md b/zh/api/echarts.md
index 295bae3..0d2872a 100644
--- a/zh/api/echarts.md
+++ b/zh/api/echarts.md
@@ -123,9 +123,26 @@ echarts.use(
## registerMap(Function)
```js
-(mapName: string, geoJson: Object, specialAreas?: Object)
+(
+ mapName: string,
+ opt: {
+ geoJSON: Object | string;
+ specialAreas?: Object;
+ }
+)
+| (
+ mapName: string,
+ opt: {
+ svg: Object | string;
+ }
+)
+| (
+ mapName: string,
+ geoJSON: Object | string,
+ specialAreas?: Object
+)
```
-注册可用的地图,必须在包括 [geo](option.html#geo) 组件或者 [map](option.html#series-map) 图表类型的时候才能使用。
+注册可用的地图,只在 [geo](option.html#geo) 组件或者 [map](option.html#series-map) 图表类型中使用。
使用方法见 [option.geo](option.html#geo.map)。
@@ -134,40 +151,48 @@ echarts.use(
地图名称,在 [geo](option.html#geo) 组件或者 [map](option.html#series-map) 图表类型中设置的 `map` 对应的就是该值。
-+ `geoJson`
++ `opt`
- GeoJson 格式的数据,具体格式见 [https://geojson.org/](https://geojson.org/)。
+ + `geoJSON`
-+ `specialAreas`
+ 可选。GeoJson 格式的数据,具体格式见 [https://geojson.org/](https://geojson.org/)。可以是 JSON 字符串,也可以是解析得到的对象。这个参数也可以写为 `geoJson`,效果相同。
- 可选。将地图中的部分区域缩放到合适的位置,可以使得整个地图的显示更加好看。
+ + `svg`
- **示例 [USA Population Estimates](${galleryEditorPath}map-usa):**
- ```js
-echarts.registerMap('USA', usaJson, {
- // 把阿拉斯加移到美国主大陆左下方
- Alaska: {
- // 左上角经度
- left: -131,
- // 左上角纬度
- top: 25,
- // 经度横跨的范围
- width: 15
- },
- // 夏威夷
- Hawaii: {
- left: -110,
- top: 28,
- width: 5
- },
- // 波多黎各
- 'Puerto Rico': {
- left: -76,
- top: 26,
- width: 2
- }
-});
- ```
+ 可选。SVG 格式的数据。可以是字符串,也可以是解析得到的 SVG DOM 对象。更多信息参见 SVG_a_a_a_a_a 。
+
+ + `specialAreas`
+
+ 可选。将地图中的部分区域缩放到合适的位置,可以使得整个地图的显示更加好看。
+
+ 只在 `geoJSON` 中生效,`svg` 中不生效。
+
+ **示例 [USA Population Estimates](${galleryEditorPath}map-usa):**
+ ```js
+ echarts.registerMap('USA', usaJson, {
+ // 把阿拉斯加移到美国主大陆左下方
+ Alaska: {
+ // 左上角经度
+ left: -131,
+ // 左上角纬度
+ top: 25,
+ // 经度横跨的范围
+ width: 15
+ },
+ // 夏威夷
+ Hawaii: {
+ left: -110,
+ top: 28,
+ width: 5
+ },
+ // 波多黎各
+ 'Puerto Rico': {
+ left: -76,
+ top: 26,
+ width: 2
+ }
+ });
+ ```
## getMap(Function)
@@ -178,13 +203,18 @@ echarts.registerMap('USA', usaJson, {
```js
{
- // 地图的 geoJson 数据
- geoJson: Object,
+ // 地图的 geoJSON 数据
+ geoJSON: Object,
// 地图的特殊区域,见 registerMap
specialAreas: Object
}
```
+注:
++ `geoJSON` 也可写为 `geoJson`,二者引用的是相同的内容。
++ 对于 `registerMap` 所注册的 SVG ,暂并不支持从此方法中返回。
+
+
## registerTheme(Function)
```js
(themeName: string, theme: Object)
diff --git a/zh/api/events.md b/zh/api/events.md
index 0bd1e39..7b09c29 100644
--- a/zh/api/events.md
+++ b/zh/api/events.md
@@ -466,10 +466,18 @@ chart.on('finished', function () {
{
type: '${componentType}selectchanged',
// 系列 ID,可以在 option 中传入
- seriesId: string
+ seriesId: string,
// 数据名称
name: name,
+ // 每个 ${componentType} 组件的选中信息列表。
+ allSelected: ({
+ ${componentType}Index: number
+ // 每个 ${componentType} 组件上选中的名称列表。
+ name: string[]
+ })[],
+ // 不推荐使用此属性。
// 所有数据的选中状态表。
+ // 不同 ${componentType} 组件的状态会被合并在一起。
selected: {
[name: string]: boolean
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org