gridviz 3.0.15 → 3.0.16

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.
Files changed (55) hide show
  1. package/README.md +127 -128
  2. package/dist/gridviz.js +7959 -7861
  3. package/dist/gridviz.min.js +1 -1
  4. package/package.json +74 -74
  5. package/src/button/ZoomButtons.js +101 -96
  6. package/src/core/Dataset.js +154 -157
  7. package/src/core/Drawable.js +60 -61
  8. package/src/core/GeoCanvas.js +409 -370
  9. package/src/core/Layer.js +23 -25
  10. package/src/core/Legend.js +108 -110
  11. package/src/core/Map.js +495 -495
  12. package/src/core/MultiResolutionDataset.js +93 -97
  13. package/src/core/Style.js +98 -99
  14. package/src/dataset/CSVGrid.js +112 -112
  15. package/src/dataset/GeoTIFF.js +122 -123
  16. package/src/dataset/JSGrid.js +55 -54
  17. package/src/dataset/TiledGrid.js +289 -288
  18. package/src/dataset/worker.js +18 -0
  19. package/src/index.js +77 -71
  20. package/src/layer/BackgroundLayer.js +162 -158
  21. package/src/layer/BackgroundLayerImage.js +81 -84
  22. package/src/layer/BackgroundLayerWMS.js +104 -108
  23. package/src/layer/GeoJSONLayer.js +214 -220
  24. package/src/layer/GridLayer.js +148 -157
  25. package/src/layer/LabelLayer.js +194 -193
  26. package/src/legend/ColorCategoryLegend.js +109 -110
  27. package/src/legend/ColorDiscreteLegend.js +100 -102
  28. package/src/legend/ColorLegend.js +115 -118
  29. package/src/legend/OrientationLegend.js +89 -91
  30. package/src/legend/SizeLegend.js +224 -224
  31. package/src/legend/TernaryLegend.js +302 -210
  32. package/src/style/CompositionStyle.js +291 -288
  33. package/src/style/DotDensityStyle.js +133 -134
  34. package/src/style/ImageStyle.js +100 -102
  35. package/src/style/IsoFenceStyle.js +217 -203
  36. package/src/style/JoyPlotStyle.js +127 -128
  37. package/src/style/LegoStyle.js +110 -110
  38. package/src/style/MosaicStyle.js +99 -99
  39. package/src/style/NinjaStarStyle.js +102 -102
  40. package/src/style/PillarStyle.js +207 -208
  41. package/src/style/SegmentStyle.js +105 -105
  42. package/src/style/ShapeColorSizeStyle.js +147 -132
  43. package/src/style/SideCategoryStyle.js +112 -114
  44. package/src/style/SideStyle.js +212 -205
  45. package/src/style/SquareColorCategoryWebGLStyle.js +107 -108
  46. package/src/style/SquareColorWebGLStyle.js +126 -126
  47. package/src/style/StrokeStyle.js +135 -136
  48. package/src/style/TanakaStyle.js +69 -68
  49. package/src/style/TextStyle.js +110 -111
  50. package/src/style/TimeSeriesStyle.js +222 -229
  51. package/src/utils/scale.js +218 -228
  52. package/src/utils/stretching.js +120 -133
  53. package/src/utils/ternary.js +203 -204
  54. package/src/utils/utils.js +58 -63
  55. package/src/utils/webGLUtils.js +72 -70
package/package.json CHANGED
@@ -1,74 +1,74 @@
1
- {
2
- "name": "gridviz",
3
- "version": "3.0.15",
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": "export NODE_OPTIONS=--openssl-legacy-provider && webpack --config webpack.config.dev.cjs",
41
- "start-dev": "webpack --config webpack.config.dev.cjs",
42
- "server": "webpack serve -c webpack.config.dev.cjs",
43
- "doc": "jsdoc -c docs/jsdoc/jsdoc.conf.json",
44
- "bp": "webpack --config webpack.config.prod.cjs",
45
- "test": "jest"
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.16",
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 btn
20
- this.zoomInBtn = document.createElement('a')
21
- this.zoomInBtn.innerHTML = `<a id="zoomin" class="gridviz-zoom-button" title="Zoom in">+</a>`
22
- this.zoomInBtn.title = 'Zoom in'
23
- this.zoomInBtn.addEventListener('click', (e) => {
24
- this.zoomIn(e)
25
- })
26
- this.zoomInBtn.addEventListener('mouseover', (e) => {
27
- this.zoomInBtn.style.backgroundColor = 'lightgrey'
28
- })
29
- this.zoomInBtn.addEventListener('mouseout', (e) => {
30
- this.zoomInBtn.style.backgroundColor = '#ffffff'
31
- })
32
-
33
- // zoom out btn
34
- this.zoomOutBtn = document.createElement('a')
35
- this.zoomOutBtn.innerHTML = `<a id="zoomin" class="gridviz-zoom-button" title="Zoom out">-</a>`
36
- this.zoomOutBtn.title = 'Zoom out'
37
- this.zoomOutBtn.addEventListener('click', (e) => {
38
- this.zoomOut(e)
39
- })
40
- this.zoomOutBtn.addEventListener('mouseover', (e) => {
41
- this.zoomOutBtn.style.backgroundColor = 'lightgrey'
42
- })
43
- this.zoomOutBtn.addEventListener('mouseout', (e) => {
44
- this.zoomOutBtn.style.backgroundColor = '#ffffff'
45
- })
46
-
47
- //set styles
48
- let btns = [this.zoomInBtn, this.zoomOutBtn]
49
- btns.forEach((btn, i) => {
50
- btn.style.alignItems = 'center'
51
- btn.style.justifyContent = 'center'
52
- btn.style.display = 'flex'
53
- btn.style.border = 'none'
54
- btn.style.color = 'black'
55
- btn.style.textAlign = 'center'
56
- btn.style.textDecoration = 'none'
57
- btn.style.padding = '4px'
58
- btn.style.fontSize = '20px'
59
- btn.style.fontWeight = 'bold'
60
- btn.style.userSelect = 'none'
61
- if (i == 0) btn.style.borderBottom = '1px solid grey'
62
- })
63
-
64
- // unset parent class height and display for dual buttons
65
- this.style('height', 'unset')
66
- this.style('display', 'unset')
67
-
68
- //set position
69
- if (opts.x) {
70
- this.style('left', opts.x + 'px')
71
- } else {
72
- this.style('right', '10px')
73
- }
74
- if (opts.y) {
75
- this.style('top', opts.y + 'px')
76
- } else {
77
- this.style('top', '10px')
78
- }
79
-
80
- // append to button container
81
- this.div.node().appendChild(this.zoomInBtn)
82
- this.div.node().appendChild(this.zoomOutBtn)
83
- }
84
-
85
- /* Zoom in */
86
- zoomIn(e) {
87
- this.map.setZoom(this.map.getZoom() * (1 - this.delta)).redraw()
88
- if (this.onZoom) this.onZoom(e)
89
- }
90
-
91
- /* Zoom out */
92
- zoomOut(e) {
93
- this.map.setZoom(this.map.getZoom() * (1 + this.delta)).redraw()
94
- if (this.onZoom) this.onZoom(e)
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 = '20px';
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
+ }