eurostat-map 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/215.eurostatmap.min.js +1 -1
- package/build/eurostatmap.js +3279 -3153
- package/build/eurostatmap.min.js +2 -2
- package/build/eurostatmap.min.js.map +1 -1
- package/build/package.json +1 -1
- package/build/types/core/MapInstance.d.ts +7 -3
- package/build/types/core/decoration/LabelsConfig.d.ts +89 -0
- package/build/types/legend/choropleth/BivariateLegendConfig.d.ts +135 -138
- package/package.json +1 -1
package/build/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import type { DorlingSettings } from './DorlingSettings'
|
|
|
12
12
|
import type { ScalebarConfig } from './decoration/ScalebarConfig'
|
|
13
13
|
import type { EncodingConfig } from './encoding/EncodingConfig'
|
|
14
14
|
import type { LocationConfig } from './locations'
|
|
15
|
+
import type { LabelsConfig } from './decoration/LabelsConfig'
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A eurostat-map instance. Created by eurostatmap.map() and extended
|
|
@@ -257,9 +258,12 @@ export interface MapInstance {
|
|
|
257
258
|
placenames(): boolean
|
|
258
259
|
placenames(show: boolean): this
|
|
259
260
|
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Get or set label configuration for country names, statistical values, etc.
|
|
263
|
+
* @example map.labels({ values: true, backgrounds: true, backgroundFill: '#B19122' })
|
|
264
|
+
*/
|
|
265
|
+
labels(): LabelsConfig | undefined
|
|
266
|
+
labels(config: LabelsConfig): this
|
|
263
267
|
|
|
264
268
|
/** Annotation configuration for d3-svg-annotation. */
|
|
265
269
|
annotations(): any
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for map labels (country names, statistical values, etc.)
|
|
3
|
+
*/
|
|
4
|
+
export interface LabelsConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Array of label objects with text and coordinates.
|
|
7
|
+
* Use eurostatmap.getDefaultLabels() to get predefined geographic labels.
|
|
8
|
+
*/
|
|
9
|
+
labels?: Array<{
|
|
10
|
+
text: string
|
|
11
|
+
x: number
|
|
12
|
+
y: number
|
|
13
|
+
class?: string
|
|
14
|
+
size?: number
|
|
15
|
+
rotate?: number
|
|
16
|
+
letterSpacing?: number
|
|
17
|
+
cc?: string
|
|
18
|
+
}>
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Show statistical values as labels on regions.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
values?: boolean
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Apply halo/shadow effect around labels for better readability.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
halos?: boolean
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Legacy alias for halos.
|
|
34
|
+
* @deprecated Use halos instead
|
|
35
|
+
*/
|
|
36
|
+
shadows?: boolean
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Apply solid background rectangles behind labels.
|
|
40
|
+
* Takes precedence over halos when both are set.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
backgrounds?: boolean
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Fill color for label background rectangles (CSS color string).
|
|
47
|
+
* Only applies when backgrounds is true.
|
|
48
|
+
* @default '#ffffff'
|
|
49
|
+
* @example 'white'
|
|
50
|
+
* @example '#B19122'
|
|
51
|
+
* @example 'rgba(255, 255, 255, 0.9)'
|
|
52
|
+
*/
|
|
53
|
+
backgroundFill?: string
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Scale labels when zooming in/out.
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
scaleOnZoom?: boolean
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Custom formatter function for statistical value labels.
|
|
63
|
+
* @example (value) => value.toFixed(1) + '%'
|
|
64
|
+
*/
|
|
65
|
+
valuesFormatter?: (value: number) => string
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Filter function to show/hide statistical value labels for specific regions.
|
|
69
|
+
* @param region - GeoJSON feature object
|
|
70
|
+
* @param map - Map instance
|
|
71
|
+
* @returns true to show label, false to hide
|
|
72
|
+
*/
|
|
73
|
+
statLabelsFilterFunction?: (region: any, map: any) => boolean
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Override default centroid positions for statistical value labels.
|
|
77
|
+
* Keys are region IDs (e.g., 'DE', 'FR01'), values are {x, y} coordinates.
|
|
78
|
+
*/
|
|
79
|
+
statLabelsPositions?: Record<string, { x: number; y: number }>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Function to adjust calculated centroids for value labels.
|
|
83
|
+
* @param region - GeoJSON feature object
|
|
84
|
+
* @param centroid - Calculated centroid [x, y]
|
|
85
|
+
* @returns Adjusted centroid [x, y]
|
|
86
|
+
* @example (region, centroid) => [centroid[0] + 10, centroid[1] - 10]
|
|
87
|
+
*/
|
|
88
|
+
processValueLabelCentroids?: (region: any, centroid: [number, number]) => [number, number]
|
|
89
|
+
}
|
|
@@ -1,138 +1,135 @@
|
|
|
1
|
-
import { LegendConfig } from '../LegendConfig'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for bivariate choropleth map legends.
|
|
5
|
-
* Displays a 2D grid showing the relationship between two variables,
|
|
6
|
-
* with color squares representing different class combinations.
|
|
7
|
-
*/
|
|
8
|
-
export interface BivariateLegendConfig extends LegendConfig {
|
|
9
|
-
/** Size of the legend square grid in pixels. @default 100 */
|
|
10
|
-
squareSize?: number
|
|
11
|
-
|
|
12
|
-
/** Rotation angle of the legend in degrees. @default 0 */
|
|
13
|
-
rotation?: number
|
|
14
|
-
|
|
15
|
-
/** Label for the first variable (y-axis). @default 'Variable 1' */
|
|
16
|
-
label1?: string
|
|
17
|
-
|
|
18
|
-
/** Label for the second variable (x-axis). @default 'Variable 2' */
|
|
19
|
-
label2?: string
|
|
20
|
-
|
|
21
|
-
/** Break
|
|
22
|
-
breaks1?: number
|
|
23
|
-
|
|
24
|
-
/** Break
|
|
25
|
-
breaks2?: number
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/** Offset adjustments for
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/** Offset adjustments for
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/** Offset adjustments for
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
topLeft?: number
|
|
137
|
-
}
|
|
138
|
-
}
|
|
1
|
+
import { LegendConfig } from '../LegendConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for bivariate choropleth map legends.
|
|
5
|
+
* Displays a 2D grid showing the relationship between two variables,
|
|
6
|
+
* with color squares representing different class combinations.
|
|
7
|
+
*/
|
|
8
|
+
export interface BivariateLegendConfig extends LegendConfig {
|
|
9
|
+
/** Size of the legend square grid in pixels. @default 100 */
|
|
10
|
+
squareSize?: number
|
|
11
|
+
|
|
12
|
+
/** Rotation angle of the legend in degrees. @default 0 */
|
|
13
|
+
rotation?: number
|
|
14
|
+
|
|
15
|
+
/** Label for the first variable (y-axis). @default 'Variable 1' */
|
|
16
|
+
label1?: string
|
|
17
|
+
|
|
18
|
+
/** Label for the second variable (x-axis). @default 'Variable 2' */
|
|
19
|
+
label2?: string
|
|
20
|
+
|
|
21
|
+
/** Break labels for the first variable. Omit to hide first-axis break labels. */
|
|
22
|
+
breaks1?: Array<number | string>
|
|
23
|
+
|
|
24
|
+
/** Break labels for the second variable. Omit to hide second-axis break labels. */
|
|
25
|
+
breaks2?: Array<number | string>
|
|
26
|
+
|
|
27
|
+
/** Length of axis tick marks in pixels. @default 5 */
|
|
28
|
+
tickLength?: number
|
|
29
|
+
|
|
30
|
+
/** Offset adjustments for y-axis labels. @default { x: 0, y: 0 } */
|
|
31
|
+
yAxisLabelsOffset?: { x: number; y: number }
|
|
32
|
+
|
|
33
|
+
/** Offset adjustments for x-axis labels. @default { x: 0, y: 0 } */
|
|
34
|
+
xAxisLabelsOffset?: { x: number; y: number }
|
|
35
|
+
|
|
36
|
+
/** Offset adjustments for y-axis title. @default { x: 0, y: 0 } */
|
|
37
|
+
yAxisTitleOffset?: { x: number; y: number }
|
|
38
|
+
|
|
39
|
+
/** Offset adjustments for x-axis title. @default { x: 0, y: 0 } */
|
|
40
|
+
xAxisTitleOffset?: { x: number; y: number }
|
|
41
|
+
|
|
42
|
+
/** Extra vertical offset for the "no data" legend item in pixels. @default 30 */
|
|
43
|
+
noDataYOffset?: number
|
|
44
|
+
|
|
45
|
+
/** Whether to show arrows at the end of the axes. @default true */
|
|
46
|
+
axisArrows?: boolean
|
|
47
|
+
|
|
48
|
+
/** Height of axis arrows in pixels. @default 15 */
|
|
49
|
+
arrowHeight?: number
|
|
50
|
+
|
|
51
|
+
/** Width of axis arrows in pixels. @default 14 */
|
|
52
|
+
arrowWidth?: number
|
|
53
|
+
|
|
54
|
+
/** Padding between arrow and axis label in pixels. @default 10 */
|
|
55
|
+
arrowPadding?: number
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Labels displayed at low/high ends of each axis.
|
|
59
|
+
* @default { x: { low: 'Low', high: 'High' }, y: { low: 'Low', high: 'High' } }
|
|
60
|
+
*/
|
|
61
|
+
axisExtremes?: {
|
|
62
|
+
x?: { low?: string; high?: string }
|
|
63
|
+
y?: { low?: string; high?: string }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Whether to show low/high endpoint labels on both axes. @default true */
|
|
67
|
+
showAxisExtremes?: boolean
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Optional text annotations for each corner of the bivariate square.
|
|
71
|
+
* Add text for any combination of topRight, bottomRight, bottomLeft, topLeft.
|
|
72
|
+
* Supports line breaks using '<br>'/'<br/>' or '\\n'.
|
|
73
|
+
*/
|
|
74
|
+
annotations?: {
|
|
75
|
+
topRight?: string
|
|
76
|
+
bottomRight?: string
|
|
77
|
+
bottomLeft?: string
|
|
78
|
+
topLeft?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Length of corner annotation callout lines in pixels.
|
|
83
|
+
* Can be a single number for all corners, or per-corner values.
|
|
84
|
+
* @default 18
|
|
85
|
+
*/
|
|
86
|
+
annotationLineLength?:
|
|
87
|
+
| number
|
|
88
|
+
| {
|
|
89
|
+
topRight?: number
|
|
90
|
+
bottomRight?: number
|
|
91
|
+
bottomLeft?: number
|
|
92
|
+
topLeft?: number
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Annotation text offsets in pixels.
|
|
97
|
+
* Use global `{ x, y }` or per-corner values.
|
|
98
|
+
* @default auto (based on corner direction)
|
|
99
|
+
*/
|
|
100
|
+
annotationOffsets?:
|
|
101
|
+
| { x?: number; y?: number }
|
|
102
|
+
| {
|
|
103
|
+
topRight?: { x?: number; y?: number }
|
|
104
|
+
bottomRight?: { x?: number; y?: number }
|
|
105
|
+
bottomLeft?: { x?: number; y?: number }
|
|
106
|
+
topLeft?: { x?: number; y?: number }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Extra offset applied to the leader-line endpoint where it meets the annotation label.
|
|
111
|
+
* Use global `{ x, y }` or per-corner values.
|
|
112
|
+
* @default { x: 0, y: 0 }
|
|
113
|
+
*/
|
|
114
|
+
annotationLineEndOffset?:
|
|
115
|
+
| { x?: number; y?: number }
|
|
116
|
+
| {
|
|
117
|
+
topRight?: { x?: number; y?: number }
|
|
118
|
+
bottomRight?: { x?: number; y?: number }
|
|
119
|
+
bottomLeft?: { x?: number; y?: number }
|
|
120
|
+
topLeft?: { x?: number; y?: number }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated Use annotationOffsets instead.
|
|
125
|
+
* Radial padding between corner annotation callout line end and text in pixels.
|
|
126
|
+
*/
|
|
127
|
+
annotationPadding?:
|
|
128
|
+
| number
|
|
129
|
+
| {
|
|
130
|
+
topRight?: number
|
|
131
|
+
bottomRight?: number
|
|
132
|
+
bottomLeft?: number
|
|
133
|
+
topLeft?: number
|
|
134
|
+
}
|
|
135
|
+
}
|
package/package.json
CHANGED