eurostat-map 4.3.57 → 4.4.0
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/build/215.eurostatmap.min.js +1 -1
- package/build/eurostatmap.js +11755 -13012
- 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/InsetConfig.d.ts +15 -0
- package/build/types/core/MapConfig.d.ts +85 -0
- package/build/types/core/MapInstance.d.ts +354 -0
- package/build/types/core/MinimapConfig.d.ts +11 -0
- package/build/types/core/TooltipConfig.d.ts +13 -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 +56 -0
- package/build/types/core/geo/kosovo.d.ts +10 -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 +107 -0
- package/build/types/core/utils.d.ts +194 -0
- package/build/types/core/zoom.d.ts +21 -0
- package/build/types/index.d.ts +237 -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 +43 -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 +68 -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/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 +15 -0
- package/build/types/map-types/choropleth/BivariateChoroplethMap.d.ts +39 -0
- package/build/types/map-types/choropleth/ChoroplethConfig.d.ts +29 -0
- package/build/types/map-types/choropleth/ChoroplethMap.d.ts +48 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethConfig.d.ts +18 -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 +21 -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 +78 -0
- package/build/types/map-types/composition/bar/BarMapConfig.d.ts +30 -0
- package/build/types/map-types/composition/composition-map.d.ts +25 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +42 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +18 -0
- package/build/types/map-types/composition/coxcomb/CoxcombStatConfig.d.ts +14 -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 +62 -0
- package/build/types/map-types/composition/pie/PieMapConfig.d.ts +24 -0
- package/build/types/map-types/composition/stripe/StripeMap.d.ts +43 -0
- package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +16 -0
- package/build/types/map-types/composition/waffle/WaffleMap.d.ts +71 -0
- package/build/types/map-types/composition/waffle/WaffleMapConfig.d.ts +25 -0
- package/build/types/map-types/flow/FlowMap.d.ts +97 -0
- package/build/types/map-types/flow/FlowMapConfig.d.ts +103 -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 +24 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +99 -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 +15 -0
- package/build/types/map-types/spark/SparkMap.d.ts +48 -0
- package/build/types/map-types/spark/SparkMapConfig.d.ts +25 -0
- package/build/types/map-types/spark/SparkStatConfig.d.ts +10 -0
- package/build/types/utils/FillPatternOptions.d.ts +17 -0
- package/package.json +8 -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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for map insets (smaller additional maps)
|
|
3
|
+
*/
|
|
4
|
+
export interface InsetConfig {
|
|
5
|
+
geo?: string // Geographic code (e.g., 'MT', 'PT20', 'CARIB')
|
|
6
|
+
title?: string
|
|
7
|
+
scale?: string | number
|
|
8
|
+
width?: number
|
|
9
|
+
height?: number
|
|
10
|
+
x?: number
|
|
11
|
+
y?: number
|
|
12
|
+
proj?: string
|
|
13
|
+
|
|
14
|
+
[key: string]: any
|
|
15
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 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.
|
|
9
|
+
*/
|
|
10
|
+
export interface MapConfig {
|
|
11
|
+
// Container settings
|
|
12
|
+
svgId?: string
|
|
13
|
+
containerId?: string
|
|
14
|
+
|
|
15
|
+
// Geographic settings
|
|
16
|
+
proj?: string // NUTS2json geometries projection: '3035', '3857', '4326'. For custom projections use 4326, then set the desired projection with projectionFunction()
|
|
17
|
+
projectionFunction?: () => any // Function to set a custom projection. See d3-geo projections for examples.
|
|
18
|
+
scale?: '60M' | '20M' | '10M' | '03M' | '01M' // Scale of the map, for NUTSjson geometries
|
|
19
|
+
nutsLevel?: number // 0, 1, 2, 3
|
|
20
|
+
nutsYear?: number | string
|
|
21
|
+
geoCenter?: [number, number]
|
|
22
|
+
pixSize?: number
|
|
23
|
+
|
|
24
|
+
// Geometry settings
|
|
25
|
+
geo?: string // NUTS2JSON Geographic focus (e.g., 'EUR', 'WORLD', 'IC', 'GF') see https://github.com/eurostat/Nuts2json#overseas-territories---map-insets
|
|
26
|
+
|
|
27
|
+
// Map dimensions
|
|
28
|
+
width?: number
|
|
29
|
+
height?: number
|
|
30
|
+
|
|
31
|
+
// map texts
|
|
32
|
+
title?: string
|
|
33
|
+
subtitle?: string
|
|
34
|
+
bottomText?: string
|
|
35
|
+
botTxtFontSize?: number
|
|
36
|
+
botTxtPadding?: number
|
|
37
|
+
botTxtTooltipMessage?: string
|
|
38
|
+
footnote?: string
|
|
39
|
+
source?: string
|
|
40
|
+
|
|
41
|
+
// Statistical data configuration
|
|
42
|
+
stat?: StatConfig
|
|
43
|
+
|
|
44
|
+
// Legend configuration
|
|
45
|
+
legend?: LegendConfig
|
|
46
|
+
|
|
47
|
+
// Tooltip configuration
|
|
48
|
+
tooltip?: TooltipConfig
|
|
49
|
+
|
|
50
|
+
// Insets (small additional maps)
|
|
51
|
+
insets?: InsetConfig[]
|
|
52
|
+
|
|
53
|
+
// Zoom and pan settings
|
|
54
|
+
zoomExtent?: [number, number]
|
|
55
|
+
|
|
56
|
+
// UI Controls
|
|
57
|
+
showBtns?: boolean // Show zoom buttons
|
|
58
|
+
|
|
59
|
+
// Coastal margin
|
|
60
|
+
coastal?: boolean
|
|
61
|
+
coastalMarginWidth?: number
|
|
62
|
+
coastalMarginColor?: string
|
|
63
|
+
|
|
64
|
+
// Graticule
|
|
65
|
+
drawGraticule?: boolean
|
|
66
|
+
graticuleStyle?: any
|
|
67
|
+
|
|
68
|
+
// Borders
|
|
69
|
+
borderWidth?: number
|
|
70
|
+
borderColor?: string
|
|
71
|
+
|
|
72
|
+
// Labels
|
|
73
|
+
labelling?: boolean
|
|
74
|
+
labelSizeThreshold?: number
|
|
75
|
+
labelOpacity?: number
|
|
76
|
+
|
|
77
|
+
// Logo
|
|
78
|
+
logoURL?: string
|
|
79
|
+
|
|
80
|
+
// Callbacks
|
|
81
|
+
onBuild?: (map: EurostatMap) => void
|
|
82
|
+
|
|
83
|
+
// Allow additional properties for extensibility
|
|
84
|
+
[key: string]: any
|
|
85
|
+
}
|
|
@@ -0,0 +1,354 @@
|
|
|
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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A eurostat-map instance. Created by eurostatmap.map() and extended
|
|
9
|
+
* by each concrete map type. All getter/setter methods follow the same
|
|
10
|
+
* pattern: call with no argument to get, call with a value to set and
|
|
11
|
+
* return the instance for chaining.
|
|
12
|
+
*/
|
|
13
|
+
export interface MapInstance {
|
|
14
|
+
// ==================== Container ====================
|
|
15
|
+
|
|
16
|
+
/** ID of the target SVG element. @default 'map' */
|
|
17
|
+
svgId(): string
|
|
18
|
+
svgId(id: string): this
|
|
19
|
+
|
|
20
|
+
/** ID of the wrapper container element. */
|
|
21
|
+
containerId(): string
|
|
22
|
+
containerId(id: string): this
|
|
23
|
+
|
|
24
|
+
// ==================== Dimensions ====================
|
|
25
|
+
|
|
26
|
+
/** Map width in pixels. @default min(795, window.innerWidth) */
|
|
27
|
+
width(): number
|
|
28
|
+
width(w: number): this
|
|
29
|
+
|
|
30
|
+
/** Map height in pixels. 0 = auto (85% of width). */
|
|
31
|
+
height(): number
|
|
32
|
+
height(h: number): this
|
|
33
|
+
|
|
34
|
+
// ==================== Geography ====================
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* NUTS2JSON geographic focus area.
|
|
38
|
+
* @example 'EUR' | 'WORLD' | 'PT' | 'MT' | 'IC'
|
|
39
|
+
*/
|
|
40
|
+
geo(): string
|
|
41
|
+
geo(g: string): this
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* EPSG projection code for NUTS2JSON geometries.
|
|
45
|
+
* Use '4326' when setting a custom projectionFunction.
|
|
46
|
+
* @default '3035'
|
|
47
|
+
*/
|
|
48
|
+
proj(): string
|
|
49
|
+
proj(p: string): this
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* NUTS2JSON geometry resolution.
|
|
53
|
+
* @default '20M'
|
|
54
|
+
*/
|
|
55
|
+
scale(): string
|
|
56
|
+
scale(s: '60M' | '20M' | '10M' | '03M' | '01M'): this
|
|
57
|
+
|
|
58
|
+
/** NUTS level to display. @default 3 */
|
|
59
|
+
nutsLevel(): number | 'mixed'
|
|
60
|
+
nutsLevel(level: number | 'mixed'): this
|
|
61
|
+
|
|
62
|
+
/** NUTS boundaries year. @default 2024 */
|
|
63
|
+
nutsYear(): number
|
|
64
|
+
nutsYear(year: number): this
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Initial map viewport. x/y in projected coordinates, z is pixel size
|
|
68
|
+
* (map units per screen pixel — smaller = more zoomed in).
|
|
69
|
+
* @example map.position({ x: 4800000, y: 3400000, z: 6000 })
|
|
70
|
+
*/
|
|
71
|
+
position(v: { x?: number; y?: number; z?: number }): this
|
|
72
|
+
position(): { x: number; y: number; z: number }
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Custom D3 projection function. When set, also call proj('4326').
|
|
76
|
+
* @example map.projectionFunction(d3.geoAzimuthalEquidistant().rotate([-10, -52]))
|
|
77
|
+
*/
|
|
78
|
+
projectionFunction(): any
|
|
79
|
+
projectionFunction(fn: any): this
|
|
80
|
+
|
|
81
|
+
// ==================== Text & Labels ====================
|
|
82
|
+
|
|
83
|
+
/** Map title. */
|
|
84
|
+
title(): string
|
|
85
|
+
title(t: string): this
|
|
86
|
+
|
|
87
|
+
/** Map subtitle. */
|
|
88
|
+
subtitle(): string
|
|
89
|
+
subtitle(t: string): this
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Footnote text shown at the bottom of the map.
|
|
93
|
+
* Defaults to the standard EuroGeographics copyright notice.
|
|
94
|
+
*/
|
|
95
|
+
footnote(): string | false
|
|
96
|
+
footnote(text: string | false): this
|
|
97
|
+
|
|
98
|
+
/** Tooltip text shown when hovering over the footnote. */
|
|
99
|
+
footnoteTooltipText(): string | false
|
|
100
|
+
footnoteTooltipText(text: string | false): this
|
|
101
|
+
|
|
102
|
+
/** Wrap footnote text at this many characters. */
|
|
103
|
+
footnoteWrap(): number | false
|
|
104
|
+
footnoteWrap(chars: number | false): this
|
|
105
|
+
|
|
106
|
+
// ==================== Statistical Data ====================
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get or set statistical data configuration.
|
|
110
|
+
* - `map.stat()` → returns the default stat config
|
|
111
|
+
* - `map.stat(config)` → sets the default stat config
|
|
112
|
+
* - `map.stat('v1')` → returns the stat config for key 'v1'
|
|
113
|
+
* - `map.stat('v1', config)` → sets the stat config for key 'v1'
|
|
114
|
+
* @example map.stat({ eurostatDatasetCode: 'demo_r_d3dens', filters: { TIME: '2024' } })
|
|
115
|
+
*/
|
|
116
|
+
stat(): StatConfig
|
|
117
|
+
stat(config: StatConfig): this
|
|
118
|
+
stat(key: string): StatConfig
|
|
119
|
+
stat(key: string, config: StatConfig): this
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get or set the StatData instance for a given key.
|
|
123
|
+
* Use setData() on the returned instance to supply custom data.
|
|
124
|
+
* @example map.statData().setData({ DE: 120, FR: 95 })
|
|
125
|
+
*/
|
|
126
|
+
statData(): StatData
|
|
127
|
+
statData(key: string): StatData
|
|
128
|
+
statData(key: string, data: StatData): this
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns the time dimension value from the loaded Eurostat dataset.
|
|
132
|
+
* Useful for displaying the data period in the map title.
|
|
133
|
+
* @example map.onBuild(() => map.title('Population ' + map.getTime()))
|
|
134
|
+
*/
|
|
135
|
+
getTime(): string | undefined
|
|
136
|
+
|
|
137
|
+
/** Text shown for regions with no data. @default 'No data available' */
|
|
138
|
+
noDataText(): string
|
|
139
|
+
noDataText(text: string): this
|
|
140
|
+
|
|
141
|
+
/** BCP 47 language tag for Eurostat API labels. @default 'en' */
|
|
142
|
+
language(): string
|
|
143
|
+
language(lang: string): this
|
|
144
|
+
|
|
145
|
+
// ==================== Legend ====================
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get or set legend configuration. Pass false to remove the legend.
|
|
149
|
+
* @example map.legend({ x: 10, y: 90, title: 'Density, people/km²' })
|
|
150
|
+
*/
|
|
151
|
+
legend(): LegendConfig
|
|
152
|
+
legend(config: LegendConfig | false): this
|
|
153
|
+
|
|
154
|
+
/** Force-update the legend after data or style changes. */
|
|
155
|
+
updateLegend(): this
|
|
156
|
+
|
|
157
|
+
// ==================== Tooltip ====================
|
|
158
|
+
|
|
159
|
+
/** Get or set tooltip configuration. */
|
|
160
|
+
tooltip(): TooltipConfig
|
|
161
|
+
tooltip(config: TooltipConfig): this
|
|
162
|
+
|
|
163
|
+
// ==================== Zoom & Pan ====================
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* D3 zoom scale extent [min, max].
|
|
167
|
+
* @example map.zoomExtent([1, 10])
|
|
168
|
+
*/
|
|
169
|
+
zoomExtent(): [number, number]
|
|
170
|
+
zoomExtent(extent: [number, number]): this
|
|
171
|
+
|
|
172
|
+
/** Show zoom +/- buttons. @default true */
|
|
173
|
+
zoomButtons(): boolean
|
|
174
|
+
zoomButtons(show: boolean): this
|
|
175
|
+
|
|
176
|
+
// ==================== Insets ====================
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Inset map configurations. Pass 'default' for the standard
|
|
180
|
+
* eurostat overseas territory insets, false to disable.
|
|
181
|
+
* @example map.insets('default')
|
|
182
|
+
* @example map.insets([{ geo: 'MT' }, { geo: 'LI' }])
|
|
183
|
+
*/
|
|
184
|
+
insets(): InsetConfig[] | 'default' | false
|
|
185
|
+
insets(config: InsetConfig[] | 'default' | false): this
|
|
186
|
+
|
|
187
|
+
// ==================== Decoration ====================
|
|
188
|
+
|
|
189
|
+
/** Show/hide the graticule (coordinate grid lines). */
|
|
190
|
+
drawGraticule(): boolean
|
|
191
|
+
drawGraticule(show: boolean): this
|
|
192
|
+
|
|
193
|
+
/** Show/hide the coastal margin shadow effect. */
|
|
194
|
+
drawCoastalMargin(): boolean
|
|
195
|
+
drawCoastalMargin(show: boolean): this
|
|
196
|
+
|
|
197
|
+
/** Coastal margin appearance settings. */
|
|
198
|
+
coastalMarginSettings(): object
|
|
199
|
+
coastalMarginSettings(settings: object): this
|
|
200
|
+
|
|
201
|
+
/** Show/hide placename labels loaded from the placenames layer. */
|
|
202
|
+
placenames(): boolean
|
|
203
|
+
placenames(show: boolean): this
|
|
204
|
+
|
|
205
|
+
/** Geographic label configuration. See docs/reference.md#labelling */
|
|
206
|
+
labels(): object | undefined
|
|
207
|
+
labels(config: object): this
|
|
208
|
+
|
|
209
|
+
/** Annotation configuration for d3-svg-annotation. */
|
|
210
|
+
annotations(): any
|
|
211
|
+
annotations(config: any): this
|
|
212
|
+
|
|
213
|
+
/** Stamp/watermark annotation. @example { x: 10, y: 10, text: 'DRAFT', size: 40 } */
|
|
214
|
+
stamp(): object | undefined
|
|
215
|
+
stamp(config: { x: number; y: number; text: string; size?: number }): this
|
|
216
|
+
|
|
217
|
+
/** Scalebar visibility. */
|
|
218
|
+
showScalebar(): boolean
|
|
219
|
+
showScalebar(show: boolean): this
|
|
220
|
+
|
|
221
|
+
/** Scalebar position [x, y] in pixels. */
|
|
222
|
+
scalebarPosition(): [number, number]
|
|
223
|
+
scalebarPosition(pos: [number, number]): this
|
|
224
|
+
|
|
225
|
+
/** Show the Eurostat logo. */
|
|
226
|
+
showEstatLogo(): boolean
|
|
227
|
+
showEstatLogo(show: boolean): this
|
|
228
|
+
|
|
229
|
+
/** Show the Eurostat ribbon banner. */
|
|
230
|
+
showEstatRibbon(): boolean
|
|
231
|
+
showEstatRibbon(show: boolean): this
|
|
232
|
+
|
|
233
|
+
// ==================== Dorling ====================
|
|
234
|
+
|
|
235
|
+
/** Enable Dorling cartogram layout for proportional symbol maps. */
|
|
236
|
+
dorling(): boolean
|
|
237
|
+
dorling(enable: boolean): this
|
|
238
|
+
|
|
239
|
+
/** Animate the Dorling simulation. @default true */
|
|
240
|
+
animateDorling(): boolean
|
|
241
|
+
animateDorling(animate: boolean): this
|
|
242
|
+
|
|
243
|
+
/** Dorling simulation gravity strength. @default { x: 1, y: 1 } */
|
|
244
|
+
dorlingStrength(): { x: number; y: number }
|
|
245
|
+
dorlingStrength(strength: { x: number; y: number }): this
|
|
246
|
+
|
|
247
|
+
/** Number of Dorling collision detection iterations. @default 1 */
|
|
248
|
+
dorlingIterations(): number
|
|
249
|
+
dorlingIterations(n: number): this
|
|
250
|
+
|
|
251
|
+
/** Minimum distance between Dorling circles. Negative allows overlap. @default 0 */
|
|
252
|
+
dorlingPadding(): number
|
|
253
|
+
dorlingPadding(padding: number): this
|
|
254
|
+
|
|
255
|
+
// ==================== Events ====================
|
|
256
|
+
|
|
257
|
+
/** Called when the user finishes a zoom gesture. */
|
|
258
|
+
onZoomEnd(): ((event: any) => void) | undefined
|
|
259
|
+
onZoomEnd(fn: (event: any) => void): this
|
|
260
|
+
|
|
261
|
+
/** Called continuously while the user is zooming. */
|
|
262
|
+
onZoom(): ((event: any) => void) | undefined
|
|
263
|
+
onZoom(fn: (event: any) => void): this
|
|
264
|
+
|
|
265
|
+
/** Called when the pointer enters a NUTS region. */
|
|
266
|
+
onRegionMouseOver(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
267
|
+
onRegionMouseOver(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
268
|
+
|
|
269
|
+
/** Called when the pointer moves over a NUTS region. */
|
|
270
|
+
onRegionMouseMove(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
271
|
+
onRegionMouseMove(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
272
|
+
|
|
273
|
+
/** Called when the pointer leaves a NUTS region. */
|
|
274
|
+
onRegionMouseOut(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
275
|
+
onRegionMouseOut(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
276
|
+
|
|
277
|
+
/** Called when a NUTS region is clicked. */
|
|
278
|
+
onRegionClick(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
|
|
279
|
+
onRegionClick(fn: (event: MouseEvent, regionId: string, props: any) => void): this
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Callback fired once after the map has fully built (geo + stat data loaded).
|
|
283
|
+
* Receives the map instance as its only argument.
|
|
284
|
+
* @example map.onBuild(m => console.log('Map ready', m))
|
|
285
|
+
*/
|
|
286
|
+
onBuild(): ((map: MapInstance) => void) | undefined
|
|
287
|
+
onBuild(callback: (map: MapInstance) => void): this
|
|
288
|
+
|
|
289
|
+
// ==================== Build & Update ====================
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Builds the map from scratch. Call once after initial configuration.
|
|
293
|
+
* @example
|
|
294
|
+
* eurostatmap.map('choropleth')
|
|
295
|
+
* .stat({ eurostatDatasetCode: 'demo_r_d3dens' })
|
|
296
|
+
* .build()
|
|
297
|
+
*/
|
|
298
|
+
build(): this
|
|
299
|
+
|
|
300
|
+
/** Re-fetches geo data and rebuilds map geometry. */
|
|
301
|
+
updateGeoData(): this
|
|
302
|
+
|
|
303
|
+
/** Re-fetches all stat datasets and refreshes the map. */
|
|
304
|
+
updateStatData(): this
|
|
305
|
+
|
|
306
|
+
/** Re-applies classification and styling from currently loaded data. */
|
|
307
|
+
updateStatValues(): this
|
|
308
|
+
|
|
309
|
+
/** Updates data classification (class breaks, thresholds). */
|
|
310
|
+
updateClassification(): this
|
|
311
|
+
|
|
312
|
+
/** Re-applies visual styling (colors, symbol sizes). */
|
|
313
|
+
updateStyle(): this
|
|
314
|
+
|
|
315
|
+
/** Recalculates header/footer layout and resizes the SVG. */
|
|
316
|
+
recalculateLayout(): void
|
|
317
|
+
|
|
318
|
+
// ==================== Export ====================
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Exports the map as an SVG file and triggers a browser download.
|
|
322
|
+
* Computed CSS styles are inlined before export.
|
|
323
|
+
*/
|
|
324
|
+
exportMapToSVG(): this
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Exports the map as a PNG file and triggers a browser download.
|
|
328
|
+
* @param width - Output width in pixels. Defaults to SVG width.
|
|
329
|
+
* @param height - Output height in pixels. Defaults to SVG height.
|
|
330
|
+
*/
|
|
331
|
+
exportMapToPNG(width?: number, height?: number): Promise<this>
|
|
332
|
+
|
|
333
|
+
// ==================== Misc ====================
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Sets map attributes from URL parameters.
|
|
337
|
+
* Supported params: w, h, x, y, z, s, lvl, time, proj, geo, ny, language, numberOfClasses
|
|
338
|
+
*/
|
|
339
|
+
setFromURL(): this
|
|
340
|
+
|
|
341
|
+
/** D3 transition duration in milliseconds for map updates. @default 500 */
|
|
342
|
+
transitionDuration(): number
|
|
343
|
+
transitionDuration(ms: number): this
|
|
344
|
+
|
|
345
|
+
/** SVG filter/pattern definition function for fill patterns. */
|
|
346
|
+
filtersDefinitionFunction(): ((svg: any, numberOfClasses: number) => void) | undefined
|
|
347
|
+
filtersDefinitionFunction(fn: (svg: any, numberOfClasses: number) => void): this
|
|
348
|
+
|
|
349
|
+
/** Returns region centroids as an array of projected coordinate pairs. */
|
|
350
|
+
regionCentroids(): Array<{ id: string; x: number; y: number }>
|
|
351
|
+
|
|
352
|
+
/** Allow additional map-type-specific properties and methods. */
|
|
353
|
+
[key: string]: any
|
|
354
|
+
}
|
|
@@ -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,13 @@
|
|
|
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
|
+
omitRegions?: string[]
|
|
9
|
+
maxWidth?: number
|
|
10
|
+
fontSize?: number
|
|
11
|
+
|
|
12
|
+
[key: string]: any
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface ScalebarConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to show the scalebar.
|
|
4
|
+
* Replaces showScalebar(true/false).
|
|
5
|
+
*/
|
|
6
|
+
show?: boolean
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Scalebar anchor position in SVG pixels: [x, y]
|
|
10
|
+
*/
|
|
11
|
+
position?: [number, number]
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Label suffix, usually " km", but can also be " m", " mi", etc.
|
|
15
|
+
* Note: current implementation still computes values in metres internally.
|
|
16
|
+
*/
|
|
17
|
+
units?: string
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Label offset from the tick position: [x, y]
|
|
21
|
+
*/
|
|
22
|
+
textOffset?: [number, number]
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Maximum width of the scalebar in pixels.
|
|
26
|
+
*/
|
|
27
|
+
maxWidth?: number
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Total height reserved for the scalebar group in pixels.
|
|
31
|
+
*/
|
|
32
|
+
height?: number
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Stroke width used by scalebar lines.
|
|
36
|
+
*/
|
|
37
|
+
strokeWidth?: number
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Height of the horizontal middle segment line.
|
|
41
|
+
*/
|
|
42
|
+
segmentHeight?: number
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Height of the vertical ticks.
|
|
46
|
+
*/
|
|
47
|
+
tickHeight?: number
|
|
48
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a stamp/watermark annotation rendered on the map.
|
|
3
|
+
* @example
|
|
4
|
+
* map.stamp({ x: 230, y: 100, text: 'DRAFT', shape: 'circle', size: 60 })
|
|
5
|
+
*/
|
|
6
|
+
export interface StampConfig {
|
|
7
|
+
/** Text content of the stamp. Use ¶ for forced line breaks, ~ for non-breaking spaces. */
|
|
8
|
+
text: string
|
|
9
|
+
|
|
10
|
+
/** Horizontal centre position in SVG pixels. @default 230 */
|
|
11
|
+
x?: number
|
|
12
|
+
|
|
13
|
+
/** Vertical centre position in SVG pixels. @default 100 */
|
|
14
|
+
y?: number
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shape of the stamp border.
|
|
18
|
+
* @default 'circle'
|
|
19
|
+
*/
|
|
20
|
+
shape?: 'circle' | 'square' | 'rectangle' | 'eu-stars'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Size of the stamp in SVG pixels.
|
|
24
|
+
* For circle/square: diameter. For rectangle: controls text fit height.
|
|
25
|
+
* Ignored when fontSize is set.
|
|
26
|
+
* @default 60
|
|
27
|
+
*/
|
|
28
|
+
size?: number
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Fix the rendered font size in pixels and let the shape grow to contain
|
|
32
|
+
* the text, instead of scaling text to fit a fixed shape size.
|
|
33
|
+
*/
|
|
34
|
+
fontSize?: number
|
|
35
|
+
|
|
36
|
+
/** Text colour. @default '#585858' */
|
|
37
|
+
textColor?: string
|
|
38
|
+
|
|
39
|
+
/** Border/shape colour. @default '#9e9e9e' */
|
|
40
|
+
stampColor?: string
|
|
41
|
+
|
|
42
|
+
/** Border stroke width in pixels. @default 1 */
|
|
43
|
+
strokeWidth?: number
|
|
44
|
+
|
|
45
|
+
/** Line height of the unscaled text element in pixels. @default 15 */
|
|
46
|
+
lineHeight?: number
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Text horizontal alignment.
|
|
50
|
+
* 'middle': stamp is centred on x (default).
|
|
51
|
+
* 'start': stamp's left edge is at x, growing rightward.
|
|
52
|
+
* @default 'middle'
|
|
53
|
+
*/
|
|
54
|
+
textAnchor?: 'middle' | 'start'
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Padding between the text and the shape border in pixels.
|
|
58
|
+
* @default 0 for circle/square/eu-stars, 1 for rectangle
|
|
59
|
+
*/
|
|
60
|
+
padding?: number
|
|
61
|
+
|
|
62
|
+
/** Corner radius for square and rectangle shapes (SVG rx attribute). @default 0 */
|
|
63
|
+
rx?: number
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Size multiplier for individual stars in the 'eu-stars' shape.
|
|
67
|
+
* Does not affect the ring radius.
|
|
68
|
+
* @default 1
|
|
69
|
+
*/
|
|
70
|
+
starSize?: number
|
|
71
|
+
}
|