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,96 +1,115 @@
1
- /**
2
- * A single map label (country name, statistical value label, etc.)
3
- */
4
- export interface Label {
5
- text: string
6
- x: number
7
- y: number
8
- class?: string
9
- /** Font size in pixels. @deprecated Use CSS classes instead. */
10
- size?: number
11
- rotate?: number | null
12
- letterSpacing?: number
13
- /** Country code, when this label represents a country. */
14
- cc?: string
15
- }
16
-
17
- /**
18
- * Configuration for map labels (country names, statistical values, etc.)
19
- */
20
- export interface LabelsConfig {
21
- /**
22
- * Array of label objects with text and coordinates.
23
- * Use eurostatmap.getDefaultLabels() to get predefined geographic labels.
24
- */
25
- labels?: Label[]
26
-
27
- /**
28
- * Show statistical values as labels on regions.
29
- * @default false
30
- */
31
- values?: boolean
32
-
33
- /**
34
- * Apply halo/shadow effect around labels for better readability.
35
- * @default false
36
- */
37
- halos?: boolean
38
-
39
- /**
40
- * Legacy alias for halos.
41
- * @deprecated Use halos instead
42
- */
43
- shadows?: boolean
44
-
45
- /**
46
- * Apply solid background rectangles behind labels.
47
- * Takes precedence over halos when both are set.
48
- * @default false
49
- */
50
- backgrounds?: boolean
51
-
52
- /**
53
- * Fill color for label background rectangles (CSS color string).
54
- * Only applies when backgrounds is true.
55
- * @default '#ffffff'
56
- * @example 'white'
57
- * @example '#B19122'
58
- * @example 'rgba(255, 255, 255, 0.9)'
59
- */
60
- backgroundFill?: string
61
-
62
- /**
63
- * Scale labels when zooming in/out.
64
- * @default true
65
- */
66
- scaleOnZoom?: boolean
67
-
68
- /**
69
- * Custom formatter function for statistical value labels.
70
- * @example (value) => value.toFixed(1) + '%'
71
- */
72
- valuesFormatter?: (value: number) => string
73
-
74
- /**
75
- * Filter function to show/hide statistical value labels for specific regions.
76
- * @param region - GeoJSON feature object
77
- * @param map - Map instance
78
- * @returns true to show label, false to hide
79
- */
80
- statLabelsFilterFunction?: (region: any, map: any) => boolean
81
-
82
- /**
83
- * Override default centroid positions for statistical value labels.
84
- * Keys are region IDs (e.g., 'DE', 'FR01'), values are {x, y} coordinates.
85
- */
86
- statLabelsPositions?: Record<string, { x: number; y: number }>
87
-
88
- /**
89
- * Function to adjust calculated centroids for value labels.
90
- * @param region - GeoJSON feature object
91
- * @param centroid - Calculated centroid [x, y]
92
- * @returns Adjusted centroid [x, y]
93
- * @example (region, centroid) => [centroid[0] + 10, centroid[1] - 10]
94
- */
95
- processValueLabelCentroids?: (region: any, centroid: [number, number]) => [number, number]
96
- }
1
+ /**
2
+ * A single map label (country name, statistical value label, etc.)
3
+ */
4
+ export interface Label {
5
+ text: string
6
+ x: number
7
+ y: number
8
+ class?: string
9
+ /** Font size in pixels. @deprecated Use CSS classes instead. */
10
+ size?: number
11
+ rotate?: number | null
12
+ letterSpacing?: number
13
+ /** Country code, when this label represents a country. */
14
+ cc?: string
15
+ }
16
+
17
+ /**
18
+ * Configuration for map labels (country names, statistical values, etc.)
19
+ */
20
+ export interface LabelsConfig {
21
+ /**
22
+ * Array of label objects with text and coordinates.
23
+ * Use eurostatmap.getDefaultLabels() to get predefined geographic labels.
24
+ */
25
+ labels?: Label[]
26
+
27
+ /**
28
+ * Show statistical values as labels on regions.
29
+ * @default false
30
+ */
31
+ values?: boolean
32
+
33
+ /**
34
+ * Apply halo/shadow effect around labels for better readability.
35
+ * @default false
36
+ */
37
+ halos?: boolean
38
+
39
+ /**
40
+ * Legacy alias for halos.
41
+ * @deprecated Use halos instead
42
+ */
43
+ shadows?: boolean
44
+
45
+ /**
46
+ * Apply solid background rectangles behind labels.
47
+ * Takes precedence over halos when both are set.
48
+ * @default false
49
+ */
50
+ backgrounds?: boolean
51
+
52
+ /**
53
+ * Fill color for label background rectangles (CSS color string).
54
+ * Only applies when backgrounds is true.
55
+ * @default '#ffffff'
56
+ * @example 'white'
57
+ * @example '#B19122'
58
+ * @example 'rgba(255, 255, 255, 0.9)'
59
+ */
60
+ backgroundFill?: string
61
+
62
+ /**
63
+ * Fill/stroke color for statistical value label text.
64
+ * @default '#111111'
65
+ */
66
+ statLabelTextColor?: string
67
+
68
+ /**
69
+ * Padding between statistical label text and its background edge, in pixels.
70
+ * A number applies equal padding on both axes; an object controls each axis.
71
+ * @default { x: 5, y: 2 }
72
+ */
73
+ backgroundPadding?: number | { x?: number; y?: number }
74
+
75
+ /** Background shape used for statistical value labels. @default 'rect' */
76
+ backgroundShape?: 'rect' | 'circle'
77
+
78
+ /** Corner radius in pixels when backgroundShape is 'rect'. @default 0 */
79
+ backgroundBorderRadius?: number
80
+
81
+ /**
82
+ * Scale labels when zooming in/out.
83
+ * @default true
84
+ */
85
+ scaleOnZoom?: boolean
86
+
87
+ /**
88
+ * Custom formatter function for statistical value labels.
89
+ * @example (value) => value.toFixed(1) + '%'
90
+ */
91
+ valuesFormatter?: (value: number) => string
92
+
93
+ /**
94
+ * Filter function to show/hide statistical value labels for specific regions.
95
+ * @param region - GeoJSON feature object
96
+ * @param map - Map instance
97
+ * @returns true to show label, false to hide
98
+ */
99
+ statLabelsFilterFunction?: (region: any, map: any) => boolean
100
+
101
+ /**
102
+ * Override default centroid positions for statistical value labels.
103
+ * Keys are region IDs (e.g., 'DE', 'FR01'), values are {x, y} coordinates.
104
+ */
105
+ statLabelsPositions?: Record<string, { x: number; y: number }>
106
+
107
+ /**
108
+ * Function to adjust calculated centroids for value labels.
109
+ * @param region - GeoJSON feature object
110
+ * @param centroid - Calculated centroid [x, y]
111
+ * @returns Adjusted centroid [x, y]
112
+ * @example (region, centroid) => [centroid[0] + 10, centroid[1] - 10]
113
+ */
114
+ processValueLabelCentroids?: (region: any, centroid: [number, number]) => [number, number]
115
+ }
@@ -1,47 +1,52 @@
1
- import type { MapConfig } from '../../core/MapConfig'
2
-
3
- export interface ProportionalSymbolSettings {
4
- shape?: string
5
- customShape?: any
6
- customSVG?: any
7
- spikeWidth?: number
8
- offset?: { x: number; y: number }
9
- barWidth?: number
10
- minValue?: number | undefined
11
- maxValue?: number | undefined
12
- fill?: string
13
- fillOpacity?: number
14
- stroke?: string
15
- strokeWidth?: number
16
- strokeOpacity?: number
17
- sizeScale?: 'sqrt' | 'linear' | any
18
- minSize?: number
19
- maxSize?: number
20
- classes?: number
21
- colors?: string[] | null
22
- colorFun?: any
23
- classToFillStyle?: any
24
- thresholds?: number[]
25
- classificationMethod?: string
26
- brightenFactor?: number
27
- codeLabels?: boolean
28
- }
29
-
30
- /**
31
- * Configuration for proportional symbol maps
32
- */
33
- export interface ProportionalSymbolConfig extends MapConfig {
34
- /** Symbol shape used for markers. */
35
- symbol?: 'circle' | 'square'
36
- /** Base symbol size factor. */
37
- size?: number
38
-
39
- /** Dorling cartogram. */
40
- dorling?: boolean
41
-
42
- /** Size function. */
43
- psCustomSize?: (value: number) => number
44
-
45
- /** Grouped proportional symbol style settings. */
46
- psSettings?: ProportionalSymbolSettings
47
- }
1
+ import type { MapConfig } from '../../core/MapConfig'
2
+
3
+ export interface ProportionalSymbolSettings {
4
+ shape?: string
5
+ customShape?: any
6
+ customSVG?: any
7
+ spikeWidth?: number
8
+ offset?: { x: number; y: number }
9
+ barWidth?: number
10
+ minValue?: number | undefined
11
+ maxValue?: number | undefined
12
+ fill?: string
13
+ fillOpacity?: number
14
+ stroke?: string
15
+ strokeWidth?: number
16
+ strokeOpacity?: number
17
+ sizeScale?: 'sqrt' | 'linear' | any
18
+ minSize?: number
19
+ maxSize?: number
20
+ classes?: number
21
+ colors?: string[] | null
22
+ colorFun?: any
23
+ classToFillStyle?: any
24
+ thresholds?: number[]
25
+ classificationMethod?: string
26
+ brightenFactor?: number
27
+ codeLabels?: boolean
28
+ }
29
+
30
+ /**
31
+ * Configuration for proportional symbol maps
32
+ */
33
+ export interface ProportionalSymbolConfig extends MapConfig {
34
+ /** Fill styles for categorical exceptions in the color dataset, keyed by raw value. */
35
+ categoryFillStyle?: { [rawValue: string]: string }
36
+ /** Legend and tooltip labels for categorical exceptions, keyed by raw value. */
37
+ categoryText?: { [rawValue: string]: string }
38
+
39
+ /** Symbol shape used for markers. */
40
+ symbol?: 'circle' | 'square'
41
+ /** Base symbol size factor. */
42
+ size?: number
43
+
44
+ /** Dorling cartogram. */
45
+ dorling?: boolean
46
+
47
+ /** Size function. */
48
+ psCustomSize?: (value: number) => number
49
+
50
+ /** Grouped proportional symbol style settings. */
51
+ psSettings?: ProportionalSymbolSettings
52
+ }
@@ -1,94 +1,100 @@
1
- import { MapInstance } from '../../core/MapInstance'
2
- import type { ProportionalSymbolSettings } from './ProportionalSymbolConfig'
3
-
4
- /**
5
- * Proportional symbol map object
6
- */
7
- export interface ProportionalSymbolMap extends MapInstance {
8
- psSettings(): ProportionalSymbolSettings
9
- psSettings(v: ProportionalSymbolSettings): this
10
-
11
- psMaxSize(): number
12
- psMaxSize(v: number): this
13
-
14
- psMinSize(): number
15
- psMinSize(v: number): this
16
-
17
- psMaxValue(): number | undefined
18
- psMaxValue(v: number | undefined): this
19
-
20
- psMinValue(): number | undefined
21
- psMinValue(v: number | undefined): this
22
-
23
- psFill(): string
24
- psFill(v: string): this
25
-
26
- psFillOpacity(): number
27
- psFillOpacity(v: number): this
28
-
29
- psStrokeOpacity(): number
30
- psStrokeOpacity(v: number): this
31
-
32
- psStroke(): string
33
- psStroke(v: string): this
34
-
35
- psStrokeWidth(): number
36
- psStrokeWidth(v: number): this
37
-
38
- classifierSize(): any
39
- classifierSize(v: any): this
40
-
41
- classifierColor(): any
42
- classifierColor(v: any): this
43
-
44
- psShape(): string
45
- psShape(v: string): this
46
-
47
- psCustomShape(): any
48
- psCustomShape(v: any): this
49
-
50
- psBarWidth(): number
51
- psBarWidth(v: number): this
52
-
53
- psClassToFillStyle(): any
54
- psClassToFillStyle(v: any): this
55
-
56
- psColorFun(): any
57
- psColorFun(v: any): this
58
-
59
- psSizeScale(): any
60
- psSizeScale(v: any): this
61
-
62
- noDataFillStyle(): string
63
- noDataFillStyle(v: string): this
64
-
65
- psThresholds(): number[]
66
- psThresholds(v: number[]): this
67
-
68
- psColors(): string[] | null
69
- psColors(v: string[] | null): this
70
-
71
- psCustomSVG(): any
72
- psCustomSVG(v: any): this
73
-
74
- psOffset(): { x: number; y: number }
75
- psOffset(v: { x: number; y: number }): this
76
-
77
- psClassificationMethod(): string
78
- psClassificationMethod(v: string): this
79
-
80
- psClasses(): number
81
- psClasses(v: number): this
82
-
83
- dorling(): boolean
84
- dorling(v: boolean): this
85
-
86
- psSpikeWidth(): number
87
- psSpikeWidth(v: number): this
88
-
89
- psCodeLabels(): boolean
90
- psCodeLabels(v: boolean): this
91
-
92
- psBrightenFactor(): number
93
- psBrightenFactor(v: number): this
94
- }
1
+ import { MapInstance } from '../../core/MapInstance'
2
+ import type { ProportionalSymbolSettings } from './ProportionalSymbolConfig'
3
+
4
+ /**
5
+ * Proportional symbol map object
6
+ */
7
+ export interface ProportionalSymbolMap extends MapInstance {
8
+ categoryFillStyle(): { [rawValue: string]: string } | undefined
9
+ categoryFillStyle(v: { [rawValue: string]: string }): this
10
+
11
+ categoryText(): { [rawValue: string]: string } | undefined
12
+ categoryText(v: { [rawValue: string]: string }): this
13
+
14
+ psSettings(): ProportionalSymbolSettings
15
+ psSettings(v: ProportionalSymbolSettings): this
16
+
17
+ psMaxSize(): number
18
+ psMaxSize(v: number): this
19
+
20
+ psMinSize(): number
21
+ psMinSize(v: number): this
22
+
23
+ psMaxValue(): number | undefined
24
+ psMaxValue(v: number | undefined): this
25
+
26
+ psMinValue(): number | undefined
27
+ psMinValue(v: number | undefined): this
28
+
29
+ psFill(): string
30
+ psFill(v: string): this
31
+
32
+ psFillOpacity(): number
33
+ psFillOpacity(v: number): this
34
+
35
+ psStrokeOpacity(): number
36
+ psStrokeOpacity(v: number): this
37
+
38
+ psStroke(): string
39
+ psStroke(v: string): this
40
+
41
+ psStrokeWidth(): number
42
+ psStrokeWidth(v: number): this
43
+
44
+ classifierSize(): any
45
+ classifierSize(v: any): this
46
+
47
+ classifierColor(): any
48
+ classifierColor(v: any): this
49
+
50
+ psShape(): string
51
+ psShape(v: string): this
52
+
53
+ psCustomShape(): any
54
+ psCustomShape(v: any): this
55
+
56
+ psBarWidth(): number
57
+ psBarWidth(v: number): this
58
+
59
+ psClassToFillStyle(): any
60
+ psClassToFillStyle(v: any): this
61
+
62
+ psColorFun(): any
63
+ psColorFun(v: any): this
64
+
65
+ psSizeScale(): any
66
+ psSizeScale(v: any): this
67
+
68
+ noDataFillStyle(): string
69
+ noDataFillStyle(v: string): this
70
+
71
+ psThresholds(): number[]
72
+ psThresholds(v: number[]): this
73
+
74
+ psColors(): string[] | null
75
+ psColors(v: string[] | null): this
76
+
77
+ psCustomSVG(): any
78
+ psCustomSVG(v: any): this
79
+
80
+ psOffset(): { x: number; y: number }
81
+ psOffset(v: { x: number; y: number }): this
82
+
83
+ psClassificationMethod(): string
84
+ psClassificationMethod(v: string): this
85
+
86
+ psClasses(): number
87
+ psClasses(v: number): this
88
+
89
+ dorling(): boolean
90
+ dorling(v: boolean): this
91
+
92
+ psSpikeWidth(): number
93
+ psSpikeWidth(v: number): this
94
+
95
+ psCodeLabels(): boolean
96
+ psCodeLabels(v: boolean): this
97
+
98
+ psBrightenFactor(): number
99
+ psBrightenFactor(v: number): this
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eurostat-map",
3
- "version": "4.10.4",
3
+ "version": "4.10.6",
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
  "cartography",