eurostat-map 4.10.4 → 4.10.6

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.
@@ -1,555 +1,555 @@
1
- import type { StatConfig } from './stat/StatConfig'
2
- import type { StatData } from './stat/StatData'
3
- import type { Layer } from './layer/Layer'
4
- import type { LayerConfig } from './layer/LayerConfig'
5
- import type { CompositionStatConfig } from '../layers/composition/CompositionStatConfig'
6
- import type { LegendConfig } from '../legend/LegendConfig'
7
- import type { RankedBarChartConfig } from './decoration/RankedBarChartConfig'
8
- import type { TooltipConfig } from './TooltipConfig'
9
- import type { InsetConfig } from './InsetConfig'
10
- import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
11
- import type { GridCartogramSettings } from './GridCartogramSettings'
12
- import type { DorlingSettings } from './DorlingSettings'
13
- import type { ScalebarConfig } from './decoration/ScalebarConfig'
14
- import type { EncodingConfig } from './encoding/EncodingConfig'
15
- import type { LocationConfig } from './locations'
16
- import type { LabelsConfig } from './decoration/LabelsConfig'
17
-
18
- /**
19
- * A eurostat-map instance. Created by eurostatmap.map() and extended
20
- * by each concrete map type. All getter/setter methods follow the same
21
- * pattern: call with no argument to get, call with a value to set and
22
- * return the instance for chaining.
23
- */
24
- export interface MapInstance {
25
- /** Container. */
26
-
27
- /** ID of the target SVG element. @default 'map' */
28
- svgId(): string
29
- svgId(id: string): this
30
-
31
- /** ID of the wrapper container element. */
32
- containerId(): string
33
- containerId(id: string): this
34
-
35
- /** Dimensions. */
36
-
37
- /** Map width in pixels. @default min(795, window.innerWidth) */
38
- width(): number
39
- width(w: number): this
40
-
41
- /** Map height in pixels. 0 = auto (85% of width). */
42
- height(): number
43
- height(h: number): this
44
-
45
- /** Geography. */
46
-
47
- /**
48
- * NUTS2JSON geographic focus area.
49
- * @example 'EUR' | 'WORLD' | 'PT' | 'MT' | 'IC'
50
- */
51
- geo(): string
52
- geo(g: string): this
53
-
54
- /**
55
- * EPSG projection code for NUTS2JSON geometries.
56
- * Use '4326' when setting a custom projectionFunction.
57
- * @default '3035'
58
- */
59
- proj(): string
60
- proj(p: string): this
61
-
62
- /**
63
- * NUTS2JSON geometry resolution.
64
- * @default '20M'
65
- */
66
- scale(): string
67
- scale(s: '60M' | '20M' | '10M' | '03M' | '01M'): this
68
-
69
- /** NUTS level to display. @default 3 */
70
- nutsLevel(): number | 'mixed'
71
- nutsLevel(level: number | 'mixed'): this
72
-
73
- /** NUTS boundaries year. @default 2024 */
74
- nutsYear(): number
75
- nutsYear(year: number): this
76
-
77
- /**
78
- * Initial map viewport. x/y in projected coordinates, z is pixel size
79
- * (map units per screen pixel — smaller = more zoomed in).
80
- * @example map.position({ x: 4800000, y: 3400000, z: 6000 })
81
- */
82
- position(v: { x?: number; y?: number; z?: number }): this
83
- position(): { x: number; y: number; z: number }
84
-
85
- /**
86
- * Custom D3 projection function. When set, also call proj('4326').
87
- * @example map.projectionFunction(d3.geoAzimuthalEquidistant().rotate([-10, -52]))
88
- */
89
- projectionFunction(): any
90
- projectionFunction(fn: any): this
91
-
92
- /** Text and labels. */
93
-
94
- /** Map title. */
95
- title(): string
96
- title(t: string): this
97
-
98
- /** Map subtitle. */
99
- subtitle(): string
100
- subtitle(t: string): this
101
-
102
- /**
103
- * Footnote text shown at the bottom of the map.
104
- * Defaults to the standard EuroGeographics copyright notice.
105
- */
106
- footnote(): string | false
107
- footnote(text: string | false): this
108
-
109
- /** Tooltip text shown when hovering over the footnote. */
110
- footnoteTooltipText(): string | false
111
- footnoteTooltipText(text: string | false): this
112
-
113
- /** Wrap footnote text at this many characters. */
114
- footnoteWrap(): number | false
115
- footnoteWrap(chars: number | false): this
116
-
117
- /** Statistical data. */
118
-
119
- /**
120
- * Get or set statistical data configuration.
121
- * - `map.stat()` → returns the default stat config
122
- * - `map.stat(config)` → sets the default stat config
123
- * - `map.stat('v1')` → returns the stat config for key 'v1'
124
- * - `map.stat('v1', config)` → sets the stat config for key 'v1'
125
- * @example map.stat({ eurostatDatasetCode: 'demo_r_d3dens', filters: { TIME: '2024' } })
126
- */
127
- stat(): StatConfig | CompositionStatConfig | undefined
128
- stat(config: StatConfig | CompositionStatConfig): this
129
- stat(key: string): StatConfig | CompositionStatConfig | undefined
130
- stat(key: string, config: StatConfig | CompositionStatConfig): this
131
- /**
132
- * Legacy compatibility overload for composition channels.
133
- * Preferred: pass category fields directly inside config.
134
- */
135
- stat(
136
- key: string,
137
- config: StatConfig | CompositionStatConfig,
138
- categoryParameter: string,
139
- categoryCodes?: string[],
140
- categoryLabels?: string[],
141
- categoryColors?: string[],
142
- totalCode?: string
143
- ): this
144
-
145
- /**
146
- * Get or set visual encodings that map named stats to visual variables.
147
- * @example map.encoding('size', { stat: 'population', scale: 'sqrt', range: [4, 30] })
148
- */
149
- encoding(): Record<string, EncodingConfig>
150
- encoding(channel: string): EncodingConfig | undefined
151
- encoding(channel: string, config: EncodingConfig): this
152
- encoding(configs: Record<string, EncodingConfig>): this
153
-
154
- /** Returns the stat name for an encoding channel, or fallback when unset. */
155
- getEncodingStat(channel: string, fallback?: string): string | undefined
156
-
157
- /** Returns stat names for an encoding channel (`stats` or single `stat`). */
158
- getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
159
-
160
- /** Returns the concrete statData key for a channel/category combination. */
161
- getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string | undefined
162
-
163
- /** Returns the StatData source bound to a channel/category. */
164
- getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData | undefined
165
-
166
- /** Returns a region value through encoding lookup. */
167
- getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
168
-
169
- /** Returns unit text through encoding lookup. */
170
- getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
171
-
172
- /**
173
- * Get or set the StatData instance for a given key.
174
- * Use setData() on the returned instance to supply custom data.
175
- * @example map.statData().setData({ DE: 120, FR: 95 })
176
- */
177
- statData(): StatData
178
- statData(key: string): StatData
179
- statData(key: string, data: StatData): this
180
-
181
- /**
182
- * Returns the time dimension value from the loaded Eurostat dataset.
183
- * Useful for displaying the data period in the map title.
184
- * @example map.onBuild(() => map.title('Population ' + map.getTime()))
185
- */
186
- getTime(): string | undefined
187
-
188
- /** Text shown for regions with no data. @default 'No data available' */
189
- noDataText(): string
190
- noDataText(text: string): this
191
-
192
- /** BCP 47 language tag for Eurostat API labels. @default 'en' */
193
- language(): string
194
- language(lang: string): this
195
-
196
- /** Legend. */
197
-
198
- /**
199
- * Get or set legend configuration. Pass false to remove the legend.
200
- * @example map.legend({ x: 10, y: 90, title: 'Density, people/km²' })
201
- */
202
- legend(): LegendConfig | false
203
- legend(config: LegendConfig | false): this
204
-
205
- /** Force-update the legend after data or style changes. */
206
- updateLegend(): this
207
-
208
- /** Ranked bar chart. */
209
-
210
- /**
211
- * Get or set ranked bar chart configuration (choropleth-classified map types only). Pass
212
- * false to remove it. Independent of the legend - has its own positioning and can render
213
- * into an entirely different container/SVG to the legend's.
214
- * @example map.rankedBarChart({ svgId: 'my-bar-chart-container' })
215
- */
216
- rankedBarChart(): RankedBarChartConfig | false
217
- rankedBarChart(config: RankedBarChartConfig | false): this
218
-
219
- /** Force-update the ranked bar chart after data or style changes. */
220
- updateRankedBarChart(): this
221
-
222
- /** Tooltip. */
223
-
224
- /** Get or set tooltip configuration. */
225
- tooltip(): TooltipConfig
226
- tooltip(config: TooltipConfig): this
227
-
228
- /** Zoom and pan. */
229
-
230
- /**
231
- * D3 zoom scale extent [min, max].
232
- * @example map.zoomExtent([1, 10])
233
- */
234
- zoomExtent(): [number, number]
235
- zoomExtent(extent: [number, number]): this
236
-
237
- /** Show zoom +/- buttons. @default true */
238
- zoomButtons(): boolean
239
- zoomButtons(show: boolean): this
240
-
241
- /** Grid cartogram settings (shape, margins, cell padding, layout positions). */
242
- gridCartogramSettings(): GridCartogramSettings
243
- gridCartogramSettings(settings: Partial<GridCartogramSettings>): this
244
-
245
- /** Insets. */
246
-
247
- /**
248
- * Inset map configurations. Pass a named preset string, or a custom array, or false to
249
- * disable. Passing true is an alias for 'default'.
250
- * - 'default': simple grid layout of overseas territories.
251
- * - 'image': Malta, Liechtenstein and EU/EFTA overseas/remote territories, hand-tuned
252
- * layout with connecting decoration (background box, separator lines, blur gradients).
253
- * - 'eu': simple grid layout of EU overseas/outermost territories, no decoration.
254
- * - 'euEfta': like 'eu', plus Liechtenstein and Svalbard, no decoration.
255
- * @example map.insets('default')
256
- * @example map.insets('image')
257
- * @example map.insets(true)
258
- * @example map.insets([{ geo: 'MT' }, { geo: 'LI' }])
259
- */
260
- insets(): InsetConfig[] | 'default' | 'image' | 'eu' | 'euEfta' | false
261
- insets(config: InsetConfig[] | 'default' | 'image' | 'eu' | 'euEfta' | true | false): this
262
-
263
- /** Decoration. */
264
-
265
- /** Show/hide the graticule (coordinate grid lines). */
266
- drawGraticule(): boolean
267
- drawGraticule(show: boolean): this
268
-
269
- /** Show/hide the coastal margin shadow effect. */
270
- drawCoastalMargin(): boolean
271
- drawCoastalMargin(show: boolean): this
272
-
273
- /** Coastal margin appearance settings. */
274
- coastalMarginSettings(): CoastalMarginSettings
275
- coastalMarginSettings(settings: Partial<CoastalMarginSettings>): this
276
-
277
- /** Show/hide placename labels loaded from the placenames layer. */
278
- placenames(): boolean
279
- placenames(show: boolean): this
280
-
281
- /**
282
- * Get or set label configuration for country names, statistical values, etc.
283
- * @example map.labels({ values: true, backgrounds: true, backgroundFill: '#B19122' })
284
- */
285
- labels(): LabelsConfig | undefined
286
- labels(config: LabelsConfig): this
287
-
288
- /** Annotation configuration for d3-svg-annotation. */
289
- annotations(): any
290
- annotations(config: any): this
291
-
292
- /** Stamp/watermark annotation. @example { x: 10, y: 10, text: 'DRAFT', size: 40 } */
293
- stamp(): object | undefined
294
- stamp(config: { x: number; y: number; text: string; size?: number }): this
295
-
296
- /** Scalebar configuration. */
297
- scalebar(): ScalebarConfig | null
298
- scalebar(config: ScalebarConfig | boolean): this
299
-
300
- /** Scalebar visibility. */
301
- showScalebar(): boolean
302
- showScalebar(show: boolean): this
303
-
304
- /** Scalebar position [x, y] in pixels. */
305
- scalebarPosition(): [number, number]
306
- scalebarPosition(pos: [number, number]): this
307
-
308
- /** Show the Eurostat logo. */
309
- showEstatLogo(): boolean
310
- showEstatLogo(show: boolean): this
311
-
312
- /** Show the Eurostat ribbon banner. */
313
- showEstatRibbon(): boolean
314
- showEstatRibbon(show: boolean): this
315
-
316
- /** Returns the D3 selection of the SVG element. */
317
- svg(): any
318
- svg(s: any): this
319
-
320
- /** Add or replace a custom point location marker. */
321
- addLocation(config: LocationConfig): this
322
-
323
- /** Remove a custom point location marker by id. */
324
- removeLocation(id: string): this
325
-
326
- /** Remove all custom point location markers. */
327
- clearLocations(): this
328
-
329
- /** Get or replace all custom point location markers. */
330
- locations(): LocationConfig[]
331
- locations(configs: LocationConfig[] | null | undefined): this
332
-
333
- /** Redraw custom point location markers. */
334
- updateLocations(): this
335
-
336
- /** Custom geometry filtering function. */
337
- filterGeometriesFunction(): ((geometry: any) => boolean) | undefined
338
- filterGeometriesFunction(fn: (geometry: any) => boolean): this
339
-
340
- /** Grid cartogram enabled or disabled. */
341
- gridCartogram(): boolean
342
- gridCartogram(enable: boolean): this
343
-
344
- /** Toggle background map rendering (sea, country boundaries, etc.). */
345
- backgroundMap(): boolean
346
- backgroundMap(show: boolean): this
347
-
348
- /** Minimap configuration. */
349
- minimap(): any
350
- minimap(config: any): this
351
-
352
- /**
353
- * Show/hide inset map toggle button.
354
- * When enabled and no insets are configured, the map automatically uses insets('default').
355
- */
356
- insetsButton(): boolean
357
- insetsButton(show: boolean): this
358
-
359
- /** Show/hide legend toggle button. */
360
- legendButton(): boolean
361
- legendButton(show: boolean): this
362
-
363
- /** Filter function for placename labels. */
364
- placenamesFilter(): ((name: any) => boolean) | undefined
365
- placenamesFilter(fn: (name: any) => boolean): this
366
-
367
- /** Use a separate header section for titles. */
368
- header(): boolean
369
- header(show: boolean): this
370
-
371
- /** Use a separate footer section for footnotes. */
372
- footer(): boolean
373
- footer(show: boolean): this
374
-
375
- /** Padding between the map and footer in pixels. */
376
- footerPadding(): number | undefined
377
- footerPadding(padding: number): this
378
-
379
- /** Padding between the header and map in pixels. */
380
- headerPadding(): number | undefined
381
- headerPadding(padding: number): this
382
-
383
- /** Position adjustment for map title: [x, y] */
384
- titlePosition(): [number, number] | undefined
385
- titlePosition(pos: [number, number]): this
386
-
387
- /** Position adjustment for map subtitle: [x, y] */
388
- subtitlePosition(): [number, number] | undefined
389
- subtitlePosition(pos: [number, number]): this
390
-
391
- /** Position adjustment for footnote text: [x, y] */
392
- footnotePosition(): [number, number] | undefined
393
- footnotePosition(pos: [number, number]): this
394
-
395
- /** Position adjustment for Eurostat logo: [x, y] */
396
- logoPosition(): [number, number] | undefined
397
- logoPosition(pos: [number, number]): this
398
-
399
- /** Position adjustment for ribbon banner: [x, y] */
400
- ribbonPosition(): [number, number] | undefined
401
- ribbonPosition(pos: [number, number]): this
402
-
403
- /** Position adjustment for zoom buttons: [x, y] */
404
- zoomButtonsPosition(): [number, number] | undefined
405
- zoomButtonsPosition(pos: [number, number]): this
406
-
407
- /** Position adjustment for insets button: [x, y] */
408
- insetsButtonPosition(): [number, number] | undefined
409
- insetsButtonPosition(pos: [number, number]): this
410
-
411
- /** Position adjustment for legend button: [x, y] */
412
- legendButtonPosition(): [number, number] | undefined
413
- legendButtonPosition(pos: [number, number]): this
414
-
415
- /** Pointer hover color for NUTS regions. */
416
- hoverColor(): string
417
- hoverColor(color: string): this
418
-
419
- /** Base fill color for regions with no statistical data. */
420
- noDataFillStyle(): string
421
- noDataFillStyle(style: string): this
422
-
423
- /** Show the link to the remote Eurostat statistical dataset. */
424
- showSourceLink(): boolean
425
- showSourceLink(show: boolean): this
426
-
427
- /** Pattern fill configurations. */
428
- patternFill(): any
429
- patternFill(config: any): this
430
-
431
- /** Dorling. */
432
-
433
- /** Enable Dorling cartogram layout for proportional symbol maps. */
434
- dorling(): boolean
435
- dorling(enable: boolean): this
436
-
437
- /** Dorling simulation settings. */
438
- dorlingSettings(): DorlingSettings
439
- dorlingSettings(settings: Partial<DorlingSettings>): this
440
-
441
- /** Events. */
442
-
443
- /** Called when the user finishes a zoom gesture. */
444
- onZoomEnd(): ((event: any) => void) | undefined
445
- onZoomEnd(fn: (event: any) => void): this
446
-
447
- /** Called continuously while the user is zooming. */
448
- onZoom(): ((event: any) => void) | undefined
449
- onZoom(fn: (event: any) => void): this
450
-
451
- /** Called when the pointer enters a NUTS region. */
452
- onRegionMouseOver(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
453
- onRegionMouseOver(fn: (event: MouseEvent, regionId: string, props: any) => void): this
454
-
455
- /** Called when the pointer moves over a NUTS region. */
456
- onRegionMouseMove(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
457
- onRegionMouseMove(fn: (event: MouseEvent, regionId: string, props: any) => void): this
458
-
459
- /** Called when the pointer leaves a NUTS region. */
460
- onRegionMouseOut(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
461
- onRegionMouseOut(fn: (event: MouseEvent, regionId: string, props: any) => void): this
462
-
463
- /** Called when a NUTS region is clicked. */
464
- onRegionClick(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
465
- onRegionClick(fn: (event: MouseEvent, regionId: string, props: any) => void): this
466
-
467
- /**
468
- * Callback fired once after the map has fully built (geo + stat data loaded).
469
- * Receives the map instance as its only argument.
470
- * @example map.onBuild(m => console.log('Map ready', m))
471
- */
472
- onBuild(): ((map: MapInstance) => void) | undefined
473
- onBuild(callback: (map: MapInstance) => void): this
474
-
475
- /** Build and update. */
476
-
477
- /**
478
- * Builds the map from scratch. Call once after initial configuration.
479
- * @example
480
- * eurostatmap.map('choropleth')
481
- * .stat({ eurostatDatasetCode: 'demo_r_d3dens' })
482
- * .build()
483
- */
484
- build(): this
485
-
486
- /** Re-fetches geo data and rebuilds map geometry. */
487
- updateGeoData(): this
488
-
489
- /** Re-fetches all stat datasets and refreshes the map. */
490
- updateStatData(): this
491
-
492
- /** Re-applies classification and styling from currently loaded data. */
493
- updateStatValues(): this
494
-
495
- /** Updates data classification (class breaks, thresholds). */
496
- updateClassification(): this
497
-
498
- /** Re-applies visual styling (colors, symbol sizes). */
499
- updateStyle(): this
500
-
501
- /** Recalculates header/footer layout and resizes the SVG. */
502
- recalculateLayout(): void
503
-
504
- /** Export. */
505
-
506
- /**
507
- * Exports the map as an SVG file and triggers a browser download.
508
- * Computed CSS styles are inlined before export.
509
- */
510
- exportMapToSVG(): this
511
-
512
- /**
513
- * Exports the map as a PNG file and triggers a browser download.
514
- * @param width - Output width in pixels. Defaults to SVG width.
515
- * @param height - Output height in pixels. Defaults to SVG height.
516
- */
517
- exportMapToPNG(width?: number, height?: number): Promise<this>
518
-
519
- /** Misc. */
520
-
521
- /**
522
- * Sets map attributes from URL parameters.
523
- * Supported params: w, h, x, y, z, s, lvl, time, proj, geo, ny, language, numberOfClasses
524
- */
525
- setFromURL(): this
526
-
527
- /** D3 transition duration in milliseconds for map updates. @default 500 */
528
- transitionDuration(): number
529
- transitionDuration(ms: number): this
530
-
531
- /** SVG filter/pattern definition function for fill patterns. */
532
- filtersDefinitionFunction(): ((svg: any, numberOfClasses: number) => void) | undefined
533
- filtersDefinitionFunction(fn: (svg: any, numberOfClasses: number) => void): this
534
-
535
- /** Returns region centroids as an array of projected coordinate pairs. */
536
- regionCentroids(): Array<{ id: string; x: number; y: number }>
537
-
538
- /** Ordered thematic layer stack (bottom → top). */
539
- layers_: Layer[]
540
- activeLayerIndex_: number
541
-
542
- activeLayer(): Layer
543
- layer(ref?: number | string): Layer | undefined
544
- layers(): Layer[]
545
- layers(configs: LayerConfig[]): this
546
- addLayer(type: string, config?: LayerConfig): Layer
547
- addLayer(config: LayerConfig): Layer
548
- removeLayer(ref: number | string): this
549
- activeLayerIndex(): number
550
- activeLayerIndex(i: number): this
551
- updateAllLayers(): this
552
-
553
- /** Allow additional map-type-specific properties and methods. */
554
- [key: string]: any
555
- }
1
+ import type { StatConfig } from './stat/StatConfig'
2
+ import type { StatData } from './stat/StatData'
3
+ import type { Layer } from './layer/Layer'
4
+ import type { LayerConfig } from './layer/LayerConfig'
5
+ import type { CompositionStatConfig } from '../layers/composition/CompositionStatConfig'
6
+ import type { LegendConfig } from '../legend/LegendConfig'
7
+ import type { RankedBarChartConfig } from './decoration/RankedBarChartConfig'
8
+ import type { TooltipConfig } from './TooltipConfig'
9
+ import type { InsetConfig } from './InsetConfig'
10
+ import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
11
+ import type { GridCartogramSettings } from './GridCartogramSettings'
12
+ import type { DorlingSettings } from './DorlingSettings'
13
+ import type { ScalebarConfig } from './decoration/ScalebarConfig'
14
+ import type { EncodingConfig } from './encoding/EncodingConfig'
15
+ import type { LocationConfig } from './locations'
16
+ import type { LabelsConfig } from './decoration/LabelsConfig'
17
+
18
+ /**
19
+ * A eurostat-map instance. Created by eurostatmap.map() and extended
20
+ * by each concrete map type. All getter/setter methods follow the same
21
+ * pattern: call with no argument to get, call with a value to set and
22
+ * return the instance for chaining.
23
+ */
24
+ export interface MapInstance {
25
+ /** Container. */
26
+
27
+ /** ID of the target SVG element. @default 'map' */
28
+ svgId(): string
29
+ svgId(id: string): this
30
+
31
+ /** ID of the wrapper container element. */
32
+ containerId(): string
33
+ containerId(id: string): this
34
+
35
+ /** Dimensions. */
36
+
37
+ /** Map width in pixels. @default min(795, window.innerWidth) */
38
+ width(): number
39
+ width(w: number): this
40
+
41
+ /** Map height in pixels. 0 = auto (85% of width). */
42
+ height(): number
43
+ height(h: number): this
44
+
45
+ /** Geography. */
46
+
47
+ /**
48
+ * NUTS2JSON geographic focus area.
49
+ * @example 'EUR' | 'WORLD' | 'PT' | 'MT' | 'IC'
50
+ */
51
+ geo(): string
52
+ geo(g: string): this
53
+
54
+ /**
55
+ * EPSG projection code for NUTS2JSON geometries.
56
+ * Use '4326' when setting a custom projectionFunction.
57
+ * @default '3035'
58
+ */
59
+ proj(): string
60
+ proj(p: string): this
61
+
62
+ /**
63
+ * NUTS2JSON geometry resolution.
64
+ * @default '20M'
65
+ */
66
+ scale(): string
67
+ scale(s: '60M' | '20M' | '10M' | '03M' | '01M'): this
68
+
69
+ /** NUTS level to display. @default 3 */
70
+ nutsLevel(): number | 'mixed'
71
+ nutsLevel(level: number | 'mixed'): this
72
+
73
+ /** NUTS boundaries year. @default 2024 */
74
+ nutsYear(): number
75
+ nutsYear(year: number): this
76
+
77
+ /**
78
+ * Initial map viewport. x/y in projected coordinates, z is pixel size
79
+ * (map units per screen pixel — smaller = more zoomed in).
80
+ * @example map.position({ x: 4800000, y: 3400000, z: 6000 })
81
+ */
82
+ position(v: { x?: number; y?: number; z?: number }): this
83
+ position(): { x: number; y: number; z: number }
84
+
85
+ /**
86
+ * Custom D3 projection function. When set, also call proj('4326').
87
+ * @example map.projectionFunction(d3.geoAzimuthalEquidistant().rotate([-10, -52]))
88
+ */
89
+ projectionFunction(): any
90
+ projectionFunction(fn: any): this
91
+
92
+ /** Text and labels. */
93
+
94
+ /** Map title. */
95
+ title(): string
96
+ title(t: string): this
97
+
98
+ /** Map subtitle. */
99
+ subtitle(): string
100
+ subtitle(t: string): this
101
+
102
+ /**
103
+ * Footnote text shown at the bottom of the map.
104
+ * Defaults to the standard EuroGeographics copyright notice.
105
+ */
106
+ footnote(): string | false
107
+ footnote(text: string | false): this
108
+
109
+ /** Tooltip text shown when hovering over the footnote. */
110
+ footnoteTooltipText(): string | false
111
+ footnoteTooltipText(text: string | false): this
112
+
113
+ /** Wrap footnote text at this many characters. */
114
+ footnoteWrap(): number | false
115
+ footnoteWrap(chars: number | false): this
116
+
117
+ /** Statistical data. */
118
+
119
+ /**
120
+ * Get or set statistical data configuration.
121
+ * - `map.stat()` → returns the default stat config
122
+ * - `map.stat(config)` → sets the default stat config
123
+ * - `map.stat('v1')` → returns the stat config for key 'v1'
124
+ * - `map.stat('v1', config)` → sets the stat config for key 'v1'
125
+ * @example map.stat({ eurostatDatasetCode: 'demo_r_d3dens', filters: { TIME: '2024' } })
126
+ */
127
+ stat(): StatConfig | CompositionStatConfig | undefined
128
+ stat(config: StatConfig | CompositionStatConfig): this
129
+ stat(key: string): StatConfig | CompositionStatConfig | undefined
130
+ stat(key: string, config: StatConfig | CompositionStatConfig): this
131
+ /**
132
+ * Legacy compatibility overload for composition channels.
133
+ * Preferred: pass category fields directly inside config.
134
+ */
135
+ stat(
136
+ key: string,
137
+ config: StatConfig | CompositionStatConfig,
138
+ categoryParameter: string,
139
+ categoryCodes?: string[],
140
+ categoryLabels?: string[],
141
+ categoryColors?: string[],
142
+ totalCode?: string
143
+ ): this
144
+
145
+ /**
146
+ * Get or set visual encodings that map named stats to visual variables.
147
+ * @example map.encoding('size', { stat: 'population', scale: 'sqrt', range: [4, 30] })
148
+ */
149
+ encoding(): Record<string, EncodingConfig>
150
+ encoding(channel: string): EncodingConfig | undefined
151
+ encoding(channel: string, config: EncodingConfig): this
152
+ encoding(configs: Record<string, EncodingConfig>): this
153
+
154
+ /** Returns the stat name for an encoding channel, or fallback when unset. */
155
+ getEncodingStat(channel: string, fallback?: string): string | undefined
156
+
157
+ /** Returns stat names for an encoding channel (`stats` or single `stat`). */
158
+ getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
159
+
160
+ /** Returns the concrete statData key for a channel/category combination. */
161
+ getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string | undefined
162
+
163
+ /** Returns the StatData source bound to a channel/category. */
164
+ getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData | undefined
165
+
166
+ /** Returns a region value through encoding lookup. */
167
+ getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
168
+
169
+ /** Returns unit text through encoding lookup. */
170
+ getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
171
+
172
+ /**
173
+ * Get or set the StatData instance for a given key.
174
+ * Use setData() on the returned instance to supply custom data.
175
+ * @example map.statData().setData({ DE: 120, FR: 95 })
176
+ */
177
+ statData(): StatData
178
+ statData(key: string): StatData
179
+ statData(key: string, data: StatData): this
180
+
181
+ /**
182
+ * Returns the time dimension value from the loaded Eurostat dataset.
183
+ * Useful for displaying the data period in the map title.
184
+ * @example map.onBuild(() => map.title('Population ' + map.getTime()))
185
+ */
186
+ getTime(): string | undefined
187
+
188
+ /** Text shown for regions with no data. @default 'No data available' */
189
+ noDataText(): string
190
+ noDataText(text: string): this
191
+
192
+ /** BCP 47 language tag for Eurostat API labels. @default 'en' */
193
+ language(): string
194
+ language(lang: string): this
195
+
196
+ /** Legend. */
197
+
198
+ /**
199
+ * Get or set legend configuration. Pass false to remove the legend.
200
+ * @example map.legend({ x: 10, y: 90, title: 'Density, people/km²' })
201
+ */
202
+ legend(): LegendConfig | false
203
+ legend(config: LegendConfig | false): this
204
+
205
+ /** Force-update the legend after data or style changes. */
206
+ updateLegend(): this
207
+
208
+ /** Ranked bar chart. */
209
+
210
+ /**
211
+ * Get or set ranked bar chart configuration (choropleth-classified map types only). Pass
212
+ * false to remove it. Independent of the legend - has its own positioning and can render
213
+ * into an entirely different container/SVG to the legend's.
214
+ * @example map.rankedBarChart({ svgId: 'my-bar-chart-container' })
215
+ */
216
+ rankedBarChart(): RankedBarChartConfig | false
217
+ rankedBarChart(config: RankedBarChartConfig | false): this
218
+
219
+ /** Force-update the ranked bar chart after data or style changes. */
220
+ updateRankedBarChart(): this
221
+
222
+ /** Tooltip. */
223
+
224
+ /** Get or set tooltip configuration. */
225
+ tooltip(): TooltipConfig
226
+ tooltip(config: TooltipConfig): this
227
+
228
+ /** Zoom and pan. */
229
+
230
+ /**
231
+ * D3 zoom scale extent [min, max].
232
+ * @example map.zoomExtent([1, 10])
233
+ */
234
+ zoomExtent(): [number, number]
235
+ zoomExtent(extent: [number, number]): this
236
+
237
+ /** Show zoom +/- buttons. @default true */
238
+ zoomButtons(): boolean
239
+ zoomButtons(show: boolean): this
240
+
241
+ /** Grid cartogram settings (shape, margins, cell padding, layout positions). */
242
+ gridCartogramSettings(): GridCartogramSettings
243
+ gridCartogramSettings(settings: Partial<GridCartogramSettings>): this
244
+
245
+ /** Insets. */
246
+
247
+ /**
248
+ * Inset map configurations. Pass a named preset string, or a custom array, or false to
249
+ * disable. Passing true is an alias for 'default'.
250
+ * - 'default': simple grid layout of overseas territories.
251
+ * - 'image': Malta, Liechtenstein and EU/EFTA overseas/remote territories, hand-tuned
252
+ * layout with connecting decoration (background box, separator lines, blur gradients).
253
+ * - 'eu': simple grid layout of EU overseas/outermost territories, no decoration.
254
+ * - 'euEfta': like 'eu', plus Liechtenstein and Svalbard, no decoration.
255
+ * @example map.insets('default')
256
+ * @example map.insets('image')
257
+ * @example map.insets(true)
258
+ * @example map.insets([{ geo: 'MT' }, { geo: 'LI' }])
259
+ */
260
+ insets(): InsetConfig[] | 'default' | 'image' | 'eu' | 'euEfta' | false
261
+ insets(config: InsetConfig[] | 'default' | 'image' | 'eu' | 'euEfta' | true | false): this
262
+
263
+ /** Decoration. */
264
+
265
+ /** Show/hide the graticule (coordinate grid lines). */
266
+ drawGraticule(): boolean
267
+ drawGraticule(show: boolean): this
268
+
269
+ /** Show/hide the coastal margin shadow effect. */
270
+ drawCoastalMargin(): boolean
271
+ drawCoastalMargin(show: boolean): this
272
+
273
+ /** Coastal margin appearance settings. */
274
+ coastalMarginSettings(): CoastalMarginSettings
275
+ coastalMarginSettings(settings: Partial<CoastalMarginSettings>): this
276
+
277
+ /** Show/hide placename labels loaded from the placenames layer. */
278
+ placenames(): boolean
279
+ placenames(show: boolean): this
280
+
281
+ /**
282
+ * Get or set label configuration for country names, statistical values, etc.
283
+ * @example map.labels({ values: true, backgrounds: true, backgroundFill: '#B19122', statLabelTextColor: '#fff', backgroundPadding: { x: 6, y: 3 }, backgroundBorderRadius: 4 })
284
+ */
285
+ labels(): LabelsConfig | undefined
286
+ labels(config: LabelsConfig): this
287
+
288
+ /** Annotation configuration for d3-svg-annotation. */
289
+ annotations(): any
290
+ annotations(config: any): this
291
+
292
+ /** Stamp/watermark annotation. @example { x: 10, y: 10, text: 'DRAFT', size: 40 } */
293
+ stamp(): object | undefined
294
+ stamp(config: { x: number; y: number; text: string; size?: number }): this
295
+
296
+ /** Scalebar configuration. */
297
+ scalebar(): ScalebarConfig | null
298
+ scalebar(config: ScalebarConfig | boolean): this
299
+
300
+ /** Scalebar visibility. */
301
+ showScalebar(): boolean
302
+ showScalebar(show: boolean): this
303
+
304
+ /** Scalebar position [x, y] in pixels. */
305
+ scalebarPosition(): [number, number]
306
+ scalebarPosition(pos: [number, number]): this
307
+
308
+ /** Show the Eurostat logo. */
309
+ showEstatLogo(): boolean
310
+ showEstatLogo(show: boolean): this
311
+
312
+ /** Show the Eurostat ribbon banner. */
313
+ showEstatRibbon(): boolean
314
+ showEstatRibbon(show: boolean): this
315
+
316
+ /** Returns the D3 selection of the SVG element. */
317
+ svg(): any
318
+ svg(s: any): this
319
+
320
+ /** Add or replace a custom point location marker. */
321
+ addLocation(config: LocationConfig): this
322
+
323
+ /** Remove a custom point location marker by id. */
324
+ removeLocation(id: string): this
325
+
326
+ /** Remove all custom point location markers. */
327
+ clearLocations(): this
328
+
329
+ /** Get or replace all custom point location markers. */
330
+ locations(): LocationConfig[]
331
+ locations(configs: LocationConfig[] | null | undefined): this
332
+
333
+ /** Redraw custom point location markers. */
334
+ updateLocations(): this
335
+
336
+ /** Custom geometry filtering function. */
337
+ filterGeometriesFunction(): ((geometry: any) => boolean) | undefined
338
+ filterGeometriesFunction(fn: (geometry: any) => boolean): this
339
+
340
+ /** Grid cartogram enabled or disabled. */
341
+ gridCartogram(): boolean
342
+ gridCartogram(enable: boolean): this
343
+
344
+ /** Toggle background map rendering (sea, country boundaries, etc.). */
345
+ backgroundMap(): boolean
346
+ backgroundMap(show: boolean): this
347
+
348
+ /** Minimap configuration. */
349
+ minimap(): any
350
+ minimap(config: any): this
351
+
352
+ /**
353
+ * Show/hide inset map toggle button.
354
+ * When enabled and no insets are configured, the map automatically uses insets('default').
355
+ */
356
+ insetsButton(): boolean
357
+ insetsButton(show: boolean): this
358
+
359
+ /** Show/hide legend toggle button. */
360
+ legendButton(): boolean
361
+ legendButton(show: boolean): this
362
+
363
+ /** Filter function for placename labels. */
364
+ placenamesFilter(): ((name: any) => boolean) | undefined
365
+ placenamesFilter(fn: (name: any) => boolean): this
366
+
367
+ /** Use a separate header section for titles. */
368
+ header(): boolean
369
+ header(show: boolean): this
370
+
371
+ /** Use a separate footer section for footnotes. */
372
+ footer(): boolean
373
+ footer(show: boolean): this
374
+
375
+ /** Padding between the map and footer in pixels. */
376
+ footerPadding(): number | undefined
377
+ footerPadding(padding: number): this
378
+
379
+ /** Padding between the header and map in pixels. */
380
+ headerPadding(): number | undefined
381
+ headerPadding(padding: number): this
382
+
383
+ /** Position adjustment for map title: [x, y] */
384
+ titlePosition(): [number, number] | undefined
385
+ titlePosition(pos: [number, number]): this
386
+
387
+ /** Position adjustment for map subtitle: [x, y] */
388
+ subtitlePosition(): [number, number] | undefined
389
+ subtitlePosition(pos: [number, number]): this
390
+
391
+ /** Position adjustment for footnote text: [x, y] */
392
+ footnotePosition(): [number, number] | undefined
393
+ footnotePosition(pos: [number, number]): this
394
+
395
+ /** Position adjustment for Eurostat logo: [x, y] */
396
+ logoPosition(): [number, number] | undefined
397
+ logoPosition(pos: [number, number]): this
398
+
399
+ /** Position adjustment for ribbon banner: [x, y] */
400
+ ribbonPosition(): [number, number] | undefined
401
+ ribbonPosition(pos: [number, number]): this
402
+
403
+ /** Position adjustment for zoom buttons: [x, y] */
404
+ zoomButtonsPosition(): [number, number] | undefined
405
+ zoomButtonsPosition(pos: [number, number]): this
406
+
407
+ /** Position adjustment for insets button: [x, y] */
408
+ insetsButtonPosition(): [number, number] | undefined
409
+ insetsButtonPosition(pos: [number, number]): this
410
+
411
+ /** Position adjustment for legend button: [x, y] */
412
+ legendButtonPosition(): [number, number] | undefined
413
+ legendButtonPosition(pos: [number, number]): this
414
+
415
+ /** Pointer hover color for NUTS regions. */
416
+ hoverColor(): string
417
+ hoverColor(color: string): this
418
+
419
+ /** Base fill color for regions with no statistical data. */
420
+ noDataFillStyle(): string
421
+ noDataFillStyle(style: string): this
422
+
423
+ /** Show the link to the remote Eurostat statistical dataset. */
424
+ showSourceLink(): boolean
425
+ showSourceLink(show: boolean): this
426
+
427
+ /** Pattern fill configurations. */
428
+ patternFill(): any
429
+ patternFill(config: any): this
430
+
431
+ /** Dorling. */
432
+
433
+ /** Enable Dorling cartogram layout for proportional symbol maps. */
434
+ dorling(): boolean
435
+ dorling(enable: boolean): this
436
+
437
+ /** Dorling simulation settings. */
438
+ dorlingSettings(): DorlingSettings
439
+ dorlingSettings(settings: Partial<DorlingSettings>): this
440
+
441
+ /** Events. */
442
+
443
+ /** Called when the user finishes a zoom gesture. */
444
+ onZoomEnd(): ((event: any) => void) | undefined
445
+ onZoomEnd(fn: (event: any) => void): this
446
+
447
+ /** Called continuously while the user is zooming. */
448
+ onZoom(): ((event: any) => void) | undefined
449
+ onZoom(fn: (event: any) => void): this
450
+
451
+ /** Called when the pointer enters a NUTS region. */
452
+ onRegionMouseOver(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
453
+ onRegionMouseOver(fn: (event: MouseEvent, regionId: string, props: any) => void): this
454
+
455
+ /** Called when the pointer moves over a NUTS region. */
456
+ onRegionMouseMove(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
457
+ onRegionMouseMove(fn: (event: MouseEvent, regionId: string, props: any) => void): this
458
+
459
+ /** Called when the pointer leaves a NUTS region. */
460
+ onRegionMouseOut(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
461
+ onRegionMouseOut(fn: (event: MouseEvent, regionId: string, props: any) => void): this
462
+
463
+ /** Called when a NUTS region is clicked. */
464
+ onRegionClick(): ((event: MouseEvent, regionId: string, props: any) => void) | undefined
465
+ onRegionClick(fn: (event: MouseEvent, regionId: string, props: any) => void): this
466
+
467
+ /**
468
+ * Callback fired once after the map has fully built (geo + stat data loaded).
469
+ * Receives the map instance as its only argument.
470
+ * @example map.onBuild(m => console.log('Map ready', m))
471
+ */
472
+ onBuild(): ((map: MapInstance) => void) | undefined
473
+ onBuild(callback: (map: MapInstance) => void): this
474
+
475
+ /** Build and update. */
476
+
477
+ /**
478
+ * Builds the map from scratch. Call once after initial configuration.
479
+ * @example
480
+ * eurostatmap.map('choropleth')
481
+ * .stat({ eurostatDatasetCode: 'demo_r_d3dens' })
482
+ * .build()
483
+ */
484
+ build(): this
485
+
486
+ /** Re-fetches geo data and rebuilds map geometry. */
487
+ updateGeoData(): this
488
+
489
+ /** Re-fetches all stat datasets and refreshes the map. */
490
+ updateStatData(): this
491
+
492
+ /** Re-applies classification and styling from currently loaded data. */
493
+ updateStatValues(): this
494
+
495
+ /** Updates data classification (class breaks, thresholds). */
496
+ updateClassification(): this
497
+
498
+ /** Re-applies visual styling (colors, symbol sizes). */
499
+ updateStyle(): this
500
+
501
+ /** Recalculates header/footer layout and resizes the SVG. */
502
+ recalculateLayout(): void
503
+
504
+ /** Export. */
505
+
506
+ /**
507
+ * Exports the map as an SVG file and triggers a browser download.
508
+ * Computed CSS styles are inlined before export.
509
+ */
510
+ exportMapToSVG(): this
511
+
512
+ /**
513
+ * Exports the map as a PNG file and triggers a browser download.
514
+ * @param width - Output width in pixels. Defaults to SVG width.
515
+ * @param height - Output height in pixels. Defaults to SVG height.
516
+ */
517
+ exportMapToPNG(width?: number, height?: number): Promise<this>
518
+
519
+ /** Misc. */
520
+
521
+ /**
522
+ * Sets map attributes from URL parameters.
523
+ * Supported params: w, h, x, y, z, s, lvl, time, proj, geo, ny, language, numberOfClasses
524
+ */
525
+ setFromURL(): this
526
+
527
+ /** D3 transition duration in milliseconds for map updates. @default 500 */
528
+ transitionDuration(): number
529
+ transitionDuration(ms: number): this
530
+
531
+ /** SVG filter/pattern definition function for fill patterns. */
532
+ filtersDefinitionFunction(): ((svg: any, numberOfClasses: number) => void) | undefined
533
+ filtersDefinitionFunction(fn: (svg: any, numberOfClasses: number) => void): this
534
+
535
+ /** Returns region centroids as an array of projected coordinate pairs. */
536
+ regionCentroids(): Array<{ id: string; x: number; y: number }>
537
+
538
+ /** Ordered thematic layer stack (bottom → top). */
539
+ layers_: Layer[]
540
+ activeLayerIndex_: number
541
+
542
+ activeLayer(): Layer
543
+ layer(ref?: number | string): Layer | undefined
544
+ layers(): Layer[]
545
+ layers(configs: LayerConfig[]): this
546
+ addLayer(type: string, config?: LayerConfig): Layer
547
+ addLayer(config: LayerConfig): Layer
548
+ removeLayer(ref: number | string): this
549
+ activeLayerIndex(): number
550
+ activeLayerIndex(i: number): this
551
+ updateAllLayers(): this
552
+
553
+ /** Allow additional map-type-specific properties and methods. */
554
+ [key: string]: any
555
+ }