eurostat-map 4.4.5 → 4.5.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.
Files changed (86) hide show
  1. package/README.md +33 -4
  2. package/build/215.eurostatmap.min.js +1 -1
  3. package/build/215.eurostatmap.min.js.map +1 -1
  4. package/build/eurostatmap.js +19801 -16163
  5. package/build/eurostatmap.min.js +2 -2
  6. package/build/eurostatmap.min.js.map +1 -1
  7. package/build/package.json +1 -1
  8. package/build/types/core/GridCartogramSettings.d.ts +33 -0
  9. package/build/types/core/MapConfig.d.ts +13 -2
  10. package/build/types/core/MapInstance.d.ts +80 -4
  11. package/build/types/core/encoding/EncodingConfig.d.ts +31 -0
  12. package/build/types/core/layer/Layer.d.ts +31 -0
  13. package/build/types/core/layer/LayerConfig.d.ts +19 -0
  14. package/build/types/core/layer/LayerRole.d.ts +1 -0
  15. package/build/types/core/locations.d.ts +44 -16
  16. package/build/types/core/stat/StatConfig.d.ts +7 -0
  17. package/build/types/index.d.ts +38 -33
  18. package/build/types/layers/CategoricalMap.d.ts +21 -0
  19. package/build/types/layers/CategoricalMapConfig.d.ts +11 -0
  20. package/build/types/layers/MapType.d.ts +34 -0
  21. package/build/types/layers/choropleth/BivariateChoroplethConfig.d.ts +27 -0
  22. package/build/types/layers/choropleth/BivariateChoroplethMap.d.ts +39 -0
  23. package/build/types/layers/choropleth/ChoroplethConfig.d.ts +39 -0
  24. package/build/types/layers/choropleth/ChoroplethMap.d.ts +48 -0
  25. package/build/types/layers/choropleth/TrivariateChoroplethConfig.d.ts +41 -0
  26. package/build/types/layers/choropleth/TrivariateChoroplethMap.d.ts +18 -0
  27. package/build/types/layers/choropleth/ValueByAlphaConfig.d.ts +8 -0
  28. package/build/types/layers/choropleth/ValueByAlphaMap.d.ts +9 -0
  29. package/build/types/layers/composition/CompositionStatConfig.d.ts +59 -0
  30. package/build/types/layers/composition/bar/BarMap.d.ts +97 -0
  31. package/build/types/layers/composition/bar/BarMapConfig.d.ts +76 -0
  32. package/build/types/layers/composition/coxcomb/CoxcombMap.d.ts +75 -0
  33. package/build/types/layers/composition/coxcomb/CoxcombMapConfig.d.ts +47 -0
  34. package/build/types/layers/composition/coxcomb/CoxcombStatConfig.d.ts +13 -0
  35. package/build/types/layers/composition/pie/PieMap.d.ts +84 -0
  36. package/build/types/layers/composition/pie/PieMapConfig.d.ts +50 -0
  37. package/build/types/layers/composition/stripe/StripeMap.d.ts +80 -0
  38. package/build/types/layers/composition/stripe/StripeMapConfig.d.ts +45 -0
  39. package/build/types/layers/composition/waffle/WaffleMap.d.ts +124 -0
  40. package/build/types/layers/composition/waffle/WaffleMapConfig.d.ts +58 -0
  41. package/build/types/layers/flow/FlowMap.d.ts +218 -0
  42. package/build/types/layers/flow/FlowMapConfig.d.ts +220 -0
  43. package/build/types/layers/proportional-symbol/ProportionalSymbolConfig.d.ts +47 -0
  44. package/build/types/layers/proportional-symbol/ProportionalSymbolMap.d.ts +94 -0
  45. package/build/types/layers/proportional-symbol/mushroom/MushroomMap.d.ts +67 -0
  46. package/build/types/layers/proportional-symbol/mushroom/MushroomMapConfig.d.ts +39 -0
  47. package/build/types/layers/spark/SparkMap.d.ts +56 -0
  48. package/build/types/layers/spark/SparkMapConfig.d.ts +75 -0
  49. package/build/types/layers/spark/SparkStatConfig.d.ts +33 -0
  50. package/build/types/legend/LegendConfig.d.ts +3 -0
  51. package/build/types/legend/choropleth/BivariateLegendConfig.d.ts +79 -0
  52. package/build/types/legend/choropleth/legend-choropleth-bivariate.d.ts +2 -2
  53. package/build/types/legend/choropleth/legend-choropleth-trivariate.d.ts +2 -2
  54. package/build/types/legend/choropleth/legend-choropleth.d.ts +2 -2
  55. package/build/types/legend/composition/legend-bar-chart.d.ts +2 -2
  56. package/build/types/legend/flow/legend-flow.d.ts +2 -2
  57. package/build/types/legend/legend-categorical.d.ts +2 -2
  58. package/build/types/legend/legend-continuous.d.ts +2 -2
  59. package/build/types/legend/legend-discrete.d.ts +2 -2
  60. package/build/types/legend/legend.d.ts +13 -13
  61. package/build/types/legend/proportional-symbol/legend-proportional-symbols.d.ts +2 -2
  62. package/build/types/map-types/CategoricalMapConfig.d.ts +11 -11
  63. package/build/types/map-types/choropleth/map-choropleth-bivariate.d.ts +4 -4
  64. package/build/types/map-types/choropleth/map-choropleth-trivariate.d.ts +4 -4
  65. package/build/types/map-types/choropleth/map-value-by-alpha.d.ts +4 -4
  66. package/build/types/map-types/composition/CompositionStatConfig.d.ts +7 -0
  67. package/build/types/map-types/composition/bar/BarMap.d.ts +97 -79
  68. package/build/types/map-types/composition/bar/BarMapConfig.d.ts +76 -54
  69. package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +29 -0
  70. package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +15 -0
  71. package/build/types/map-types/composition/map-spark.d.ts +5 -5
  72. package/build/types/map-types/composition/map-stripe.d.ts +5 -5
  73. package/build/types/map-types/composition/pie/PieMap.d.ts +1 -5
  74. package/build/types/map-types/composition/stripe/StripeMap.d.ts +19 -2
  75. package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +11 -0
  76. package/build/types/map-types/composition/waffle/WaffleMap.d.ts +1 -0
  77. package/build/types/map-types/flow/FlowMap.d.ts +121 -0
  78. package/build/types/map-types/flow/FlowMapConfig.d.ts +62 -0
  79. package/build/types/map-types/flow/map-flow.d.ts +5 -5
  80. package/build/types/map-types/proportional-symbol/ProportionalSymbolConfig.d.ts +30 -0
  81. package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +4 -0
  82. package/build/types/map-types/proportional-symbol/mushroom/MushroomMap.d.ts +37 -0
  83. package/build/types/map-types/proportional-symbol/mushroom/MushroomMapConfig.d.ts +19 -0
  84. package/build/types/map-types/spark/SparkMap.d.ts +4 -0
  85. package/build/types/map-types/spark/SparkMapConfig.d.ts +32 -0
  86. package/package.json +3 -2
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eurostat-map",
3
- "version": "4.4.5",
3
+ "version": "4.5.0",
4
4
  "description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
