gridviz 3.0.15 → 3.0.17
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 +127 -128
- package/dist/gridviz.js +7958 -7861
- package/dist/gridviz.min.js +1 -1
- package/package.json +74 -74
- package/src/button/ZoomButtons.js +101 -96
- package/src/core/Dataset.js +154 -157
- package/src/core/Drawable.js +60 -61
- package/src/core/GeoCanvas.js +409 -370
- package/src/core/Layer.js +23 -25
- package/src/core/Legend.js +108 -110
- package/src/core/Map.js +494 -495
- package/src/core/MultiResolutionDataset.js +93 -97
- package/src/core/Style.js +98 -99
- package/src/dataset/CSVGrid.js +112 -112
- package/src/dataset/GeoTIFF.js +122 -123
- package/src/dataset/JSGrid.js +55 -54
- package/src/dataset/TiledGrid.js +289 -288
- package/src/dataset/worker.js +18 -0
- package/src/index.js +77 -71
- package/src/layer/BackgroundLayer.js +162 -158
- package/src/layer/BackgroundLayerImage.js +81 -84
- package/src/layer/BackgroundLayerWMS.js +104 -108
- package/src/layer/GeoJSONLayer.js +214 -220
- package/src/layer/GridLayer.js +148 -157
- package/src/layer/LabelLayer.js +194 -193
- package/src/legend/ColorCategoryLegend.js +109 -110
- package/src/legend/ColorDiscreteLegend.js +100 -102
- package/src/legend/ColorLegend.js +115 -118
- package/src/legend/OrientationLegend.js +89 -91
- package/src/legend/SizeLegend.js +224 -224
- package/src/legend/TernaryLegend.js +302 -210
- package/src/style/CompositionStyle.js +291 -288
- package/src/style/DotDensityStyle.js +133 -134
- package/src/style/ImageStyle.js +100 -102
- package/src/style/IsoFenceStyle.js +217 -203
- package/src/style/JoyPlotStyle.js +127 -128
- package/src/style/LegoStyle.js +110 -110
- package/src/style/MosaicStyle.js +99 -99
- package/src/style/NinjaStarStyle.js +102 -102
- package/src/style/PillarStyle.js +207 -208
- package/src/style/SegmentStyle.js +105 -105
- package/src/style/ShapeColorSizeStyle.js +147 -132
- package/src/style/SideCategoryStyle.js +112 -114
- package/src/style/SideStyle.js +212 -205
- package/src/style/SquareColorCategoryWebGLStyle.js +107 -108
- package/src/style/SquareColorWebGLStyle.js +126 -126
- package/src/style/StrokeStyle.js +135 -136
- package/src/style/TanakaStyle.js +69 -68
- package/src/style/TextStyle.js +110 -111
- package/src/style/TimeSeriesStyle.js +222 -229
- package/src/utils/scale.js +218 -228
- package/src/utils/stretching.js +120 -133
- package/src/utils/ternary.js +203 -204
- package/src/utils/utils.js +58 -63
- package/src/utils/webGLUtils.js +72 -70
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gridviz",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "Visualization tool for gridded statistics",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"statistics",
|
|
7
|
-
"grid",
|
|
8
|
-
"gridded",
|
|
9
|
-
"grids",
|
|
10
|
-
"gridded statistics",
|
|
11
|
-
"dataviz",
|
|
12
|
-
"csv",
|
|
13
|
-
"GIS",
|
|
14
|
-
"WebGL",
|
|
15
|
-
"d3",
|
|
16
|
-
"cartography",
|
|
17
|
-
"bertin",
|
|
18
|
-
"geospatial",
|
|
19
|
-
"mapping"
|
|
20
|
-
],
|
|
21
|
-
"homepage": "https://github.com/eurostat/gridviz",
|
|
22
|
-
"author": "Joseph Davies, Julien Gaffuri",
|
|
23
|
-
"license": "EUPL-1.2",
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/eurostat/gridviz.git"
|
|
27
|
-
},
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/eurostat/gridviz/issues",
|
|
30
|
-
"email": "Joseph.DAVIES@ext.ec.europa.eu"
|
|
31
|
-
},
|
|
32
|
-
"type": "module",
|
|
33
|
-
"main": "dist/gridviz.min.js",
|
|
34
|
-
"module": "dist/gridviz.min.js",
|
|
35
|
-
"exports": {
|
|
36
|
-
"umd": "./dist/gridviz.min.js",
|
|
37
|
-
"default": "./src/index.js"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"start": "
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
},
|
|
47
|
-
"files": [
|
|
48
|
-
"dist/**/*.js",
|
|
49
|
-
"src/**/*.js"
|
|
50
|
-
],
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"d3-array": "^3.2.4",
|
|
53
|
-
"d3-color": "^3.1.0",
|
|
54
|
-
"d3-fetch": "^3.0.1",
|
|
55
|
-
"d3-random": "^3.0.1",
|
|
56
|
-
"d3-scale": "^4.0.2",
|
|
57
|
-
"d3-selection": "^3.0.0",
|
|
58
|
-
"d3-zoom": "^3.0.0",
|
|
59
|
-
"jsdoc": "^4.0.4"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@babel/preset-env": "^7.25.4",
|
|
63
|
-
"babel-loader": "^8.1.0",
|
|
64
|
-
"jshint": "^2.12.0",
|
|
65
|
-
"prettier": "2.8.8",
|
|
66
|
-
"webpack": "^5.96.1",
|
|
67
|
-
"webpack-cli": "^5.1.4",
|
|
68
|
-
"webpack-dev-server": "^5.1.0",
|
|
69
|
-
"webpack-livereload-plugin": "^3.0.2"
|
|
70
|
-
},
|
|
71
|
-
"engines": {
|
|
72
|
-
"node": ">=14"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gridviz",
|
|
3
|
+
"version": "3.0.17",
|
|
4
|
+
"description": "Visualization tool for gridded statistics",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"statistics",
|
|
7
|
+
"grid",
|
|
8
|
+
"gridded",
|
|
9
|
+
"grids",
|
|
10
|
+
"gridded statistics",
|
|
11
|
+
"dataviz",
|
|
12
|
+
"csv",
|
|
13
|
+
"GIS",
|
|
14
|
+
"WebGL",
|
|
15
|
+
"d3",
|
|
16
|
+
"cartography",
|
|
17
|
+
"bertin",
|
|
18
|
+
"geospatial",
|
|
19
|
+
"mapping"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://github.com/eurostat/gridviz",
|
|
22
|
+
"author": "Joseph Davies, Julien Gaffuri",
|
|
23
|
+
"license": "EUPL-1.2",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/eurostat/gridviz.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/eurostat/gridviz/issues",
|
|
30
|
+
"email": "Joseph.DAVIES@ext.ec.europa.eu"
|
|
31
|
+
},
|
|
32
|
+
"type": "module",
|
|
33
|
+
"main": "dist/gridviz.min.js",
|
|
34
|
+
"module": "dist/gridviz.min.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
"umd": "./dist/gridviz.min.js",
|
|
37
|
+
"default": "./src/index.js"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"start": "webpack --config webpack.config.dev.cjs",
|
|
41
|
+
"server": "webpack serve -c webpack.config.dev.cjs",
|
|
42
|
+
"doc": "jsdoc -c docs/jsdoc/jsdoc.conf.json",
|
|
43
|
+
"build-prod": "webpack --config webpack.config.prod.cjs",
|
|
44
|
+
"test": "jest",
|
|
45
|
+
"format": "prettier --write ."
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist/**/*.js",
|
|
49
|
+
"src/**/*.js"
|
|
50
|
+
],
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"d3-array": "^3.2.4",
|
|
53
|
+
"d3-color": "^3.1.0",
|
|
54
|
+
"d3-fetch": "^3.0.1",
|
|
55
|
+
"d3-random": "^3.0.1",
|
|
56
|
+
"d3-scale": "^4.0.2",
|
|
57
|
+
"d3-selection": "^3.0.0",
|
|
58
|
+
"d3-zoom": "^3.0.0",
|
|
59
|
+
"jsdoc": "^4.0.4"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@babel/preset-env": "^7.25.4",
|
|
63
|
+
"babel-loader": "^8.1.0",
|
|
64
|
+
"jshint": "^2.12.0",
|
|
65
|
+
"prettier": "^2.8.8",
|
|
66
|
+
"webpack": "^5.96.1",
|
|
67
|
+
"webpack-cli": "^5.1.4",
|
|
68
|
+
"webpack-dev-server": "^5.1.0",
|
|
69
|
+
"webpack-livereload-plugin": "^3.0.2"
|
|
70
|
+
},
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=14"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,96 +1,101 @@
|
|
|
1
|
-
import { Button } from './Button.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Button for toggling fullscreen mode
|
|
5
|
-
*
|
|
6
|
-
* @module button
|
|
7
|
-
* @author Joseph Davies, Julien Gaffuri
|
|
8
|
-
*/
|
|
9
|
-
export class ZoomButtons extends Button {
|
|
10
|
-
/**
|
|
11
|
-
* @param {Object} opts
|
|
12
|
-
*/
|
|
13
|
-
constructor(opts) {
|
|
14
|
-
super(opts)
|
|
15
|
-
|
|
16
|
-
this.onZoom = opts.onZoom // custom user event handler
|
|
17
|
-
this.delta = opts.delta || 0.2
|
|
18
|
-
|
|
19
|
-
// zoom in
|
|
20
|
-
this.zoomInBtn = document.createElement('a')
|
|
21
|
-
this.zoomInBtn.
|
|
22
|
-
this.zoomInBtn.
|
|
23
|
-
this.zoomInBtn.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.zoomOutBtn
|
|
37
|
-
this.zoomOutBtn.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.zoomOutBtn.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
btn.style.
|
|
55
|
-
btn.style.
|
|
56
|
-
btn.style.
|
|
57
|
-
btn.style.
|
|
58
|
-
btn.style.
|
|
59
|
-
btn.style.
|
|
60
|
-
btn.style.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (opts.
|
|
75
|
-
this.style('
|
|
76
|
-
} else {
|
|
77
|
-
this.style('
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
import { Button } from './Button.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Button for toggling fullscreen mode
|
|
5
|
+
*
|
|
6
|
+
* @module button
|
|
7
|
+
* @author Joseph Davies, Julien Gaffuri
|
|
8
|
+
*/
|
|
9
|
+
export class ZoomButtons extends Button {
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} opts
|
|
12
|
+
*/
|
|
13
|
+
constructor(opts) {
|
|
14
|
+
super(opts)
|
|
15
|
+
|
|
16
|
+
this.onZoom = opts.onZoom // custom user event handler
|
|
17
|
+
this.delta = opts.delta || 0.2
|
|
18
|
+
|
|
19
|
+
// Create zoom in button
|
|
20
|
+
this.zoomInBtn = document.createElement('a')
|
|
21
|
+
this.zoomInBtn.id = 'zoom-in'
|
|
22
|
+
this.zoomInBtn.className = 'gridviz-zoom-button'
|
|
23
|
+
this.zoomInBtn.title = 'Zoom in'
|
|
24
|
+
this.zoomInBtn.textContent = '+'
|
|
25
|
+
this.zoomInBtn.addEventListener('click', (e) => {
|
|
26
|
+
this.zoomIn(e)
|
|
27
|
+
})
|
|
28
|
+
this.zoomInBtn.addEventListener('mouseover', () => {
|
|
29
|
+
this.zoomInBtn.style.backgroundColor = 'lightgrey'
|
|
30
|
+
})
|
|
31
|
+
this.zoomInBtn.addEventListener('mouseout', () => {
|
|
32
|
+
this.zoomInBtn.style.backgroundColor = '#ffffff'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Create zoom out button
|
|
36
|
+
this.zoomOutBtn = document.createElement('a')
|
|
37
|
+
this.zoomOutBtn.id = 'zoom-out'
|
|
38
|
+
this.zoomOutBtn.className = 'gridviz-zoom-button'
|
|
39
|
+
this.zoomOutBtn.title = 'Zoom out'
|
|
40
|
+
this.zoomOutBtn.textContent = '-'
|
|
41
|
+
this.zoomOutBtn.addEventListener('click', (e) => {
|
|
42
|
+
this.zoomOut(e)
|
|
43
|
+
})
|
|
44
|
+
this.zoomOutBtn.addEventListener('mouseover', () => {
|
|
45
|
+
this.zoomOutBtn.style.backgroundColor = 'lightgrey'
|
|
46
|
+
})
|
|
47
|
+
this.zoomOutBtn.addEventListener('mouseout', () => {
|
|
48
|
+
this.zoomOutBtn.style.backgroundColor = '#ffffff'
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Set common styles for buttons
|
|
52
|
+
const buttons = [this.zoomInBtn, this.zoomOutBtn]
|
|
53
|
+
buttons.forEach((btn, index) => {
|
|
54
|
+
btn.style.alignItems = 'center'
|
|
55
|
+
btn.style.justifyContent = 'center'
|
|
56
|
+
btn.style.display = 'flex'
|
|
57
|
+
btn.style.border = 'none'
|
|
58
|
+
btn.style.color = 'black'
|
|
59
|
+
btn.style.textAlign = 'center'
|
|
60
|
+
btn.style.textDecoration = 'none'
|
|
61
|
+
btn.style.padding = '4px'
|
|
62
|
+
btn.style.fontSize = '24px'
|
|
63
|
+
btn.style.fontWeight = 'bold'
|
|
64
|
+
btn.style.userSelect = 'none'
|
|
65
|
+
btn.style.backgroundColor = '#ffffff'
|
|
66
|
+
if (index === 0) btn.style.borderBottom = '1px solid grey' // Zoom in button only
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// Unset parent class height and display for dual buttons
|
|
70
|
+
this.style('height', 'unset')
|
|
71
|
+
this.style('display', 'unset')
|
|
72
|
+
|
|
73
|
+
// Set position
|
|
74
|
+
if (opts.x) {
|
|
75
|
+
this.style('left', opts.x + 'px')
|
|
76
|
+
} else {
|
|
77
|
+
this.style('right', '10px')
|
|
78
|
+
}
|
|
79
|
+
if (opts.y) {
|
|
80
|
+
this.style('top', opts.y + 'px')
|
|
81
|
+
} else {
|
|
82
|
+
this.style('top', '10px')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Append buttons to the container
|
|
86
|
+
this.div.node().appendChild(this.zoomInBtn)
|
|
87
|
+
this.div.node().appendChild(this.zoomOutBtn)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Zoom in */
|
|
91
|
+
zoomIn(e) {
|
|
92
|
+
this.map.setZoom(this.map.getZoom() * (1 - this.delta)).redraw()
|
|
93
|
+
if (this.onZoom) this.onZoom(e)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Zoom out */
|
|
97
|
+
zoomOut(e) {
|
|
98
|
+
this.map.setZoom(this.map.getZoom() * (1 + this.delta)).redraw()
|
|
99
|
+
if (this.onZoom) this.onZoom(e)
|
|
100
|
+
}
|
|
101
|
+
}
|