eurostat-map 4.3.58 → 4.4.1
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 +113 -49
- package/build/215.eurostatmap.min.js +1 -1
- package/build/215.eurostatmap.min.js.map +1 -1
- package/build/eurostatmap.js +11757 -12996
- package/build/eurostatmap.min.js +2 -4
- package/build/eurostatmap.min.js.map +1 -1
- package/build/package.json +87 -0
- package/build/types/core/DorlingSettings.d.ts +29 -0
- package/build/types/core/GridCartogramSettings.d.ts +30 -0
- package/build/types/core/InsetConfig.d.ts +23 -0
- package/build/types/core/MapConfig.d.ts +95 -0
- package/build/types/core/MapInstance.d.ts +349 -0
- package/build/types/core/MinimapConfig.d.ts +11 -0
- package/build/types/core/TooltipConfig.d.ts +16 -0
- package/build/types/core/decoration/CoastalMarginSettings.d.ts +21 -0
- package/build/types/core/decoration/ScalebarConfig.d.ts +48 -0
- package/build/types/core/decoration/StampConfig.d.ts +71 -0
- package/build/types/core/geo/centroids.d.ts +33 -0
- package/build/types/core/geo/geometries.d.ts +71 -0
- package/build/types/core/geo/kosovo.d.ts +12 -0
- package/build/types/core/geo/proj4.d.ts +26 -0
- package/build/types/core/geo/projection.d.ts +29 -0
- package/build/types/core/insets.d.ts +16 -0
- package/build/types/core/layout.d.ts +23 -0
- package/build/types/core/locations.d.ts +55 -0
- package/build/types/core/minimaps.d.ts +20 -0
- package/build/types/core/scale.d.ts +30 -0
- package/build/types/core/stat/StatConfig.d.ts +27 -0
- package/build/types/core/stat/StatData.d.ts +113 -0
- package/build/types/core/utils.d.ts +198 -0
- package/build/types/core/zoom.d.ts +21 -0
- package/build/types/index.d.ts +253 -0
- package/build/types/legend/CategoricalLegendConfig.d.ts +13 -0
- package/build/types/legend/CoxcombLegendConfig.d.ts +85 -0
- package/build/types/legend/LegendConfig.d.ts +51 -0
- package/build/types/legend/MushroomLegendConfig.d.ts +56 -0
- package/build/types/legend/PatternFillLegendConfig.d.ts +11 -0
- package/build/types/legend/PieChartLegendConfig.d.ts +68 -0
- package/build/types/legend/SparklineLegendConfig.d.ts +6 -0
- package/build/types/legend/StripeCompositionLegendConfig.d.ts +11 -0
- package/build/types/legend/WaffleLegendConfig.d.ts +74 -0
- package/build/types/legend/choropleth/BivariateLegendConfig.d.ts +59 -0
- package/build/types/legend/choropleth/ChoroplethLegendConfig.d.ts +0 -0
- package/build/types/legend/choropleth/HistogramLegendConfig.d.ts +26 -0
- package/build/types/legend/choropleth/TrivariateLegendConfig.d.ts +32 -0
- package/build/types/legend/choropleth/legend-choropleth-bivariate.d.ts +2 -0
- package/build/types/legend/choropleth/legend-choropleth-trivariate.d.ts +2 -0
- package/build/types/legend/choropleth/legend-choropleth.d.ts +2 -0
- package/build/types/legend/composition/BarChartLegendConfig.d.ts +68 -0
- package/build/types/legend/composition/CoxcombLegendConfig.d.ts +85 -0
- package/build/types/legend/composition/PieChartLegendConfig.d.ts +68 -0
- package/build/types/legend/composition/SparklineLegendConfig.d.ts +94 -0
- package/build/types/legend/composition/StripeCompositionLegendConfig.d.ts +11 -0
- package/build/types/legend/composition/WaffleLegendConfig.d.ts +74 -0
- package/build/types/legend/composition/legend-bar-chart.d.ts +2 -0
- package/build/types/legend/flow/FlowLegendConfig.d.ts +0 -0
- package/build/types/legend/flow/FlowMapLegendConfig.d.ts +117 -0
- package/build/types/legend/flow/legend-flow.d.ts +2 -0
- package/build/types/legend/legend-categorical.d.ts +2 -0
- package/build/types/legend/legend-continuous.d.ts +2 -0
- package/build/types/legend/legend-discrete.d.ts +2 -0
- package/build/types/legend/legend.d.ts +13 -0
- package/build/types/legend/proportional-symbol/PropSymbolLegendConfig.d.ts +0 -0
- package/build/types/legend/proportional-symbol/ProportionalSymbolsLegendConfig.d.ts +134 -0
- package/build/types/legend/proportional-symbol/legend-proportional-symbols.d.ts +2 -0
- package/build/types/map-types/CategoricalMap.d.ts +21 -0
- package/build/types/map-types/CategoricalMapConfig.d.ts +11 -0
- package/build/types/map-types/CateogricalMapConfig.d.ts +11 -0
- package/build/types/map-types/MapType.d.ts +34 -0
- package/build/types/map-types/choropleth/BivariateChoroplethConfig.d.ts +23 -0
- package/build/types/map-types/choropleth/BivariateChoroplethMap.d.ts +39 -0
- package/build/types/map-types/choropleth/ChoroplethConfig.d.ts +35 -0
- package/build/types/map-types/choropleth/ChoroplethMap.d.ts +48 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethConfig.d.ts +28 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethMap.d.ts +15 -0
- package/build/types/map-types/choropleth/ValueByAlphaConfig.d.ts +8 -0
- package/build/types/map-types/choropleth/ValueByAlphaMap.d.ts +9 -0
- package/build/types/map-types/choropleth/map-choropleth-bivariate.d.ts +4 -0
- package/build/types/map-types/choropleth/map-choropleth-trivariate.d.ts +4 -0
- package/build/types/map-types/choropleth/map-choropleth.d.ts +47 -0
- package/build/types/map-types/choropleth/map-value-by-alpha.d.ts +4 -0
- package/build/types/map-types/composition/BarMap.d.ts +86 -0
- package/build/types/map-types/composition/BarMapConfig.d.ts +30 -0
- package/build/types/map-types/composition/CompositionStatConfig.d.ts +34 -0
- package/build/types/map-types/composition/CoxcombMap.d.ts +42 -0
- package/build/types/map-types/composition/CoxcombMapConfig.d.ts +18 -0
- package/build/types/map-types/composition/PieMap.d.ts +62 -0
- package/build/types/map-types/composition/PieMapConfig.d.ts +24 -0
- package/build/types/map-types/composition/SparkMap.d.ts +46 -0
- package/build/types/map-types/composition/SparkMapConfig.d.ts +25 -0
- package/build/types/map-types/composition/StripeMap.d.ts +43 -0
- package/build/types/map-types/composition/StripeMapConfig.d.ts +16 -0
- package/build/types/map-types/composition/WaffleMap.d.ts +71 -0
- package/build/types/map-types/composition/WaffleMapConfig.d.ts +25 -0
- package/build/types/map-types/composition/bar/BarMap.d.ts +79 -0
- package/build/types/map-types/composition/bar/BarMapConfig.d.ts +54 -0
- package/build/types/map-types/composition/composition-map.d.ts +25 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +46 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +32 -0
- package/build/types/map-types/composition/coxcomb/CoxcombStatConfig.d.ts +16 -0
- package/build/types/map-types/composition/map-bar.d.ts +5 -0
- package/build/types/map-types/composition/map-coxcomb.d.ts +5 -0
- package/build/types/map-types/composition/map-pie.d.ts +10 -0
- package/build/types/map-types/composition/map-spark.d.ts +5 -0
- package/build/types/map-types/composition/map-stripe.d.ts +5 -0
- package/build/types/map-types/composition/map-waffle.d.ts +5 -0
- package/build/types/map-types/composition/pie/PieMap.d.ts +69 -0
- package/build/types/map-types/composition/pie/PieMapConfig.d.ts +42 -0
- package/build/types/map-types/composition/stripe/StripeMap.d.ts +52 -0
- package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +28 -0
- package/build/types/map-types/composition/waffle/WaffleMap.d.ts +78 -0
- package/build/types/map-types/composition/waffle/WaffleMapConfig.d.ts +44 -0
- package/build/types/map-types/flow/FlowMap.d.ts +97 -0
- package/build/types/map-types/flow/FlowMapConfig.d.ts +158 -0
- package/build/types/map-types/flow/map-flow.d.ts +5 -0
- package/build/types/map-types/map-categorical.d.ts +19 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolConfig.d.ts +17 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +90 -0
- package/build/types/map-types/proportional-symbol/map-proportional-symbols.d.ts +35 -0
- package/build/types/map-types/proportional-symbol/mushroom/MushroomMap.d.ts +30 -0
- package/build/types/map-types/proportional-symbol/mushroom/MushroomMapConfig.d.ts +20 -0
- package/build/types/map-types/spark/SparkMap.d.ts +52 -0
- package/build/types/map-types/spark/SparkMapConfig.d.ts +42 -0
- package/build/types/map-types/spark/SparkStatConfig.d.ts +16 -0
- package/build/types/utils/FillPatternOptions.d.ts +17 -0
- package/package.json +12 -5
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eurostat-map",
|
|
3
|
+
"version": "4.3.58",
|
|
4
|
+
"description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eurostat",
|
|
7
|
+
"statistics",
|
|
8
|
+
"europe",
|
|
9
|
+
"SVG",
|
|
10
|
+
"NUTS",
|
|
11
|
+
"map",
|
|
12
|
+
"D3",
|
|
13
|
+
"cartography",
|
|
14
|
+
"thematic",
|
|
15
|
+
"mapping",
|
|
16
|
+
"eurostat-map",
|
|
17
|
+
"dataviz",
|
|
18
|
+
"data visualization"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/eurostat/eurostat-map",
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "EUPL-1.2",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/eurostat/eurostat-map.git"
|
|
26
|
+
},
|
|
27
|
+
"main": "build/eurostatmap.min.js",
|
|
28
|
+
"unpkg": "build/eurostatmap.min.js",
|
|
29
|
+
"module": "build/eurostatmap.js",
|
|
30
|
+
"types": "build/types/index.d.ts",
|
|
31
|
+
"typings": "build/types/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"build"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"start": "webpack --config webpack/webpack.config.dev.js",
|
|
37
|
+
"server": "webpack-dev-server --open --watch",
|
|
38
|
+
"build-types": "tsc --project tsconfig.json",
|
|
39
|
+
"build-prod": "npm run build-types && webpack --config webpack/webpack.config.prod.js",
|
|
40
|
+
"build-prod-debug": "webpack --config webpack/webpack.config.debug-size.js",
|
|
41
|
+
"format": "prettier --write .",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"type-check": "tsc --noEmit"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"d3-array": "^3.2.4",
|
|
47
|
+
"d3-axis": "^3.0.0",
|
|
48
|
+
"d3-ease": "^3.0.1",
|
|
49
|
+
"d3-fetch": "^3.0.1",
|
|
50
|
+
"d3-force": "^3.0.0",
|
|
51
|
+
"d3-format": "^3.1.0",
|
|
52
|
+
"d3-geo": "^3.1.1",
|
|
53
|
+
"d3-geo-projection": "^3.0.0",
|
|
54
|
+
"d3-interpolate": "^3.0.1",
|
|
55
|
+
"d3-scale": "^4.0.2",
|
|
56
|
+
"d3-scale-chromatic": "^3.1.0",
|
|
57
|
+
"d3-selection": "^3.0.0",
|
|
58
|
+
"d3-shape": "^3.2.0",
|
|
59
|
+
"d3-svg-annotation": "^2.5.1",
|
|
60
|
+
"d3-zoom": "^3.0.0",
|
|
61
|
+
"idb-keyval": "^6.2.2",
|
|
62
|
+
"jsonstat-toolkit": "^1.0.8",
|
|
63
|
+
"proj4": "^2.17.0",
|
|
64
|
+
"simple-statistics": "^7.8.8",
|
|
65
|
+
"topojson-client": "^3.1.0"
|
|
66
|
+
},
|
|
67
|
+
"overrides": {
|
|
68
|
+
"d3-color": "3.1.0"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@babel/core": "^7.22.6",
|
|
72
|
+
"@babel/plugin-transform-runtime": "^7.22.6",
|
|
73
|
+
"@babel/preset-env": "^7.22.6",
|
|
74
|
+
"@babel/runtime": "^7.12.1",
|
|
75
|
+
"babel-loader": "^9.1.2",
|
|
76
|
+
"css-loader": "^7.1.2",
|
|
77
|
+
"prettier": "^3.4.1",
|
|
78
|
+
"style-loader": "^4.0.0",
|
|
79
|
+
"ts-loader": "^9.5.4",
|
|
80
|
+
"typescript": "^5.9.3",
|
|
81
|
+
"webpack": "^5.88.1",
|
|
82
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
83
|
+
"webpack-cli": "^5.0.0",
|
|
84
|
+
"webpack-dev-server": "^5.2.2",
|
|
85
|
+
"webpack-livereload-plugin": "^3.0.2"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strength settings for Dorling force simulation.
|
|
3
|
+
*/
|
|
4
|
+
export interface DorlingStrength {
|
|
5
|
+
/** X-axis attraction strength. */
|
|
6
|
+
x: number
|
|
7
|
+
/** Y-axis attraction strength. */
|
|
8
|
+
y: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Settings for Dorling cartogram simulation behavior.
|
|
13
|
+
*/
|
|
14
|
+
export interface DorlingSettings {
|
|
15
|
+
/** Animate simulation ticks in real time. */
|
|
16
|
+
animate: boolean
|
|
17
|
+
/** Gravity strength toward original centroids. */
|
|
18
|
+
strength: DorlingStrength
|
|
19
|
+
/** Collision force iterations per tick. */
|
|
20
|
+
iterations: number
|
|
21
|
+
/** Extra collision padding between symbols. */
|
|
22
|
+
padding: number
|
|
23
|
+
/** Progress callback used by worker-based simulation. */
|
|
24
|
+
onProgress?: (progress: number, map: any) => void
|
|
25
|
+
/** Run non-animated simulation in a Web Worker. */
|
|
26
|
+
worker: boolean
|
|
27
|
+
/** URL of the D3 bundle used by Dorling worker mode. */
|
|
28
|
+
workerD3URL?: string
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Margins used to place and center grid cartograms.
|
|
3
|
+
*/
|
|
4
|
+
export interface GridCartogramMargins {
|
|
5
|
+
/** Top margin in pixels. */
|
|
6
|
+
top: number
|
|
7
|
+
/** Right margin in pixels. */
|
|
8
|
+
right: number
|
|
9
|
+
/** Bottom margin in pixels. */
|
|
10
|
+
bottom: number
|
|
11
|
+
/** Left margin in pixels. */
|
|
12
|
+
left: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Settings for grid cartogram layout and geometry.
|
|
17
|
+
*/
|
|
18
|
+
export interface GridCartogramSettings {
|
|
19
|
+
/** Grid cell shape. */
|
|
20
|
+
shape: 'square' | 'hexagon'
|
|
21
|
+
/** Margins around the grid drawing area. */
|
|
22
|
+
margins: GridCartogramMargins
|
|
23
|
+
/** Extra spacing between grid cells in pixels. */
|
|
24
|
+
cellPadding: number
|
|
25
|
+
/**
|
|
26
|
+
* Custom grid layout CSV string.
|
|
27
|
+
* If undefined, the built-in layout for the selected shape is used.
|
|
28
|
+
*/
|
|
29
|
+
positions?: string
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for map insets (smaller additional maps)
|
|
3
|
+
*/
|
|
4
|
+
export interface InsetConfig {
|
|
5
|
+
/** Geographic code (e.g., 'MT', 'PT20', 'CARIB'). */
|
|
6
|
+
geo?: string
|
|
7
|
+
/** Title. */
|
|
8
|
+
title?: string
|
|
9
|
+
/** Scale. */
|
|
10
|
+
scale?: string | number
|
|
11
|
+
/** Width. */
|
|
12
|
+
width?: number
|
|
13
|
+
/** Height. */
|
|
14
|
+
height?: number
|
|
15
|
+
/** X. */
|
|
16
|
+
x?: number
|
|
17
|
+
/** Y. */
|
|
18
|
+
y?: number
|
|
19
|
+
/** Proj. */
|
|
20
|
+
proj?: string
|
|
21
|
+
|
|
22
|
+
[key: string]: any
|
|
23
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { StatConfig } from './stat/StatConfig'
|
|
2
|
+
import type { LegendConfig } from '../legend/LegendConfig'
|
|
3
|
+
import type { TooltipConfig } from './TooltipConfig'
|
|
4
|
+
import type { InsetConfig } from './InsetConfig'
|
|
5
|
+
import type { MapInstance as EurostatMap } from './MapInstance'
|
|
6
|
+
import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
|
|
7
|
+
import type { GridCartogramSettings } from './GridCartogramSettings'
|
|
8
|
+
import type { DorlingSettings } from './DorlingSettings'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base configuration for all map types. Each specific map type will extend this with its own properties, but these are the common ones that apply to all maps.
|
|
12
|
+
*/
|
|
13
|
+
export interface MapConfig {
|
|
14
|
+
/** Container settings. */
|
|
15
|
+
svgId?: string
|
|
16
|
+
/** ID of the container element used to host the map. */
|
|
17
|
+
containerId?: string
|
|
18
|
+
|
|
19
|
+
/** Geographic settings. */
|
|
20
|
+
/**
|
|
21
|
+
* NUTS2json geometries projection: '3035', '3857', '4326'.
|
|
22
|
+
* For custom projections, use 4326 and then set projectionFunction().
|
|
23
|
+
*/
|
|
24
|
+
proj?: string
|
|
25
|
+
/** Function to set a custom projection. See d3-geo projections for examples. */
|
|
26
|
+
projectionFunction?: () => any
|
|
27
|
+
/** Scale of the map, for NUTSjson geometries. */
|
|
28
|
+
scale?: '60M' | '20M' | '10M' | '03M' | '01M'
|
|
29
|
+
/** NUTS level (0, 1, 2, 3). */
|
|
30
|
+
nutsLevel?: number
|
|
31
|
+
/** NUTS boundary year. */
|
|
32
|
+
nutsYear?: number | string
|
|
33
|
+
/** Geographic center as [longitude, latitude]. */
|
|
34
|
+
geoCenter?: [number, number]
|
|
35
|
+
|
|
36
|
+
/** Geometry settings. */
|
|
37
|
+
/**
|
|
38
|
+
* NUTS2JSON geographic focus (e.g., 'EUR', 'WORLD', 'IC', 'GF').
|
|
39
|
+
* See https://github.com/eurostat/Nuts2json#overseas-territories---map-insets
|
|
40
|
+
*/
|
|
41
|
+
geo?: string
|
|
42
|
+
|
|
43
|
+
/** Map dimensions. */
|
|
44
|
+
width?: number
|
|
45
|
+
/** Map height in pixels. */
|
|
46
|
+
height?: number
|
|
47
|
+
|
|
48
|
+
/** Map texts. */
|
|
49
|
+
/** Map title. */
|
|
50
|
+
title?: string
|
|
51
|
+
/** Map subtitle. */
|
|
52
|
+
subtitle?: string
|
|
53
|
+
/** Footnote text shown below the map. */
|
|
54
|
+
footnote?: string
|
|
55
|
+
/** Data source text. */
|
|
56
|
+
source?: string
|
|
57
|
+
|
|
58
|
+
/** Statistical data configuration. */
|
|
59
|
+
stat?: StatConfig
|
|
60
|
+
|
|
61
|
+
/** Legend configuration. */
|
|
62
|
+
legend?: LegendConfig
|
|
63
|
+
|
|
64
|
+
/** Tooltip configuration. */
|
|
65
|
+
tooltip?: TooltipConfig
|
|
66
|
+
|
|
67
|
+
/** Insets (small additional maps). */
|
|
68
|
+
insets?: InsetConfig[]
|
|
69
|
+
|
|
70
|
+
/** Zoom and pan settings. */
|
|
71
|
+
zoomExtent?: [number, number]
|
|
72
|
+
|
|
73
|
+
/** Grid cartogram layout settings. */
|
|
74
|
+
gridCartogramSettings?: Partial<GridCartogramSettings>
|
|
75
|
+
|
|
76
|
+
/** Dorling simulation settings. */
|
|
77
|
+
dorlingSettings?: Partial<DorlingSettings>
|
|
78
|
+
|
|
79
|
+
/** Show or hide the coastal margin effect. */
|
|
80
|
+
drawCoastalMargin?: boolean
|
|
81
|
+
/** Coastal margin settings to override defaults. */
|
|
82
|
+
coastalMarginSettings?: Partial<CoastalMarginSettings>
|
|
83
|
+
|
|
84
|
+
/** Graticule. */
|
|
85
|
+
drawGraticule?: boolean
|
|
86
|
+
|
|
87
|
+
/** Labels. */
|
|
88
|
+
labelling?: boolean
|
|
89
|
+
|
|
90
|
+
/** Fires once the map is built. */
|
|
91
|
+
onBuild?: (map: EurostatMap) => void
|
|
92
|
+
|
|
93
|
+
/** Allow additional properties for extensibility. */
|
|
94
|
+
[key: string]: any
|
|
95
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import type { StatConfig } from './stat/StatConfig'
|
|
2
|
+
import type { StatData } from './stat/StatData'
|
|
3
|
+
import type { LegendConfig } from '../legend/LegendConfig'
|
|
4
|
+
import type { TooltipConfig } from './TooltipConfig'
|
|
5
|
+
import type { InsetConfig } from './InsetConfig'
|
|
6
|
+
import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
|
|
7
|
+
import type { GridCartogramSettings } from './GridCartogramSettings'
|
|
8
|
+
import type { DorlingSettings } from './DorlingSettings'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A eurostat-map instance. Created by eurostatmap.map() and extended
|
|
12
|
+
* by each concrete map type. All getter/setter methods follow the same
|
|
13
|
+
* pattern: call with no argument to get, call with a value to set and
|
|
14
|
+
* return the instance for chaining.
|
|
15
|
+
*/
|
|
16
|
+
export interface MapInstance {
|
|
17
|
+
/** Container. */
|
|
18
|
+
|
|
19
|
+
/** ID of the target SVG element. @default 'map' */
|
|
20
|
+
svgId(): string
|
|
21
|
+
svgId(id: string): this
|
|
22
|
+
|
|
23
|
+
/** ID of the wrapper container element. */
|
|
24
|
+
containerId(): string
|
|
25
|
+
containerId(id: string): this
|
|
26
|
+
|
|
27
|
+
/** Dimensions. */
|
|
28
|
+
|
|
29
|
+
/** Map width in pixels. @default min(795, window.innerWidth) */
|
|
30
|
+
width(): number
|
|
31
|
+
width(w: number): this
|
|
32
|
+
|
|
33
|
+
/** Map height in pixels. 0 = auto (85% of width). */
|
|
34
|
+
height(): number
|
|
35
|
+
height(h: number): this
|
|
36
|
+
|
|
37
|
+
/** Geography. */
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* NUTS2JSON geographic focus area.
|
|
41
|
+
* @example 'EUR' | 'WORLD' | 'PT' | 'MT' | 'IC'
|
|
42
|
+
*/
|
|
43
|
+
geo(): string
|
|
44
|
+
geo(g: string): this
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* EPSG projection code for NUTS2JSON geometries.
|
|
48
|
+
* Use '4326' when setting a custom projectionFunction.
|
|
49
|
+
* @default '3035'
|
|
50
|
+
*/
|
|
51
|
+
proj(): string
|
|
52
|
+
proj(p: string): this
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* NUTS2JSON geometry resolution.
|
|
56
|
+
* @default '20M'
|
|
57
|
+
*/
|
|
58
|
+
scale(): string
|
|
59
|
+
scale(s: '60M' | '20M' | '10M' | '03M' | '01M'): this
|
|
60
|
+
|
|
61
|
+
/** NUTS level to display. @default 3 */
|
|
62
|
+
nutsLevel(): number | 'mixed'
|
|
63
|
+
nutsLevel(level: number | 'mixed'): this
|
|
64
|
+
|
|
65
|
+
/** NUTS boundaries year. @default 2024 */
|
|
66
|
+
nutsYear(): number
|
|
67
|
+
nutsYear(year: number): this
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Initial map viewport. x/y in projected coordinates, z is pixel size
|
|
71
|
+
* (map units per screen pixel — smaller = more zoomed in).
|
|
72
|
+
* @example map.position({ x: 4800000, y: 3400000, z: 6000 })
|
|
73
|
+
*/
|
|
74
|
+
position(v: { x?: number; y?: number; z?: number }): this
|
|
75
|
+
position(): { x: number; y: number; z: number }
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Custom D3 projection function. When set, also call proj('4326').
|
|
79
|
+
* @example map.projectionFunction(d3.geoAzimuthalEquidistant().rotate([-10, -52]))
|
|
80
|
+
*/
|
|
81
|
+
projectionFunction(): any
|
|
82
|
+
projectionFunction(fn: any): this
|
|
83
|
+
|
|
84
|
+
/** Text and labels. */
|
|
85
|
+
|
|
86
|
+
/** Map title. */
|
|
87
|
+
title(): string
|
|
88
|
+
title(t: string): this
|
|
89
|
+
|
|
90
|
+
/** Map subtitle. */
|
|
91
|
+
subtitle(): string
|
|
92
|
+
subtitle(t: string): this
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Footnote text shown at the bottom of the map.
|
|
96
|
+
* Defaults to the standard EuroGeographics copyright notice.
|
|
97
|
+
*/
|
|
98
|
+
footnote(): string | false
|
|
99
|
+
footnote(text: string | false): this
|
|
100
|
+
|
|
101
|
+
/** Tooltip text shown when hovering over the footnote. */
|
|
102
|
+
footnoteTooltipText(): string | false
|
|
103
|
+
footnoteTooltipText(text: string | false): this
|
|
104
|
+
|
|
105
|
+
/** Wrap footnote text at this many characters. */
|
|
106
|
+
footnoteWrap(): number | false
|
|
107
|
+
footnoteWrap(chars: number | false): this
|
|
108
|
+
|
|
109
|
+
/** Statistical data. */
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get or set statistical data configuration.
|
|
113
|
+
* - `map.stat()` → returns the default stat config
|
|
114
|
+
* - `map.stat(config)` → sets the default stat config
|
|
115
|
+
* - `map.stat('v1')` → returns the stat config for key 'v1'
|
|
116
|
+
* - `map.stat('v1', config)` → sets the stat config for key 'v1'
|
|
117
|
+
* @example map.stat({ eurostatDatasetCode: 'demo_r_d3dens', filters: { TIME: '2024' } })
|
|
118
|
+
*/
|
|
119
|
+
stat(): StatConfig
|
|
120
|
+
stat(config: StatConfig): this
|
|
121
|
+
stat(key: string): StatConfig
|
|
122
|
+
stat(key: string, config: StatConfig): this
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get or set the StatData instance for a given key.
|
|
126
|
+
* Use setData() on the returned instance to supply custom data.
|
|
127
|
+
* @example map.statData().setData({ DE: 120, FR: 95 })
|
|
128
|
+
*/
|
|
129
|
+
statData(): StatData
|
|
130
|
+
statData(key: string): StatData
|
|
131
|
+
statData(key: string, data: StatData): this
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Returns the time dimension value from the loaded Eurostat dataset.
|
|
135
|
+
* Useful for displaying the data period in the map title.
|
|
136
|
+
* @example map.onBuild(() => map.title('Population ' + map.getTime()))
|
|
137
|
+
*/
|
|
138
|
+
getTime(): string | undefined
|
|
139
|
+
|
|
140
|
+
/** Text shown for regions with no data. @default 'No data available' */
|
|
141
|
+
noDataText(): string
|
|
142
|
+
noDataText(text: string): this
|
|
143
|
+
|
|
144
|
+
/** BCP 47 language tag for Eurostat API labels. @default 'en' */
|
|
145
|
+
language(): string
|
|
146
|
+
language(lang: string): this
|
|
147
|
+
|
|
148
|
+
/** Legend. */
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get or set legend configuration. Pass false to remove the legend.
|
|
152
|
+
* @example map.legend({ x: 10, y: 90, title: 'Density, people/km²' })
|
|
153
|
+
*/
|
|
154
|
+
legend(): LegendConfig
|
|
155
|
+
legend(config: LegendConfig | false): this
|
|
156
|
+
|
|
157
|
+
/** Force-update the legend after data or style changes. */
|
|
158
|
+
updateLegend(): this
|
|
159
|
+
|
|
160
|
+
/** Tooltip. */
|
|
161
|
+
|
|
162
|
+
/** Get or set tooltip configuration. */
|
|
163
|
+
tooltip(): TooltipConfig
|
|
164
|
+
tooltip(config: TooltipConfig): this
|
|
165
|
+
|
|
166
|
+
/** Zoom and pan. */
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* D3 zoom scale extent [min, max].
|
|
170
|
+
* @example map.zoomExtent([1, 10])
|
|
171
|
+
*/
|
|
172
|
+
zoomExtent(): [number, number]
|
|
173
|
+
zoomExtent(extent: [number, number]): this
|
|
174
|
+
|
|
175
|
+
/** Show zoom +/- buttons. @default true */
|
|
176
|
+
zoomButtons(): boolean
|
|
177
|
+
zoomButtons(show: boolean): this
|
|
178
|
+
|
|
179
|
+
/** Grid cartogram settings (shape, margins, cell padding, layout positions). */
|
|
180
|
+
gridCartogramSettings(): GridCartogramSettings
|
|
181
|
+
gridCartogramSettings(settings: Partial<GridCartogramSettings>): this
|
|
182
|
+
|
|
183
|
+
/** Insets. */
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Inset map configurations. Pass 'default' for the standard
|
|
187
|
+
* eurostat overseas territory insets, false to disable.
|
|
188
|
+
* @example map.insets('default')
|
|
189
|
+
* @example map.insets([{ geo: 'MT' }, { geo: 'LI' }])
|
|
190
|
+
*/
|
|
191
|
+
insets(): InsetConfig[] | 'default' | false
|
|
192
|
+
insets(config: InsetConfig[] | 'default' | false): this
|
|
193
|
+
|
|
194
|
+
/** Decoration. */
|
|
195
|
+
|
|
196
|
+
/** Show/hide the graticule (coordinate grid lines). */
|
|
197
|
+
drawGraticule(): boolean
|
|
198
|
+
drawGraticule(show: boolean): this
|
|
199
|
+
|
|
200
|
+
/** Show/hide the coastal margin shadow effect. */
|
|
201
|
+
drawCoastalMargin(): boolean
|
|
202
|
+
drawCoastalMargin(show: boolean): this
|
|
203
|
+
|
|
204
|
+
/** Coastal margin appearance settings. */
|
|
205
|
+
coastalMarginSettings(): CoastalMarginSettings
|
|
206
|
+
coastalMarginSettings(settings: Partial<CoastalMarginSettings>): this
|
|
207
|
+
|
|
208
|
+
/** Show/hide placename labels loaded from the placenames layer. */
|
|
209
|
+
placenames(): boolean
|
|
210
|
+
placenames(show: boolean): this
|
|
211
|
+
|
|
212
|
+
/** Geographic label configuration. See docs/reference.md#labelling */
|
|
213
|
+
labels(): object | undefined
|
|
214
|
+
labels(config: object): this
|
|
215
|
+
|
|
216
|
+
/** Annotation configuration for d3-svg-annotation. */
|
|
217
|
+
annotations(): any
|
|
218
|
+
annotations(config: any): this
|
|
219
|
+
|
|
220
|
+
/** Stamp/watermark annotation. @example { x: 10, y: 10, text: 'DRAFT', size: 40 } */
|
|
221
|
+
stamp(): object | undefined
|
|
222
|
+
stamp(config: { x: number; y: number; text: string; size?: number }): this
|
|
223
|
+
|
|
224
|
+
/** Scalebar visibility. */
|
|
225
|
+
showScalebar(): boolean
|
|
226
|
+
showScalebar(show: boolean): this
|
|
227
|
+
|
|
228
|
+
/** Scalebar position [x, y] in pixels. */
|
|
229
|
+
scalebarPosition(): [number, number]
|
|
230
|
+
scalebarPosition(pos: [number, number]): this
|
|
231
|
+
|
|
232
|
+
/** Show the Eurostat logo. */
|
|
233
|
+
showEstatLogo(): boolean
|
|
234
|
+
showEstatLogo(show: boolean): this
|
|
235
|
+
|
|
236
|
+
/** Show the Eurostat ribbon banner. */
|
|
237
|
+
showEstatRibbon(): boolean
|
|
238
|
+
showEstatRibbon(show: boolean): this
|
|
239
|
+
|
|
240
|
+
/** Dorling. */
|
|
241
|
+
|
|
242
|
+
/** Enable Dorling cartogram layout for proportional symbol maps. */
|
|
243
|
+
dorling(): boolean
|
|
244
|
+
dorling(enable: boolean): this
|
|
245
|
+
|
|
246
|
+
/** Dorling simulation settings. */
|
|
247
|
+
dorlingSettings(): DorlingSettings
|
|
248
|
+
dorlingSettings(settings: Partial<DorlingSettings>): this
|
|
249
|
+
|
|
250
|
+
/** Events. */
|
|
251
|
+
|
|
252
|
+
/** Called when the user finishes a zoom gesture. */
|
|
253
|
+
onZoomEnd(): ((event: any) => void) | undefined
|
|
254
|
+
onZoomEnd(fn: (event: any) => void): this
|
|
255
|
+
|
|
256
|
+
/** Called continuously while the user is zooming. */
|
|
257
|
+
onZoom(): ((event: any) => void) | undefined
|
|
258
|
+
onZoom(fn: (event: any) => void): this
|
|
259
|
+
|
|
260
|
+
/** Called when the pointer enters a NUTS region. */
|
|
261
|
+
onRegionMouseOver(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
262
|
+
onRegionMouseOver(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
263
|
+
|
|
264
|
+
/** Called when the pointer moves over a NUTS region. */
|
|
265
|
+
onRegionMouseMove(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
266
|
+
onRegionMouseMove(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
267
|
+
|
|
268
|
+
/** Called when the pointer leaves a NUTS region. */
|
|
269
|
+
onRegionMouseOut(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
270
|
+
onRegionMouseOut(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
271
|
+
|
|
272
|
+
/** Called when a NUTS region is clicked. */
|
|
273
|
+
onRegionClick(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
274
|
+
onRegionClick(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Callback fired once after the map has fully built (geo + stat data loaded).
|
|
278
|
+
* Receives the map instance as its only argument.
|
|
279
|
+
* @example map.onBuild(m => console.log('Map ready', m))
|
|
280
|
+
*/
|
|
281
|
+
onBuild(): ((map: MapInstance) => void) | undefined
|
|
282
|
+
onBuild(callback: (map: MapInstance) => void): this
|
|
283
|
+
|
|
284
|
+
/** Build and update. */
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Builds the map from scratch. Call once after initial configuration.
|
|
288
|
+
* @example
|
|
289
|
+
* eurostatmap.map('choropleth')
|
|
290
|
+
* .stat({ eurostatDatasetCode: 'demo_r_d3dens' })
|
|
291
|
+
* .build()
|
|
292
|
+
*/
|
|
293
|
+
build(): this
|
|
294
|
+
|
|
295
|
+
/** Re-fetches geo data and rebuilds map geometry. */
|
|
296
|
+
updateGeoData(): this
|
|
297
|
+
|
|
298
|
+
/** Re-fetches all stat datasets and refreshes the map. */
|
|
299
|
+
updateStatData(): this
|
|
300
|
+
|
|
301
|
+
/** Re-applies classification and styling from currently loaded data. */
|
|
302
|
+
updateStatValues(): this
|
|
303
|
+
|
|
304
|
+
/** Updates data classification (class breaks, thresholds). */
|
|
305
|
+
updateClassification(): this
|
|
306
|
+
|
|
307
|
+
/** Re-applies visual styling (colors, symbol sizes). */
|
|
308
|
+
updateStyle(): this
|
|
309
|
+
|
|
310
|
+
/** Recalculates header/footer layout and resizes the SVG. */
|
|
311
|
+
recalculateLayout(): void
|
|
312
|
+
|
|
313
|
+
/** Export. */
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Exports the map as an SVG file and triggers a browser download.
|
|
317
|
+
* Computed CSS styles are inlined before export.
|
|
318
|
+
*/
|
|
319
|
+
exportMapToSVG(): this
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Exports the map as a PNG file and triggers a browser download.
|
|
323
|
+
* @param width - Output width in pixels. Defaults to SVG width.
|
|
324
|
+
* @param height - Output height in pixels. Defaults to SVG height.
|
|
325
|
+
*/
|
|
326
|
+
exportMapToPNG(width?: number, height?: number): Promise<this>
|
|
327
|
+
|
|
328
|
+
/** Misc. */
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Sets map attributes from URL parameters.
|
|
332
|
+
* Supported params: w, h, x, y, z, s, lvl, time, proj, geo, ny, language, numberOfClasses
|
|
333
|
+
*/
|
|
334
|
+
setFromURL(): this
|
|
335
|
+
|
|
336
|
+
/** D3 transition duration in milliseconds for map updates. @default 500 */
|
|
337
|
+
transitionDuration(): number
|
|
338
|
+
transitionDuration(ms: number): this
|
|
339
|
+
|
|
340
|
+
/** SVG filter/pattern definition function for fill patterns. */
|
|
341
|
+
filtersDefinitionFunction(): ((svg: any, numberOfClasses: number) => void) | undefined
|
|
342
|
+
filtersDefinitionFunction(fn: (svg: any, numberOfClasses: number) => void): this
|
|
343
|
+
|
|
344
|
+
/** Returns region centroids as an array of projected coordinate pairs. */
|
|
345
|
+
regionCentroids(): Array<{ id: string; x: number; y: number }>
|
|
346
|
+
|
|
347
|
+
/** Allow additional map-type-specific properties and methods. */
|
|
348
|
+
[key: string]: any
|
|
349
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the minimap globe feature.
|
|
3
|
+
*/
|
|
4
|
+
export interface MinimapConfig {
|
|
5
|
+
/** Size of the minimap in pixels. @default 150 */
|
|
6
|
+
size?: number
|
|
7
|
+
/** Debounce delay in milliseconds for updating the minimap during zoom/pan. @default 3 */
|
|
8
|
+
debounce?: number
|
|
9
|
+
/** Position [x, y] in pixels. If not specified, positioned in top-left corner */
|
|
10
|
+
position?: [number, number]
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MapInstance as EurostatMap } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for tooltips
|
|
5
|
+
*/
|
|
6
|
+
export interface TooltipConfig {
|
|
7
|
+
textFunction?: (region: any, map: EurostatMap) => string
|
|
8
|
+
/** Omit regions. */
|
|
9
|
+
omitRegions?: string[]
|
|
10
|
+
/** Max width. */
|
|
11
|
+
maxWidth?: number
|
|
12
|
+
/** Font size. */
|
|
13
|
+
fontSize?: number
|
|
14
|
+
|
|
15
|
+
[key: string]: any
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual settings for the coastal margin effect.
|
|
3
|
+
*/
|
|
4
|
+
export interface CoastalMarginSettings {
|
|
5
|
+
/** Gaussian blur standard deviation. */
|
|
6
|
+
standardDeviation: number
|
|
7
|
+
/** Filter x bound (SVG filter coordinate space). */
|
|
8
|
+
x: string
|
|
9
|
+
/** Filter y bound (SVG filter coordinate space). */
|
|
10
|
+
y: string
|
|
11
|
+
/** Filter width (SVG filter coordinate space). */
|
|
12
|
+
width: string
|
|
13
|
+
/** Filter height (SVG filter coordinate space). */
|
|
14
|
+
height: string
|
|
15
|
+
/** Coastal stroke width. */
|
|
16
|
+
strokeWidth: number
|
|
17
|
+
/** Coastal stroke color. */
|
|
18
|
+
color: string
|
|
19
|
+
/** Coastal stroke opacity. */
|
|
20
|
+
opacity: number
|
|
21
|
+
}
|