gridviz 3.0.8 → 3.0.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridviz",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Visualization tool for gridded statistics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"statistics",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "EUPL-1.2",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/eurostat/gridviz.git"
|
|
26
|
+
"url": "git+https://github.com/eurostat/gridviz.git"
|
|
27
27
|
},
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/eurostat/gridviz/issues",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"start": "export NODE_OPTIONS=--openssl-legacy-provider && webpack --config webpack.config.dev.cjs",
|
|
41
41
|
"start-dev": "webpack --config webpack.config.dev.cjs",
|
|
42
42
|
"server": "webpack serve -c webpack.config.dev.cjs",
|
|
43
|
-
"doc": "
|
|
43
|
+
"doc": "jsdoc -c docs/jsdoc/jsdoc.conf.json",
|
|
44
44
|
"bp": "webpack --config webpack.config.prod.cjs",
|
|
45
45
|
"test": "jest"
|
|
46
46
|
},
|
|
@@ -59,16 +59,11 @@
|
|
|
59
59
|
"jsdoc": "^4.0.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/
|
|
63
|
-
"@babel/plugin-transform-runtime": "^7.12.1",
|
|
64
|
-
"@babel/preset-env": "^7.9.0",
|
|
65
|
-
"@babel/runtime": "^7.12.1",
|
|
62
|
+
"@babel/preset-env": "^7.25.4",
|
|
66
63
|
"babel-loader": "^8.1.0",
|
|
67
|
-
"jest": "^26.6.1",
|
|
68
64
|
"jshint": "^2.12.0",
|
|
69
65
|
"prettier": "2.8.8",
|
|
70
|
-
"
|
|
71
|
-
"webpack": "^5.89.0",
|
|
66
|
+
"webpack": "^5.94.0",
|
|
72
67
|
"webpack-cli": "^5.1.4",
|
|
73
68
|
"webpack-dev-server": "^4.15.1",
|
|
74
69
|
"webpack-livereload-plugin": "^3.0.2"
|
package/src/button/Button.js
CHANGED
|
@@ -18,16 +18,15 @@ export class Button {
|
|
|
18
18
|
* opts.y
|
|
19
19
|
*/
|
|
20
20
|
constructor(opts = {}) {
|
|
21
|
-
|
|
22
21
|
this.map = opts.map
|
|
23
22
|
this.parentNode = opts.parentNode || opts.map.container
|
|
24
23
|
|
|
25
24
|
// the div element
|
|
26
|
-
if (
|
|
25
|
+
if (opts.id) this.div = select('#' + opts.id)
|
|
27
26
|
|
|
28
27
|
if (!this.div || this.div.empty()) {
|
|
29
28
|
this.div = select(document.createElement('div'))
|
|
30
|
-
if (
|
|
29
|
+
if (opts.id) this.div.attr('id', opts.id)
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
if (opts.title) this.div.attr('title', opts.title)
|
|
@@ -37,7 +36,10 @@ export class Button {
|
|
|
37
36
|
if (opts.onClickFunction) this.div.on('click', opts.onClickFunction)
|
|
38
37
|
|
|
39
38
|
//set styles
|
|
40
|
-
this.style(
|
|
39
|
+
this.style(
|
|
40
|
+
'box-shadow',
|
|
41
|
+
'0 7px 8px rgba(0,47,103,.08), 0 0 22px rgba(0,47,103,.04), 0 12px 17px rgba(0,47,103,.04), 0 -4px 4px rgba(0,47,103,.04)'
|
|
42
|
+
) //.ecl-u-shadow-3
|
|
41
43
|
this.style('background-color', '#ffffff')
|
|
42
44
|
this.style('position', 'absolute')
|
|
43
45
|
this.style('cursor', 'pointer')
|
|
@@ -48,7 +50,6 @@ export class Button {
|
|
|
48
50
|
this.style('height', '30px')
|
|
49
51
|
// this.style(padding , '4px'
|
|
50
52
|
|
|
51
|
-
|
|
52
53
|
// append to parent
|
|
53
54
|
this.parentNode.appendChild(this.div.node())
|
|
54
55
|
}
|
package/src/dataset/CSVGrid.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/** @typedef {{ dims: object, crs: string, tileSizeCell: number, originPoint: {x:number,y:number}, resolutionGeo: number, tilingBounds:import("../core/GeoCanvas.js").Envelope }} GridInfo */
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { dsv } from 'd3-fetch'
|
|
7
7
|
import { Dataset } from '../core/Dataset.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -17,7 +17,7 @@ export class CSVGrid extends Dataset {
|
|
|
17
17
|
* @param {import("../core/Map.js").Map} map The map.
|
|
18
18
|
* @param {string} url The URL of the dataset.
|
|
19
19
|
* @param {number} resolution The dataset resolution in geographical unit.
|
|
20
|
-
* @param {{preprocess?:(function(import("../core/Dataset.js").Cell):boolean)}} opts
|
|
20
|
+
* @param {{preprocess?:(function(import("../core/Dataset.js").Cell):boolean),delimiter?:string}} opts
|
|
21
21
|
*/
|
|
22
22
|
constructor(map, url, resolution, opts = {}) {
|
|
23
23
|
super(map, url, resolution, opts)
|
|
@@ -27,6 +27,11 @@ export class CSVGrid extends Dataset {
|
|
|
27
27
|
* @type {Array.<import("../core/Dataset.js").Cell>} */
|
|
28
28
|
this.cells = []
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* @type {string} */
|
|
33
|
+
this.delimiter = opts.delimiter || ","
|
|
34
|
+
|
|
30
35
|
/**
|
|
31
36
|
* @type {string}
|
|
32
37
|
* @private */
|
|
@@ -48,7 +53,7 @@ export class CSVGrid extends Dataset {
|
|
|
48
53
|
this.infoLoadingStatus = 'loading'
|
|
49
54
|
; (async () => {
|
|
50
55
|
try {
|
|
51
|
-
const data = await
|
|
56
|
+
const data = await dsv(this.delimiter, this.url)
|
|
52
57
|
|
|
53
58
|
//convert coordinates in numbers
|
|
54
59
|
for (const c of data) {
|
|
@@ -71,7 +76,7 @@ export class CSVGrid extends Dataset {
|
|
|
71
76
|
//TODO check if redraw is necessary
|
|
72
77
|
//that is if the dataset belongs to a layer which is visible at the current zoom level
|
|
73
78
|
|
|
74
|
-
//
|
|
79
|
+
//redraw map
|
|
75
80
|
if (this.map) this.map.redraw()
|
|
76
81
|
|
|
77
82
|
this.infoLoadingStatus = 'loaded'
|
|
@@ -51,6 +51,7 @@ export class SideCategoryStyle extends SideStyle {
|
|
|
51
51
|
//draw sides
|
|
52
52
|
|
|
53
53
|
geoCanvas.ctx.lineCap = 'butt'
|
|
54
|
+
const r2 = resolution*0.5
|
|
54
55
|
for (let side of sides) {
|
|
55
56
|
|
|
56
57
|
//get category codes for both cells
|
|
@@ -73,8 +74,8 @@ export class SideCategoryStyle extends SideStyle {
|
|
|
73
74
|
if (code2) {
|
|
74
75
|
geoCanvas.ctx.beginPath()
|
|
75
76
|
geoCanvas.ctx.strokeStyle = this.color[code2]
|
|
76
|
-
geoCanvas.ctx.moveTo(side.x, side.y + w2)
|
|
77
|
-
geoCanvas.ctx.lineTo(side.x
|
|
77
|
+
geoCanvas.ctx.moveTo(side.x-r2, side.y + w2)
|
|
78
|
+
geoCanvas.ctx.lineTo(side.x+r2, side.y + w2)
|
|
78
79
|
geoCanvas.ctx.stroke()
|
|
79
80
|
}
|
|
80
81
|
|
|
@@ -82,8 +83,8 @@ export class SideCategoryStyle extends SideStyle {
|
|
|
82
83
|
if (code1) {
|
|
83
84
|
geoCanvas.ctx.beginPath()
|
|
84
85
|
geoCanvas.ctx.strokeStyle = this.color[code1]
|
|
85
|
-
geoCanvas.ctx.moveTo(side.x, side.y - w2)
|
|
86
|
-
geoCanvas.ctx.lineTo(side.x
|
|
86
|
+
geoCanvas.ctx.moveTo(side.x-r2, side.y - w2)
|
|
87
|
+
geoCanvas.ctx.lineTo(side.x+r2, side.y - w2)
|
|
87
88
|
geoCanvas.ctx.stroke()
|
|
88
89
|
}
|
|
89
90
|
} else {
|
|
@@ -91,8 +92,8 @@ export class SideCategoryStyle extends SideStyle {
|
|
|
91
92
|
if (code2) {
|
|
92
93
|
geoCanvas.ctx.beginPath()
|
|
93
94
|
geoCanvas.ctx.strokeStyle = this.color[code2]
|
|
94
|
-
geoCanvas.ctx.moveTo(side.x + w2, side.y)
|
|
95
|
-
geoCanvas.ctx.lineTo(side.x + w2, side.y
|
|
95
|
+
geoCanvas.ctx.moveTo(side.x + w2, side.y-r2)
|
|
96
|
+
geoCanvas.ctx.lineTo(side.x + w2, side.y+r2)
|
|
96
97
|
geoCanvas.ctx.stroke()
|
|
97
98
|
}
|
|
98
99
|
|
|
@@ -100,8 +101,8 @@ export class SideCategoryStyle extends SideStyle {
|
|
|
100
101
|
if (code1) {
|
|
101
102
|
geoCanvas.ctx.beginPath()
|
|
102
103
|
geoCanvas.ctx.strokeStyle = this.color[code1]
|
|
103
|
-
geoCanvas.ctx.moveTo(side.x - w2, side.y)
|
|
104
|
-
geoCanvas.ctx.lineTo(side.x - w2, side.y
|
|
104
|
+
geoCanvas.ctx.moveTo(side.x - w2, side.y-r2)
|
|
105
|
+
geoCanvas.ctx.lineTo(side.x - w2, side.y+r2)
|
|
105
106
|
geoCanvas.ctx.stroke()
|
|
106
107
|
}
|
|
107
108
|
}
|