gridviz 2.0.31 → 2.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -1
- package/dist/gridviz.js +28 -1
- package/dist/gridviz.min.js +1 -1
- package/package.json +1 -1
- package/src/App.js +27 -0
package/README.md
CHANGED
|
@@ -49,9 +49,44 @@ npm install gridviz
|
|
|
49
49
|
then
|
|
50
50
|
|
|
51
51
|
```javascript
|
|
52
|
-
gridviz
|
|
52
|
+
import * as gridviz from 'gridviz'
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
Or you can cherry-pick only the modules that you need, for example:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import { App, SquareColorWGLStyle } from 'gridviz'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Basic example
|
|
62
|
+
|
|
63
|
+
Here’s a basic example that loads a CSV file of a European population grid (5km resolution):
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
let myApp = new gridviz.App(containerDiv)
|
|
67
|
+
//set position and zoom
|
|
68
|
+
.setGeoCenter({ x: 4500000, y: 2900000 })
|
|
69
|
+
.setZoomFactor(3000)
|
|
70
|
+
//add CSV layer
|
|
71
|
+
.addCSVGridLayer(
|
|
72
|
+
//data URL
|
|
73
|
+
'https://raw.githubusercontent.com/eurostat/gridviz/master/assets/csv/Europe/pop_2018_5km.csv',
|
|
74
|
+
//resolution, in CRS unit (m)
|
|
75
|
+
5000,
|
|
76
|
+
//the style
|
|
77
|
+
[
|
|
78
|
+
new gridviz.SquareColorWGLStyle({
|
|
79
|
+
//the CSV column to show
|
|
80
|
+
colorCol: 'Population',
|
|
81
|
+
//value to [0,1] mapping function
|
|
82
|
+
tFun: (value) => gridviz.sExp(Math.min(value / 100000, 1), -15),
|
|
83
|
+
}),
|
|
84
|
+
]
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
See the **[documentation page](https://eurostat.github.io/gridviz/docs/reference)** for more information.
|
|
89
|
+
|
|
55
90
|
### standalone
|
|
56
91
|
|
|
57
92
|
```javascript
|