2
2
// SPDX-License-Identifier: MIT
3
3
// Copyright (c) vis.gl contributors
4
4
5
- import React , { Component } from 'react' ;
6
- import { MAPBOX_STYLES , DATA_URI , GITHUB_TREE } from '../constants/defaults' ;
7
- import { readableInteger } from '../utils/format-utils' ;
5
+ import React , { Component } from 'react' ;
6
+ import { MAPBOX_STYLES , DATA_URI , GITHUB_TREE } from '../constants/defaults' ;
7
+ import { readableInteger } from '../utils/format-utils' ;
8
8
import App from 'website-examples/scatterplot/app' ;
9
9
10
- import { makeExample } from '../components' ;
10
+ import { makeExample } from '../components' ;
11
11
12
12
class ScatterPlotDemo extends Component {
13
13
static title = 'Every Person in New York City' ;
14
14
15
15
static code = `${ GITHUB_TREE } /examples/website/scatterplot` ;
16
16
17
+ static hasDeviceTabs = true ;
18
+
17
19
static data = {
18
20
url : `${ DATA_URI } /scatterplot-data.txt` ,
19
21
worker : '/workers/scatterplot-data-decoder.js'
20
22
} ;
21
23
22
24
static parameters = {
23
- colorM : { displayName : 'Male' , type : 'color' , value : [ 0 , 128 , 255 ] } ,
24
- colorF : { displayName : 'Female' , type : 'color' , value : [ 255 , 0 , 128 ] } ,
25
- radius : { displayName : 'Radius' , type : 'range' , value : 10 , step : 0.1 , min : 1 , max : 20 }
25
+ colorM : { displayName : 'Male' , type : 'color' , value : [ 0 , 128 , 255 ] } ,
26
+ colorF : { displayName : 'Female' , type : 'color' , value : [ 255 , 0 , 128 ] } ,
27
+ radius : { displayName : 'Radius' , type : 'range' , value : 10 , step : 0.1 , min : 1 , max : 20 }
26
28
} ;
27
29
28
30
static mapStyle = MAPBOX_STYLES . LIGHT ;
@@ -43,11 +45,12 @@ class ScatterPlotDemo extends Component {
43
45
}
44
46
45
47
render ( ) {
46
- const { params, data} = this . props ;
48
+ const { params, data } = this . props ;
47
49
48
50
return (
49
51
< App
50
- { ...this . props }
52
+ key = { this . props . device ?. type }
53
+ device = { this . props . device }
51
54
data = { data }
52
55
maleColor = { params . colorM . value }
53
56
femaleColor = { params . colorF . value }
0 commit comments