@@ -159,49 +159,86 @@ Registers available maps. This can only be used after including [geo](option.htm
159159
160160Please refer to [option .geo ](option .html #geo .map ) for usage .
161161
162- ** Parameters **
163- + ` mapName `
162+ ** Parameters : **
163+ + ** @ param ` mapName ` : **
164164
165165 Map name , referring to ` map ` value set in [geo ](option .html #geo ) component or [map ](option .html #series - map ).
166166
167- + ` opt `
167+ + ** @ param ` opt.geoJSON ` : **
168168
169- + ` 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`.
169+ 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`.
170170
171- + ` svg ` Optional . Data in SVG format . Can be a SVG string or a parsed SVG DOM object . See more info in [SVG Base Map ](tutorial .html #SVG % 20Base % 20Map % 20in % 20Geo % 20Coords % 20and % 20Map % 20SeriesSVG % 20Base % 20Map ). Introduced in v5 .1.0
171+ For example , A minimal geoJSON :
172+ ` ` ` ts
173+ const geoJSONSample = {
174+ "type": "FeatureCollection",
175+ "features": [
176+ {
177+ "type": "Feature",
178+ "geometry": {
179+ "type": "Polygon",
180+ "coordinates": [
181+ [[200, 3000], [500, 3000], [500, 5000], [200, 5000]]
182+ ]
183+ },
184+ "properties": {
185+ "name": "Some Place",
186+ "cp": [220, 2100]
187+ }
188+ }
189+ ]
190+ };
191+ echarts.registerMap('my_geo_sample', {geoJSON: geoJSONSample});
192+ ` ` `
193+ Note :
194+ + ` features[i].properties.name ` in GeoJSON is required by ECharts to query the corresponding region , or display the label . Property ` name ` is used by default , but can also be other properties , see [geo .nameProperty ](option .html #geo .nameProperty ).
195+ + ` features[i].properties.cp ` is an optional property that ECharts can recoganize . It provides coordinates on which the label can be displayed . If not provided , the label will be displayed at the center of the region .
172196
173- + ` specialAreas ` Optional . zoomed part of a specific area in the map for better visual effect . Only work for ` geoJSON ` .
197+ + ** @ param ` opt.svg ` : **
174198
175- ** For example [USA Population Estimates ]($ {galleryEditorPath }map - usa ): **
176- ` ` ` ts
177- echarts.registerMap('USA', usaJson, {
178- // Move Alaska to the bottom left of United States
179- Alaska: {
180- // Upper left longitude
181- left: -131,
182- // Upper left latitude
183- top: 25,
184- // Range of longitude
185- width: 15
186- },
187- // Hawaii
188- Hawaii: {
189- left: -110,
190- top: 28,
191- width: 5
192- },
193- // Puerto Rico
194- 'Puerto Rico': {
195- left: -76,
196- top: 26,
197- width: 2
198- }
199- });
200- ` ` `
199+ Optional . Data in SVG format . Can be a SVG string or a parsed SVG DOM object . See more info in [SVG Base Map ](tutorial .html #SVG % 20Base % 20Map % 20in % 20Geo % 20Coords % 20and % 20Map % 20SeriesSVG % 20Base % 20Map ). Introduced in ` v5.1.0 ` .
201200
202- Note :
201+ For example , A minimal SVG :
202+ ` ` ` ts
203+ const mySVG = ` < ? xml version = " 1.0" encoding = " utf-8" ? >
204+ < svg xmlns = " http://www.w3.org/2000/svg" xmlns : ooo = " http://xml.openoffice.org/svg/export" xmlns : xlink = " http://www.w3.org/1999/xlink" version = " 1.2" fill - rule = " evenodd" xml :space = " preserve" >
205+ < path name = " left_rect" d = " M 0,0 L 0,100 100,100 100,0 Z" fill = " #765" stroke = " rgb(56,93,138)" stroke - width = " 0" stroke - linecap = " square" stroke - linejoin = " miter" / >
206+ < / svg > ` ;
207+ echarts.registerMap('my_geo_sample', {svg: mySVG});
208+ ` ` `
209+
210+ + ** @param ` opt.specialAreas ` :**
211+
212+ Optional . zoomed part of a specific area in the map for better visual effect . Only work for ` geoJSON ` .
213+
214+ ** [An example of specialAreas ]($ {galleryEditorPath }map - usa ): **
215+ ` ` ` ts
216+ echarts.registerMap('USA', usaJson, {
217+ // Move Alaska to the bottom left of United States
218+ Alaska: {
219+ // Upper left longitude
220+ left: -131,
221+ // Upper left latitude
222+ top: 25,
223+ // Range of longitude
224+ width: 15
225+ },
226+ // Hawaii
227+ Hawaii: {
228+ left: -110,
229+ top: 28,
230+ width: 5
231+ },
232+ // Puerto Rico
233+ 'Puerto Rico': {
234+ left: -76,
235+ top: 26,
236+ width: 2
237+ }
238+ });
239+ ` ` `
203240
204- If you only import the required components in your project , starting from v5 .3.0 ` registerMap ` has to be used after the ` MapChart ` or ` GeoComponent ` is imported .
241+ Note : If you only import the required components in your project , starting from v5 .3.0 ` registerMap ` cannot be called unless ` MapChart ` or ` GeoComponent ` is imported ( ES module import ) .
205242
206243## getMap (Function )
207244` ` ` ts
0 commit comments