Skip to content

Commit 413e394

Browse files
authored
replace deprecated APIs of ScatterplotLayer in documentation (visgl#2706)
1 parent b82c47d commit 413e394

File tree

12 files changed

+29
-28
lines changed

12 files changed

+29
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ npm install deck.gl
3030

3131
deck.gl offers an extensive catalog of pre-packaged visualization "layers", including [ScatterplotLayer](http://deck.gl/#/documentation/deckgl-api-reference/layers/scatterplot-layer), [ArcLayer](http://deck.gl/#/documentation/deckgl-api-reference/layers/arc-layer), [TextLayer](http://deck.gl/#/documentation/deckgl-api-reference/layers/text-layer), [GeoJsonLayer](http://deck.gl/#/documentation/deckgl-api-reference/layers/geojson-layer), etc. The input to a layer is usually an array of JSON objects. Each layer offers highly-flexible API to customize how the data should be rendered.
3232

33-
Example constructing a deck.gl ScatterplotLayer:
33+
Example constructing a deck.gl ScatterplotLayer:
3434

3535
```js
3636
import {ScatterplotLayer} from '@deck.gl/layers';
@@ -50,7 +50,7 @@ const scatterplotLayer = new ScatterplotLayer({
5050
data: 'https://github.com/uber-common/deck.gl-data/blob/master/website/bart-stations.json',
5151
getRadius: d => Math.sqrt(d.entries) / 100,
5252
getPosition: d => d.coordinates,
53-
getColor: [255, 228, 0],
53+
getFillColor: [255, 228, 0],
5454
});
5555
```
5656

dev-docs/RFCs/v7.x/binary-data-rfc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ new ScatterplotLayer({
4646
data,
4747
getPosition: d => d.position,
4848
getRadius: d => d.radius,
49-
getColor: d => d.color
49+
getFillColor: d => d.color
5050
});
5151
```
5252

@@ -68,7 +68,7 @@ new ScatterplotLayer({
6868
getRadius: (object, {index, data}) => {
6969
return data.src[index * 6 + 2];
7070
},
71-
getColor: (object, {index, data, target}) => {
71+
getFillColor: (object, {index, data, target}) => {
7272
target[0] = data.src[index * 6 + 3];
7373
target[1] = data.src[index * 6 + 4];
7474
target[2] = data.src[index * 6 + 5];

docs/api-reference/layer.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,27 @@ Sometimes `data` remains the same, but the outcome of an accessor has changed. I
244244
```js
245245
const layer = new ScatterplotLayer({
246246
... // Other props
247-
getColor: d => d.male ? maleColor : femaleColor
247+
getFillColor: d => d.male ? maleColor : femaleColor
248248
});
249249
```
250250

251-
In this case, you need to explicitly inform deck.gl to re-evaluate `getColor` for all data items. You do so by defining `updateTriggers`:
251+
In this case, you need to explicitly inform deck.gl to re-evaluate `getFillColor` for all data items. You do so by defining `updateTriggers`:
252252

253253
```js
254254
const layer = new ScatterplotLayer({
255255
... // Other props
256-
getColor: d => d.male ? maleColor : femaleColor,
256+
getFillColor: d => d.male ? maleColor : femaleColor,
257257
updateTriggers: {
258-
getColor: [maleColor, femaleColor]
258+
getFillColor: [maleColor, femaleColor]
259259
}
260260
});
261261
```
262262

263263
`updateTriggers` expect an object whose keys are names of accessor props of this layer, and values are one or more variables that affect the output of the accessors.
264264

265-
For example, `updateTriggers.getColor` is a list of variables that affect the output of
266-
`getColor`. If either value in the array changes, all attributes that depend on
267-
`getColor` will be updated.
265+
For example, `updateTriggers.getFillColor` is a list of variables that affect the output of
266+
`getFillColor`. If either value in the array changes, all attributes that depend on
267+
`getFillColor` will be updated.
268268
The variables may be numbers, strings, objects or functions. During each rendering cycle, deck.gl shallow-compares them with the previous values.
269269

270270

docs/api-reference/mapbox/mapbox-layer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const deck = new Deck({
5959
],
6060
getPosition: d => d.position,
6161
getRadius: d => d.size,
62-
getColor: [255, 0, 0]
62+
getFillColor: [255, 0, 0]
6363
})
6464
]
6565
});
@@ -77,7 +77,7 @@ deck.setProps({
7777
],
7878
getPosition: d => d.position,
7979
getRadius: d => d.size,
80-
getColor: [0, 0, 255]
80+
getFillColor: [0, 0, 255]
8181
})
8282
]
8383
});

docs/api-reference/mapbox/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class App extends React.Component {
121121
],
122122
getPosition: d => d.position,
123123
getRadius: d => d.size,
124-
getColor: [255, 0, 0]
124+
getFillColor: [255, 0, 0]
125125
})
126126
];
127127

docs/developer-guide/composite-layers.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,23 @@ class NiceScatterplotLayer extends CompositeLayer {
9595
new ScatterplotLayer({
9696
...this.props,
9797
id: 'fill',
98-
getColor: this.props.getFillColor,
99-
outline: false,
98+
getFillColor: this.props.getFillColor,
99+
filled: true,
100100
updateTriggers: {
101101
...updateTrigger,
102-
getColor: updateTrigger.getFillColor
102+
getFillColor: updateTrigger.getFillColor
103103
}
104104
}),
105105
// the outlines
106106
new ScatterplotLayer({
107107
...this.props,
108108
id: 'outline',
109-
getColor: this.props.getStrokeColor,
110-
outline: true,
109+
getLineColor: this.props.getStrokeColor,
110+
stroked: true,
111+
filled: false,
111112
updateTriggers: {
112113
...updateTrigger,
113-
getColor: updateTrigger.getStrokeColor
114+
getLineColor: updateTrigger.getStrokeColor
114115
}
115116
})
116117
];

docs/get-started/interactivity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const deck = new Deck({
5454
],
5555
getPosition: d => d.position,
5656
getRadius: 1000,
57-
getColor: [255, 255, 0],
57+
getFillColor: [255, 255, 0],
5858
// Enable picking
5959
pickable: true,
6060
// Update tooltip
@@ -101,7 +101,7 @@ class App extends React.Component {
101101
],
102102
getPosition: d => d.position,
103103
getRadius: 1000,
104-
getColor: [255, 255, 0],
104+
getFillColor: [255, 255, 0],
105105
// Enable picking
106106
pickable: true,
107107
// Update app state

examples/experimental/json-common/examples/dot-text.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"data": [
1111
{"position": [-122.45, 37.8]}
1212
],
13-
"getColor": [255, 0, 0, 255],
13+
"getFillColor": [255, 0, 0, 255],
1414
"getRadius": 1000
1515
}, {
1616
"type": "TextLayer",

examples/experimental/json-common/examples/line.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"data": "https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/line/airports.json",
2424
"radiusScale": 20,
2525
"getPosition": "coordinates",
26-
"getColor": [255, 140, 0],
26+
"getFillColor": [255, 140, 0],
2727
"getRadius": 60
2828
},
2929
{

examples/experimental/json-common/examples/scatterplot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"radiusScale": 30,
2222
"radiusMinPixels": 0.25,
2323
"getPosition": "-",
24-
"getColor": [0, 128, 255],
24+
"getFillColor": [0, 128, 255],
2525
"getRadius": 1
2626
}
2727
]

0 commit comments

Comments
 (0)