5
5
  "keywords": [
6
6
  "eurostat",
@@ -12,6 +12,14 @@ export interface GridCartogramMargins {
12
12
  left: number
13
13
  }
14
14
 
15
+ /** Shared chart offset for symbols drawn inside each grid cell. */
16
+ export interface GridCartogramChartOffset {
17
+ /** Horizontal offset in pixels. Positive moves right. */
18
+ x: number
19
+ /** Vertical offset in pixels. Positive moves down. */
20
+ y: number
21
+ }
22
+
15
23
  /**
16
24
  * Settings for grid cartogram layout and geometry.
17
25
  */
@@ -22,6 +30,31 @@ export interface GridCartogramSettings {
22
30
  margins: GridCartogramMargins
23
31
  /** Extra spacing between grid cells in pixels. */
24
32
  cellPadding: number
33
+ /** Country-label rendering settings for grid cartograms. */
34
+ countryLabelSettings?: {
35
+ /** Show country labels as codes, names, or a custom string. */
36
+ countryLabels?: 'code' | 'name' | ((id: string, name: string | undefined, region?: any) => string)
37
+ /** Base font size for country labels in grid cartograms. */
38
+ countryLabelFontSize?: number
39
+ /** Minimum font size allowed when shrinking labels to avoid overlap. */
40
+ countryLabelMinFontSize?: number
41
+ /** Extra padding subtracted from the available label width before fitting. */
42
+ countryLabelPadding?: { x: number; y: number }
43
+ /** Disable automatic label shrinking/stretching to avoid overlap. @default false */
44
+ countryLabelAvoidOverlap?: boolean
45
+ }
46
+ /** @deprecated Use countryLabelSettings.countryLabels instead. */
47
+ countryLabels?: 'code' | 'name' | ((id: string, name: string | undefined, region?: any) => string)
48
+ /** @deprecated Use countryLabelSettings.countryLabelFontSize instead. */
49
+ countryLabelFontSize?: number
50
+ /** @deprecated Use countryLabelSettings.countryLabelMinFontSize instead. */
51
+ countryLabelMinFontSize?: number
52
+ /** @deprecated Use countryLabelSettings.countryLabelPadding instead. */
53
+ countryLabelPadding?: { x: number; y: number }
54
+ /** @deprecated Use countryLabelSettings.countryLabelAvoidOverlap instead. */
55
+ countryLabelAvoidOverlap?: boolean
56
+ /** Shared chart offset in grid cells for chart-based map types. */
57
+ chartOffset: GridCartogramChartOffset
25
58
  /**
26
59
  * Custom grid layout CSV string.
27
60
  * If undefined, the built-in layout for the selected shape is used.
@@ -1,4 +1,5 @@
1
1
  import type { StatConfig } from './stat/StatConfig'
2
+ import type { CompositionStatConfig } from '../layers/composition/CompositionStatConfig'
2
3
  import type { LegendConfig } from '../legend/LegendConfig'
3
4
  import type { TooltipConfig } from './TooltipConfig'
4
5
  import type { InsetConfig } from './InsetConfig'
@@ -7,6 +8,7 @@ import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
7
8
  import type { GridCartogramSettings } from './GridCartogramSettings'
8
9
  import type { DorlingSettings } from './DorlingSettings'
9
10
  import type { ScalebarConfig } from './decoration/ScalebarConfig'
11
+ import type { EncodingConfig } from './encoding/EncodingConfig'
10
12
 
11
13
  /**
12
14
  * 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.
@@ -56,8 +58,17 @@ export interface MapConfig {
56
58
  /** Data source text. */
57
59
  source?: string
58
60
 
59
- /** Statistical data configuration. */
60
- stat?: StatConfig
61
+ /**
62
+ * Statistical data configuration.
63
+ *
64
+ * Preferred for multi-dataset maps:
65
+ * - set named datasets via `stat` dictionary
66
+ * - bind channels via `encoding`
67
+ */
68
+ stat?: StatConfig | CompositionStatConfig | Record<string, StatConfig | CompositionStatConfig>
69
+
70
+ /** Optional visual encoding configuration by channel (size, color, fill, composition, etc.). */
71
+ encoding?: Record<string, EncodingConfig>
61
72
 
62
73
  /** Legend configuration. */
63
74
  legend?: LegendConfig | false
@@ -1,5 +1,8 @@
1
1
  import type { StatConfig } from './stat/StatConfig'
2
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'
3
6
  import type { LegendConfig } from '../legend/LegendConfig'
4
7
  import type { TooltipConfig } from './TooltipConfig'
5
8
  import type { InsetConfig } from './InsetConfig'
@@ -7,6 +10,8 @@ import type { CoastalMarginSettings } from './decoration/CoastalMarginSettings'
7
10
  import type { GridCartogramSettings } from './GridCartogramSettings'
8
11
  import type { DorlingSettings } from './DorlingSettings'
9
12
  import type { ScalebarConfig } from './decoration/ScalebarConfig'
13
+ import type { EncodingConfig } from './encoding/EncodingConfig'
14
+ import type { LocationConfig } from './locations'
10
15
 
11
16
  /**
12
17
  * A eurostat-map instance. Created by eurostatmap.map() and extended
@@ -117,10 +122,50 @@ export interface MapInstance {
117
122
  * - `map.stat('v1', config)` → sets the stat config for key 'v1'
118
123
  * @example map.stat({ eurostatDatasetCode: 'demo_r_d3dens', filters: { TIME: '2024' } })
119
124
  */
120
- stat(): StatConfig
121
- stat(config: StatConfig): this
122
- stat(key: string): StatConfig
123
- stat(key: string, config: StatConfig): this
125
+ stat(): StatConfig | CompositionStatConfig | undefined
126
+ stat(config: StatConfig | CompositionStatConfig): this
127
+ stat(key: string): StatConfig | CompositionStatConfig | undefined
128
+ stat(key: string, config: StatConfig | CompositionStatConfig): this
129
+ /**
130
+ * Legacy compatibility overload for composition channels.
131
+ * Preferred: pass category fields directly inside config.
132
+ */
133
+ stat(
134
+ key: string,
135
+ config: StatConfig | CompositionStatConfig,
136
+ categoryParameter: string,
137
+ categoryCodes?: string[],
138
+ categoryLabels?: string[],
139
+ categoryColors?: string[],
140
+ totalCode?: string
141
+ ): this
142
+
143
+ /**
144
+ * Get or set visual encodings that map named stats to visual variables.
145
+ * @example map.encoding('size', { stat: 'population', scale: 'sqrt', range: [4, 30] })
146
+ */
147
+ encoding(): Record<string, EncodingConfig>
148
+ encoding(channel: string): EncodingConfig | undefined
149
+ encoding(channel: string, config: EncodingConfig): this
150
+ encoding(configs: Record<string, EncodingConfig>): this
151
+
152
+ /** Returns the stat name for an encoding channel, or fallback when unset. */
153
+ getEncodingStat(channel: string, fallback?: string): string | undefined
154
+
155
+ /** Returns stat names for an encoding channel (`stats` or single `stat`). */
156
+ getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
157
+
158
+ /** Returns the concrete statData key for a channel/category combination. */
159
+ getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string | undefined
160
+
161
+ /** Returns the StatData source bound to a channel/category. */
162
+ getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData | undefined
163
+
164
+ /** Returns a region value through encoding lookup. */
165
+ getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
166
+
167
+ /** Returns unit text through encoding lookup. */
168
+ getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
124
169
 
125
170
  /**
126
171
  * Get or set the StatData instance for a given key.
@@ -246,6 +291,22 @@ export interface MapInstance {
246
291
  svg(): any
247
292
  svg(s: any): this
248
293
 
294
+ /** Add or replace a custom point location marker. */
295
+ addLocation(config: LocationConfig): this
296
+
297
+ /** Remove a custom point location marker by id. */
298
+ removeLocation(id: string): this
299
+
300
+ /** Remove all custom point location markers. */
301
+ clearLocations(): this
302
+
303
+ /** Get or replace all custom point location markers. */
304
+ locations(): LocationConfig[]
305
+ locations(configs: LocationConfig[] | null | undefined): this
306
+
307
+ /** Redraw custom point location markers. */
308
+ updateLocations(): this
309
+
249
310
  /** Custom geometry filtering function. */
250
311
  filterGeometriesFunction(): ((geometry: any) => boolean) | undefined
251
312
  filterGeometriesFunction(fn: (geometry: any) => boolean): this
@@ -445,6 +506,21 @@ export interface MapInstance {
445
506
  /** Returns region centroids as an array of projected coordinate pairs. */
446
507
  regionCentroids(): Array<{ id: string; x: number; y: number }>
447
508
 
509
+ /** Ordered thematic layer stack (bottom → top). */
510
+ layers_: Layer[]
511
+ activeLayerIndex_: number
512
+
513
+ activeLayer(): Layer
514
+ layer(ref?: number | string): Layer | undefined
515
+ layers(): Layer[]
516
+ layers(configs: LayerConfig[]): this
517
+ addLayer(type: string, config?: LayerConfig): Layer
518
+ addLayer(config: LayerConfig): Layer
519
+ removeLayer(ref: number | string): this
520
+ activeLayerIndex(): number
521
+ activeLayerIndex(i: number): this
522
+ updateAllLayers(): this
523
+
448
524
  /** Allow additional map-type-specific properties and methods. */
449
525
  [key: string]: any
450
526
  }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Configuration for mapping a named stat dataset to a visual channel.
3
+ */
4
+ export interface EncodingConfig {
5
+ /** Name of a dataset registered with map.stat(name, config). */
6
+ stat?: string
7
+ /** Names of datasets for multi-stat encodings such as bivariate color. */
8
+ stats?: string[]
9
+ /** Whether the encoding is based on raw values or category codes. */
10
+ by?: 'value' | 'category'
11
+ /** Encoding type. */
12
+ type?: 'linear' | 'sqrt' | 'threshold' | 'quantile' | 'categorical' | 'bivariate' | 'trivariate'
13
+ /** Scale type. */
14
+ scale?: 'linear' | 'sqrt' | 'quantile' | 'threshold'
15
+ /** Numeric or color output range. */
16
+ range?: [number, number] | string[]
17
+ /** Explicit encoded values, for example category colors. */
18
+ values?: Record<string, string | number> | Array<string | number>
19
+ /** Labels keyed by category code or value. */
20
+ labels?: Record<string, string> | string[]
21
+ /** Category codes when using array-based values or labels. */
22
+ categoryCodes?: string[]
23
+ /** Number of classes for classified encodings. */
24
+ classes?: number
25
+ /** Threshold values for threshold encodings. */
26
+ thresholds?: number[]
27
+ /** Color scheme name or function. */
28
+ scheme?: string | Function
29
+ /** Optional unit override for this encoding. */
30
+ unitText?: string
31
+ }
@@ -0,0 +1,31 @@
1
+ import type { MapInstance } from '../MapInstance'
2
+ import type { EncodingConfig } from '../encoding/EncodingConfig'
3
+ import type { StatData } from '../stat/StatData'
4
+ import type { LayerRole } from './LayerRole'
5
+
6
+ export interface Layer {
7
+ map: MapInstance
8
+ isLayer: true
9
+ id: string
10
+ type: string
11
+ role: LayerRole
12
+
13
+ encodings_: Record<string, EncodingConfig>
14
+
15
+ encoding(): Record<string, EncodingConfig>
16
+ encoding(channel: string): EncodingConfig | undefined
17
+ encoding(channel: string, config: EncodingConfig): Layer
18
+ encoding(map: Record<string, EncodingConfig>): Layer
19
+
20
+ getEncodingStat(channel: string, fallback?: string): string | undefined
21
+ getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
22
+ getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string
23
+ getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData
24
+ getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
25
+ getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
26
+
27
+ updateClassification(): Layer
28
+ updateStyle(): Layer
29
+ getLegendConstructor(): (map: MapInstance, config?: any) => any
30
+ group(): any // d3 selection
31
+ }
@@ -0,0 +1,19 @@
1
+ import type { MapType } from '../../layers/MapType'
2
+ import type { EncodingConfig } from '../encoding/EncodingConfig'
3
+ import type { LegendConfig } from '../../legend/LegendConfig'
4
+ import type { LayerRole } from './LayerRole'
5
+
6
+ export interface LayerConfig {
7
+ /** Stable id; auto-generated if omitted. */
8
+ id?: string
9
+ /** Layer type (same identifiers as map types). */
10
+ type: MapType
11
+ /** Explicit role; defaults from the type. */
12
+ role?: LayerRole
13
+ /** Keyed visual encodings: fill, size, color, stroke, … */
14
+ encoding?: Record<string, EncodingConfig>
15
+ /** Per-layer legend config. */
16
+ legend?: LegendConfig
17
+ /** Type-specific settings are also accepted. */
18
+ [key: string]: any
19
+ }
@@ -0,0 +1 @@
1
+ export type LayerRole = 'base' | 'overlay'
@@ -6,11 +6,37 @@ import type { MapInstance } from './MapInstance'
6
6
  export const LOCATION_SHAPES: {
7
7
  CIRCLE: 'circle'
8
8
  SQUARE: 'square'
9
+ PIN: 'pin'
9
10
  DIAMOND: 'diamond'
10
- TRIANGLE: 'triangle'
11
11
  STAR: 'star'
12
12
  CROSS: 'cross'
13
- PLUS: 'plus'
13
+ }
14
+
15
+ /**
16
+ * Available location marker shapes
17
+ */
18
+ export type LocationShape = 'circle' | 'square' | 'pin' | 'diamond' | 'cross' | 'star'
19
+
20
+ /**
21
+ * Text label style for a location marker
22
+ */
23
+ export interface LocationLabelStyle {
24
+ /** CSS font size. @default '12px' */
25
+ fontSize?: string
26
+ /** CSS font family. @default 'inherit' */
27
+ fontFamily?: string
28
+ /** CSS font weight. @default 'normal' */
29
+ fontWeight?: string | number
30
+ /** Text fill color. @default '#222' */
31
+ fill?: string
32
+ /** Text opacity. @default 1 */
33
+ opacity?: number
34
+ /** Label halo color. @default '#fff' */
35
+ haloColor?: string
36
+ /** Label halo width in pixels. @default 3 */
37
+ haloWidth?: number
38
+ /** SVG text-anchor value. @default 'start' */
39
+ textAnchor?: 'start' | 'middle' | 'end'
14
40
  }
15
41
 
16
42
  /**
@@ -19,26 +45,28 @@ export const LOCATION_SHAPES: {
19
45
  export interface LocationConfig {
20
46
  /** Unique identifier for the location */
21
47
  id?: string
22
- /** Longitude coordinate */
23
- lon: number
24
- /** Latitude coordinate */
25
- lat: number
48
+ /** Geographic X coordinate (longitude / easting) */
49
+ x: number
50
+ /** Geographic Y coordinate (latitude / northing) */
51
+ y: number
26
52
  /** Label text to display */
27
53
  label?: string
28
54
  /** Marker shape. @default 'circle' */
29
- shape?: 'circle' | 'square' | 'diamond' | 'triangle' | 'star' | 'cross' | 'plus'
30
- /** Marker size in pixels. @default 8 */
31
- size?: number
32
- /** Fill color. @default '#e74c3c' */
33
- color?: string
55
+ shape?: LocationShape
56
+ /** Marker radius in pixels. @default 6 */
57
+ radius?: number
58
+ /** Fill color. @default '#e84040' */
59
+ fill?: string
60
+ /** Fill opacity. @default 1 */
61
+ opacity?: number
34
62
  /** Stroke color. @default '#fff' */
35
63
  stroke?: string
36
- /** Stroke width in pixels. @default 1 */
64
+ /** Stroke width in pixels. @default 1.5 */
37
65
  strokeWidth?: number
38
- /** Custom CSS class */
39
- class?: string
40
- /** Custom data attached to the location */
41
- data?: any
66
+ /** Label offset from projected point in pixels. @default [7, -6] */
67
+ labelOffset?: [number, number]
68
+ /** Label text style overrides */
69
+ labelStyle?: LocationLabelStyle
42
70
  }
43
71
 
44
72
  /**
@@ -1,8 +1,13 @@
1
1
  /**
2
2
  * Configuration for a statistical data source.
3
3
  * Pass this to map.stat() or as the config argument to statData().
4
+ *
5
+ * Preferred for multi-channel maps: register named datasets with
6
+ * `map.stat('datasetName', config)` and map them with `map.encoding(...)`.
4
7
  */
5
8
  export interface StatConfig {
9
+ /** Custom data keyed by region ID. Use instead of a remote data source. */
10
+ customData?: Record<string, number | string | { value: number | string; status?: string }>
6
11
  /** Eurostat dataset code. e.g. 'demo_r_d3dens' */
7
12
  eurostatDatasetCode?: string
8
13
  /**
@@ -20,6 +25,8 @@ export interface StatConfig {
20
25
  valueCol?: string
21
26
  /** Unit of measure label shown in tooltips. e.g. 'people/km²' */
22
27
  unitText?: string
28
+ /** Optional preprocessing hook called with (regionId, value) before transform. Return null/undefined/false to filter out the region. */
29
+ preprocess?: (regionId: string, value: any) => any
23
30
  /** Optional transform function applied to raw values after data loads. e.g. v => v * 1000 */
24
31
  transform?: (value: number) => number
25
32
  /** Dataset label/name from the Eurostat API response. */
@@ -5,51 +5,51 @@
5
5
  // ==================== Core Type Imports (needed for local use in function signatures) ====================
6
6
 
7
7
  import type { MapConfig } from './core/MapConfig'
8
- import type { MapType } from './map-types/MapType'
8
+ import type { MapType } from './layers/MapType'
9
9
  import type { MapInstance } from './core/MapInstance'
10
10
 
11
11
  // Choropleth map types
12
- import type { ChoroplethConfig } from './map-types/choropleth/ChoroplethConfig'
13
- import type { ChoroplethMap } from './map-types/choropleth/ChoroplethMap'
14
- import type { ValueByAlphaConfig } from './map-types/choropleth/ValueByAlphaConfig'
15
- import type { ValueByAlphaMap } from './map-types/choropleth/ValueByAlphaMap'
16
- import type { BivariateChoroplethConfig } from './map-types/choropleth/BivariateChoroplethConfig'
17
- import type { BivariateChoroplethMap } from './map-types/choropleth/BivariateChoroplethMap'
18
- import type { TrivariateChoroplethConfig, TrivariateTernarySettings } from './map-types/choropleth/TrivariateChoroplethConfig'
19
- import type { TrivariateChoroplethMap } from './map-types/choropleth/TrivariateChoroplethMap'
12
+ import type { ChoroplethConfig } from './layers/choropleth/ChoroplethConfig'
13
+ import type { ChoroplethMap } from './layers/choropleth/ChoroplethMap'
14
+ import type { ValueByAlphaConfig } from './layers/choropleth/ValueByAlphaConfig'
15
+ import type { ValueByAlphaMap } from './layers/choropleth/ValueByAlphaMap'
16
+ import type { BivariateChoroplethConfig } from './layers/choropleth/BivariateChoroplethConfig'
17
+ import type { BivariateChoroplethMap } from './layers/choropleth/BivariateChoroplethMap'
18
+ import type { TrivariateChoroplethConfig, TrivariateTernarySettings } from './layers/choropleth/TrivariateChoroplethConfig'
19
+ import type { TrivariateChoroplethMap } from './layers/choropleth/TrivariateChoroplethMap'
20
20
 
21
21
  // Categorical map types
22
- import type { CategoricalMapConfig } from './map-types/CategoricalMapConfig'
23
- import type { CategoricalMap } from './map-types/CategoricalMap'
22
+ import type { CategoricalMapConfig } from './layers/CategoricalMapConfig'
23
+ import type { CategoricalMap } from './layers/CategoricalMap'
24
24
 
25
25
  // Proportional symbol map types
26
- import type { ProportionalSymbolConfig } from './map-types/proportional-symbol/ProportionalSymbolConfig'
27
- import type { ProportionalSymbolMap } from './map-types/proportional-symbol/ProportionalSymbolMap'
28
- import type { MushroomMapConfig } from './map-types/proportional-symbol/mushroom/MushroomMapConfig'
29
- import type { MushroomMap } from './map-types/proportional-symbol/mushroom/MushroomMap'
26
+ import type { ProportionalSymbolConfig } from './layers/proportional-symbol/ProportionalSymbolConfig'
27
+ import type { ProportionalSymbolMap } from './layers/proportional-symbol/ProportionalSymbolMap'
28
+ import type { MushroomMapConfig } from './layers/proportional-symbol/mushroom/MushroomMapConfig'
29
+ import type { MushroomMap } from './layers/proportional-symbol/mushroom/MushroomMap'
30
30
 
31
31
  // Composition map types
32
- import type { CompositionStatConfig } from './map-types/composition/CompositionStatConfig'
33
- import type { CoxcombMapConfig } from './map-types/composition/coxcomb/CoxcombMapConfig'
34
- import type { CoxcombMap } from './map-types/composition/coxcomb/CoxcombMap'
35
- import type { CoxcombStatConfig } from './map-types/composition/coxcomb/CoxcombStatConfig'
36
- import type { BarMapConfig } from './map-types/composition/bar/BarMapConfig'
37
- import type { BarMap } from './map-types/composition/bar/BarMap'
38
- import type { PieMapConfig } from './map-types/composition/pie/PieMapConfig'
39
- import type { PieMap } from './map-types/composition/pie/PieMap'
40
- import type { StripeMapConfig } from './map-types/composition/stripe/StripeMapConfig'
41
- import type { StripeMap } from './map-types/composition/stripe/StripeMap'
42
- import type { WaffleMapConfig } from './map-types/composition/waffle/WaffleMapConfig'
43
- import type { WaffleMap } from './map-types/composition/waffle/WaffleMap'
32
+ import type { CompositionStatConfig } from './layers/composition/CompositionStatConfig'
33
+ import type { CoxcombMapConfig } from './layers/composition/coxcomb/CoxcombMapConfig'
34
+ import type { CoxcombMap } from './layers/composition/coxcomb/CoxcombMap'
35
+ import type { CoxcombStatConfig } from './layers/composition/coxcomb/CoxcombStatConfig'
36
+ import type { BarMapConfig } from './layers/composition/bar/BarMapConfig'
37
+ import type { BarMap } from './layers/composition/bar/BarMap'
38
+ import type { PieMapConfig } from './layers/composition/pie/PieMapConfig'
39
+ import type { PieMap } from './layers/composition/pie/PieMap'
40
+ import type { StripeMapConfig } from './layers/composition/stripe/StripeMapConfig'
41
+ import type { StripeMap } from './layers/composition/stripe/StripeMap'
42
+ import type { WaffleMapConfig } from './layers/composition/waffle/WaffleMapConfig'
43
+ import type { WaffleMap } from './layers/composition/waffle/WaffleMap'
44
44
 
45
45
  // Spark map types
46
- import type { SparkMapConfig } from './map-types/spark/SparkMapConfig'
47
- import type { SparkMap } from './map-types/spark/SparkMap'
48
- import type { SparkStatConfig } from './map-types/spark/SparkStatConfig'
46
+ import type { SparkMapConfig } from './layers/spark/SparkMapConfig'
47
+ import type { SparkMap } from './layers/spark/SparkMap'
48
+ import type { SparkStatConfig } from './layers/spark/SparkStatConfig'
49
49
 
50
50
  // Flow map types
51
- import type { FlowMapConfig } from './map-types/flow/FlowMapConfig'
52
- import type { FlowMap } from './map-types/flow/FlowMap'
51
+ import type { FlowMapConfig } from './layers/flow/FlowMapConfig'
52
+ import type { FlowMap } from './layers/flow/FlowMap'
53
53
 
54
54
  // ==================== Core Type Exports ====================
55
55
 
@@ -58,6 +58,7 @@ export type EurostatMap = MapInstance
58
58
  export type { TooltipConfig } from './core/TooltipConfig'
59
59
  export type { LegendConfig } from './legend/LegendConfig'
60
60
  export type { StatConfig } from './core/stat/StatConfig'
61
+ export type { EncodingConfig } from './core/encoding/EncodingConfig'
61
62
  export type { StatData } from './core/stat/StatData'
62
63
  export type { InsetConfig } from './core/InsetConfig'
63
64
  export type { CoastalMarginSettings } from './core/decoration/CoastalMarginSettings'
@@ -68,6 +69,9 @@ export type { DorlingSettings, DorlingStrength } from './core/DorlingSettings'
68
69
  export type { MinimapConfig } from './core/minimaps'
69
70
  export type { LocationConfig } from './core/locations'
70
71
  export type { GeometriesClass } from './core/geo/geometries'
72
+ export type { Layer } from './core/layer/Layer'
73
+ export type { LayerConfig } from './core/layer/LayerConfig'
74
+ export type { LayerRole } from './core/layer/LayerRole'
71
75
 
72
76
  // ==================== Legend Configuration Type Exports ====================
73
77
 
@@ -160,7 +164,7 @@ export type {
160
164
  FlowCurvatureSettings,
161
165
  FlowWidthGradientSettings,
162
166
  FlowBundleSettings,
163
- } from './map-types/flow/FlowMapConfig'
167
+ } from './layers/flow/FlowMapConfig'
164
168
 
165
169
  // ==================== Pattern Fill Options ====================
166
170
 
@@ -202,6 +206,7 @@ export interface FillPatternOptions {
202
206
  * map.build();
203
207
  * ```
204
208
  */
209
+ export function map(): MapInstance
205
210
  export function map(type: 'choropleth' | 'ch', config?: ChoroplethConfig): ChoroplethMap
206
211
  export function map(type: 'proportionalSymbol' | 'proportionalSymbols' | 'ps', config?: ProportionalSymbolConfig): ProportionalSymbolMap
207
212
  export function map(type: 'categorical' | 'ct', config?: CategoricalMapConfig): CategoricalMap
@@ -0,0 +1,21 @@
1
+ import type { MapInstance } from '../core/MapInstance'
2
+
3
+ /**
4
+ * Categorical map type.
5
+ */
6
+ export interface CategoricalMap extends MapInstance {
7
+ classToFillStyle(): any
8
+ classToFillStyle(v: any): this
9
+
10
+ classToText(): any
11
+ classToText(v: any): this
12
+
13
+ noDataFillStyle(): string
14
+ noDataFillStyle(v: string): this
15
+
16
+ tooltipText(): any
17
+ tooltipText(v: any): this
18
+
19
+ classifier(): any
20
+ classifier(v: any): this
21
+ }
@@ -0,0 +1,11 @@
1
+ import type { MapConfig } from '../core/MapConfig'
2
+
3
+ /**
4
+ * Configuration for categorical map
5
+ */
6
+ export interface CategoricalMapConfig extends MapConfig {
7
+ /** Category-to-color mapping */
8
+ classToFillStyle?: Record<string, string>
9
+ /** Fill style for regions with no data */
10
+ noDataFillStyle?: string
11
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * All supported map types
3
+ */
4
+ export type MapType =
5
+ | 'choropleth'
6
+ | 'ch'
7
+ | 'proportionalSymbol'
8
+ | 'proportionalSymbols'
9
+ | 'ps'
10
+ | 'categorical'
11
+ | 'ct'
12
+ | 'bivariateChoropleth'
13
+ | 'chbi'
14
+ | 'trivariateChoropleth'
15
+ | 'ternary'
16
+ | 'chtri'
17
+ | 'stripeComposition'
18
+ | 'scomp'
19
+ | 'stripe'
20
+ | 'pieChart'
21
+ | 'pie'
22
+ | 'sparkline'
23
+ | 'spark'
24
+ | 'sparklines'
25
+ | 'flow'
26
+ | 'flowmap'
27
+ | 'coxcomb'
28
+ | 'polar'
29
+ | 'alpha'
30
+ | 'valueByAlpha'
31
+ | 'mushroom'
32
+ | 'waffle'
33
+ | 'bar'
34
+ | 'barComposition'
@@ -0,0 +1,27 @@
1
+ import type { MapConfig } from '../../core/MapConfig'
2
+ import type { BivariateLegendConfig } from '../../legend/choropleth/BivariateLegendConfig'
3
+
4
+ /**
5
+ * Configuration for bivariate choropleth maps.
6
+ */
7
+ export interface BivariateChoroplethConfig extends MapConfig {
8
+ /** Bivariate choropleth legend configuration. */
9
+ legend?: BivariateLegendConfig | false
10
+
11
+ /** Number of classes. */
12
+ numberOfClasses?: number
13
+ /** Breaks1. */
14
+ breaks1?: number[]
15
+ /** Breaks2. */
16
+ breaks2?: number[]
17
+ /** Start color. */
18
+ startColor?: string
19
+ /** Color1. */
20
+ color1?: string
21
+ /** Color2. */
22
+ color2?: string
23
+ /** End color. */
24
+ endColor?: string
25
+ /** No data fill style. */
26
+ noDataFillStyle?: string
27
+ }
@@ -0,0 +1,39 @@
1
+ import type { MapInstance } from '../../core/MapInstance'
2
+
3
+ /**
4
+ * Bivariate choropleth map type.
5
+ */
6
+ export interface BivariateChoroplethMap extends MapInstance {
7
+ numberOfClasses(): number
8
+ numberOfClasses(v: number): this
9
+
10
+ breaks1(): number[] | undefined
11
+ breaks1(v: number[] | undefined): this
12
+
13
+ breaks2(): number[] | undefined
14
+ breaks2(v: number[] | undefined): this
15
+
16
+ startColor(): string
17
+ startColor(v: string): this
18
+
19
+ color1(): string
20
+ color1(v: string): this
21
+
22
+ color2(): string
23
+ color2(v: string): this
24
+
25
+ endColor(): string
26
+ endColor(v: string): this
27
+
28
+ classToFillStyle(): any
29
+ classToFillStyle(v: any): this
30
+
31
+ noDataFillStyle(): string
32
+ noDataFillStyle(v: string): this
33
+
34
+ classifier1(): any
35
+ classifier1(v: any): this
36
+
37
+ classifier2(): any
38
+ classifier2(v: any): this
39
+ }