Skip to content

Commit 06bdd5a

Browse files
author
Stacey Gammon
committed
update maps readme
1 parent fccdb4a commit 06bdd5a

File tree

1 file changed

+4
-42
lines changed
  • x-pack/legacy/plugins/maps/public/embeddable

1 file changed

+4
-42
lines changed

x-pack/legacy/plugins/maps/public/embeddable/README.md

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
```
3232
const factory = new MapEmbeddableFactory();
3333
const input = {
34-
layerList: [], // where layerList is same as saved object layerListJSON property (unstringified)
35-
title: 'my map',
3634
hideFilterActions: true,
3735
isLayerTOCOpen: false,
3836
openTOCDetails: ['tfi3f', 'edh66'],
3937
mapCenter: { lat: 0.0, lon: 0.0, zoom: 7 }
4038
}
4139
const mapEmbeddable = await factory.create(input, parent);
40+
// where layerList is same as saved object layerListJSON property (unstringified))
41+
mapEmbeddable.setLayerList([]);
4242
```
4343

4444
#### Customize tooltip
@@ -61,6 +61,7 @@ const renderTooltipContent = ({ addFilters, closeTooltip, features, isLocked, lo
6161
}
6262
6363
const mapEmbeddable = await factory.create(input, parent)
64+
mapEmbeddable.setLayerList(layerList);
6465
mapEmbeddable.setRenderTooltipContent(renderTooltipContent);
6566
```
6667

@@ -80,6 +81,7 @@ const eventHandlers = {
8081
}
8182
8283
const mapEmbeddable = await factory.create(input, parent);
84+
mapEmbeddable.setLayerList(layerList);
8385
mapEmbeddable.setRenderTooltipContent(renderTooltipContent);
8486
mapEmbeddable.setEventHandlers(eventHandlers);
8587
```
@@ -92,46 +94,6 @@ Geojson sources will not update unless you modify `__featureCollection` property
9294
```
9395
const factory = new MapEmbeddableFactory();
9496
const input = {
95-
layerList: [
96-
{
97-
'id': 'gaxya',
98-
'label': 'My geospatial data',
99-
'minZoom': 0,
100-
'maxZoom': 24,
101-
'alpha': 1,
102-
'sourceDescriptor': {
103-
'id': 'b7486',
104-
'type': 'GEOJSON_FILE',
105-
'__featureCollection': {
106-
"type": "FeatureCollection",
107-
"features": [
108-
{
109-
"type": "Feature",
110-
"geometry": {
111-
"type": "Polygon",
112-
"coordinates": [
113-
[
114-
[0, 0], [10, 10], [10, 0], [0, 0]
115-
]
116-
]
117-
},
118-
"properties": {
119-
"name": "null island",
120-
"another_prop": "something else interesting"
121-
}
122-
}
123-
]
124-
}
125-
},
126-
'visible': true,
127-
'style': {
128-
'type': 'VECTOR',
129-
'properties': {}
130-
},
131-
'type': 'VECTOR'
132-
}
133-
],
134-
title: 'my map',
13597
hideFilterActions: true,
13698
isLayerTOCOpen: false,
13799
openTOCDetails: ['tfi3f', 'edh66'],

0 commit comments

Comments
 (0)