eurostat-map 4.4.2 → 4.4.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "eurostat-map",
3
- "version": "4.3.58",
3
+ "version": "4.4.4",
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",
@@ -112,6 +112,9 @@ export interface MapConfig {
112
112
  /** Show/hide inset map toggle button. */
113
113
  insetsButton?: boolean
114
114
 
115
+ /** Show/hide legend toggle button. */
116
+ legendButton?: boolean
117
+
115
118
  /** Show/hide placename labels. */
116
119
  placenames?: boolean
117
120
 
@@ -151,6 +154,9 @@ export interface MapConfig {
151
154
  /** Position adjustment for insets button: [x, y] */
152
155
  insetsButtonPosition?: [number, number]
153
156
 
157
+ /** Position adjustment for legend button: [x, y] */
158
+ legendButtonPosition?: [number, number]
159
+
154
160
  /** Pointer hover color for NUTS regions. */
155
161
  hoverColor?: string
156
162
 
@@ -152,7 +152,7 @@ export interface MapInstance {
152
152
  * Get or set legend configuration. Pass false to remove the legend.
153
153
  * @example map.legend({ x: 10, y: 90, title: 'Density, people/km²' })
154
154
  */
155
- legend(): LegendConfig
155
+ legend(): LegendConfig | false
156
156
  legend(config: LegendConfig | false): this
157
157
 
158
158
  /** Force-update the legend after data or style changes. */
@@ -266,6 +266,10 @@ export interface MapInstance {
266
266
  insetsButton(): boolean
267
267
  insetsButton(show: boolean): this
268
268
 
269
+ /** Show/hide legend toggle button. */
270
+ legendButton(): boolean
271
+ legendButton(show: boolean): this
272
+
269
273
  /** Filter function for placename labels. */
270
274
  placenamesFilter(): ((name: any) => boolean) | undefined
271
275
  placenamesFilter(fn: (name: any) => boolean): this
@@ -314,6 +318,10 @@ export interface MapInstance {
314
318
  insetsButtonPosition(): [number, number] | undefined
315
319
  insetsButtonPosition(pos: [number, number]): this
316
320
 
321
+ /** Position adjustment for legend button: [x, y] */
322
+ legendButtonPosition(): [number, number] | undefined
323
+ legendButtonPosition(pos: [number, number]): this
324
+
317
325
  /** Pointer hover color for NUTS regions. */
318
326
  hoverColor(): string
319
327
  hoverColor(color: string): this
@@ -58,16 +58,23 @@ 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 { StatData } from './core/stat/StatData'
61
62
  export type { InsetConfig } from './core/InsetConfig'
62
63
  export type { CoastalMarginSettings } from './core/decoration/CoastalMarginSettings'
64
+ export type { ScalebarConfig } from './core/decoration/ScalebarConfig'
65
+ export type { StampConfig } from './core/decoration/StampConfig'
63
66
  export type { GridCartogramSettings, GridCartogramMargins } from './core/GridCartogramSettings'
64
67
  export type { DorlingSettings, DorlingStrength } from './core/DorlingSettings'
68
+ export type { MinimapConfig } from './core/minimaps'
69
+ export type { LocationConfig } from './core/locations'
70
+ export type { GeometriesClass } from './core/geo/geometries'
65
71
 
66
72
  // ==================== Legend Configuration Type Exports ====================
67
73
 
68
74
  // Main legend types
69
75
  export type { CategoricalLegendConfig } from './legend/CategoricalLegendConfig'
70
76
  export type { MushroomLegendConfig } from './legend/MushroomLegendConfig'
77
+ export type { MushroomSizeLegendConfig, MushroomColorLegendConfig } from './legend/MushroomLegendConfig'
71
78
  export type { PatternFillLegendConfig } from './legend/PatternFillLegendConfig'
72
79
 
73
80
  // Choropleth legend types
@@ -78,9 +85,13 @@ export type { TrivariateLegendConfig } from './legend/choropleth/TrivariateLegen
78
85
 
79
86
  // Composition legend types
80
87
  export type { BarChartLegendConfig } from './legend/composition/BarChartLegendConfig'
88
+ export type { BarChartSizeLegendConfig, BarChartColorLegendConfig } from './legend/composition/BarChartLegendConfig'
81
89
  export type { CoxcombLegendConfig } from './legend/composition/CoxcombLegendConfig'
90
+ export type { CoxcombSizeLegendConfig, CoxcombColorLegendConfig, CoxcombTimeLegendConfig } from './legend/composition/CoxcombLegendConfig'
82
91
  export type { PieChartLegendConfig } from './legend/composition/PieChartLegendConfig'
92
+ export type { PieChartSizeLegendConfig, PieChartColorLegendConfig } from './legend/composition/PieChartLegendConfig'
83
93
  export type { WaffleLegendConfig } from './legend/composition/WaffleLegendConfig'
94
+ export type { WaffleSizeLegendConfig, WaffleColorLegendConfig } from './legend/composition/WaffleLegendConfig'
84
95
  export type { StripeCompositionLegendConfig } from './legend/composition/StripeCompositionLegendConfig'
85
96
  export type {
86
97
  SparklineLegendConfig,
@@ -91,9 +102,14 @@ export type {
91
102
 
92
103
  // Flow legend types
93
104
  export type { FlowMapLegendConfig } from './legend/flow/FlowMapLegendConfig'
105
+ export type { FlowWidthLegendConfig, NodeSizeLegendConfig, FlowColorLegendConfig, RegionColorLegendConfig } from './legend/flow/FlowMapLegendConfig'
94
106
 
95
107
  // Proportional symbol legend types
96
108
  export type { ProportionalSymbolsLegendConfig } from './legend/proportional-symbol/ProportionalSymbolsLegendConfig'
109
+ export type {
110
+ ProportionalSymbolSizeLegendConfig,
111
+ ProportionalSymbolColorLegendConfig,
112
+ } from './legend/proportional-symbol/ProportionalSymbolsLegendConfig'
97
113
 
98
114
  // ==================== Map Type Exports ====================
99
115
 
@@ -136,6 +152,14 @@ export type { SparkMapConfig, SparkMap, SparkStatConfig }
136
152
 
137
153
  // Flow map types
138
154
  export type { FlowMapConfig, FlowMap }
155
+ export type {
156
+ FlowNode,
157
+ FlowLink,
158
+ FlowGraph,
159
+ FlowCurvatureSettings,
160
+ FlowWidthGradientSettings,
161
+ FlowBundleSettings,
162
+ } from './map-types/flow/FlowMapConfig'
139
163
 
140
164
  // ==================== Pattern Fill Options ====================
141
165
 
@@ -1,8 +1,24 @@
1
1
  /**
2
2
  * Statistical configuration for composition maps (pie, bar, waffle, stripe).
3
+ *
4
+ * Either `eurostatDatasetCode` + `categoryParameter` (Eurostat API path)
5
+ * or `customData` (custom data path) must be provided.
3
6
  */
4
- export interface CompositionStatConfig {
5
- /** Eurostat dataset code. */
7
+ export interface CompositionStatConfig<TCustomData = Record<string, Record<string, number>>> {
8
+ /**
9
+ * Custom data keyed by region ID then category code.
10
+ * Use instead of `eurostatDatasetCode` when supplying data directly.
11
+ * When `customData` is set, `eurostatDatasetCode` and `categoryParameter`
12
+ * are not required.
13
+ * @example
14
+ * customData: {
15
+ * ES: { cat1: 2, cat2: 3, cat3: 5 },
16
+ * DE: { cat1: 4, cat2: 1, cat3: 6 },
17
+ * }
18
+ */
19
+ customData?: TCustomData
20
+
21
+ /** Eurostat dataset code. Required when not using `customData`. */
6
22
  eurostatDatasetCode?: string
7
23
  /** Filters. */
8
24
  filters?: Record<string, any>
@@ -10,7 +26,7 @@ export interface CompositionStatConfig {
10
26
  unitText?: string
11
27
  transform?: (value: number) => number
12
28
 
13
- /** Category parameter. */
29
+ /** Category parameter. Required when not using `customData`. */
14
30
  categoryParameter?: string
15
31
  /** Category codes. */
16
32
  categoryCodes?: string[]
@@ -6,7 +6,7 @@ import type { BarChartLegendConfig } from '../../../legend/composition/BarChartL
6
6
  * Bar map type.
7
7
  */
8
8
  export interface BarMap extends MapInstance {
9
- legend(): BarChartLegendConfig
9
+ legend(): BarChartLegendConfig | false
10
10
  legend(config: BarChartLegendConfig | false): this
11
11
 
12
12
  barType(): 'stacked' | 'grouped'
@@ -6,7 +6,7 @@ import type { CoxcombLegendConfig } from '../../../legend/composition/CoxcombLeg
6
6
  * Coxcomb map type.
7
7
  */
8
8
  export interface CoxcombMap extends MapInstance {
9
- legend(): CoxcombLegendConfig
9
+ legend(): CoxcombLegendConfig | false
10
10
  legend(config: CoxcombLegendConfig | false): this
11
11
 
12
12
  catColors(): any
@@ -3,14 +3,11 @@ import { CompositionStatConfig } from '../CompositionStatConfig'
3
3
  /**
4
4
  * Statistical configuration for coxcomb maps.
5
5
  */
6
- export interface CoxcombStatConfig extends CompositionStatConfig {
6
+ export interface CoxcombStatConfig extends CompositionStatConfig<Record<string, Record<string, Record<string, number>>>> {
7
7
  /** Eurostat path. */
8
8
  timeParameter?: string
9
9
  /** Times. */
10
10
  times: string[]
11
11
  /** Time labels. */
12
12
  timeLabels?: string[]
13
-
14
- /** Custom data path. */
15
- customData?: Record<string, Record<string, Record<string, number>>>
16
13
  }
@@ -6,7 +6,7 @@ import type { PieChartLegendConfig } from '../../../legend/composition/PieChartL
6
6
  * Pie map type.
7
7
  */
8
8
  export interface PieMap extends MapInstance {
9
- legend(): PieChartLegendConfig
9
+ legend(): PieChartLegendConfig | false
10
10
  legend(config: PieChartLegendConfig | false): this
11
11
 
12
12
  catColors(): any
@@ -21,32 +21,47 @@ export interface PieMap extends MapInstance {
21
21
  noDataFillStyle(): string
22
22
  noDataFillStyle(v: string): this
23
23
 
24
- pieMaxRadius(): number
25
- pieMaxRadius(v: number): this
26
-
27
- pieMinRadius(): number
28
- pieMinRadius(v: number): this
29
-
30
- pieChartInnerRadius(): number
31
- pieChartInnerRadius(v: number): this
32
-
33
- pieOtherColor(): string
34
- pieOtherColor(v: string): this
35
-
36
- pieOtherText(): string
37
- pieOtherText(v: string): this
38
-
39
- pieStrokeFill(): string
40
- pieStrokeFill(v: string): this
41
-
42
- pieStrokeWidth(): number
43
- pieStrokeWidth(v: number): this
24
+ pieSettings(): {
25
+ innerRadius?: number
26
+ }
27
+ pieSettings(v: { innerRadius?: number }): this
28
+
29
+ compositionSettings(): {
30
+ type?: 'flag' | 'pie' | 'ring' | 'segment' | 'radar' | 'agepyramid' | 'halftone'
31
+ minSize?: number
32
+ maxSize?: number
33
+ strokeFill?: string
34
+ strokeWidth?: number
35
+ reverseOrder?: boolean
36
+ /** Category code order for composition rendering. */
37
+ order?: string[]
38
+ stripesOrientation?: number
39
+ offsetAngle?: number
40
+ agePyramidHeightFactor?: number
41
+ otherColor?: string
42
+ otherText?: string
43
+ }
44
+ compositionSettings(v: {
45
+ type?: 'flag' | 'pie' | 'ring' | 'segment' | 'radar' | 'agepyramid' | 'halftone'
46
+ minSize?: number
47
+ maxSize?: number
48
+ strokeFill?: string
49
+ strokeWidth?: number
50
+ reverseOrder?: boolean
51
+ /** Category code order for composition rendering. */
52
+ order?: string[]
53
+ stripesOrientation?: number
54
+ offsetAngle?: number
55
+ agePyramidHeightFactor?: number
56
+ otherColor?: string
57
+ otherText?: string
58
+ }): this
44
59
 
45
60
  dorling(): boolean
46
61
  dorling(v: boolean): this
47
62
 
48
- pieTotalCode(): string | undefined
49
- pieTotalCode(v: string | undefined): this
63
+ compositionTotalCode(): string | undefined
64
+ compositionTotalCode(v: string | undefined): this
50
65
 
51
66
  statCodes(): string[] | undefined
52
67
  statCodes(v: string[] | undefined): this
@@ -5,16 +5,26 @@ import type { PieChartLegendConfig } from '../../../legend/composition/PieChartL
5
5
  * Configuration for pie chart composition maps.
6
6
  */
7
7
  export interface PieMapConfig extends MapConfig {
8
- /** Pie min radius. */
9
- pieMinRadius?: number
10
- /** Pie max radius. */
11
- pieMaxRadius?: number
12
- /** Pie chart inner radius. */
13
- pieChartInnerRadius?: number
14
- /** Pie stroke fill. */
15
- pieStrokeFill?: string
16
- /** Pie stroke width. */
17
- pieStrokeWidth?: number
8
+ /** Pie-specific rendering settings. */
9
+ pieSettings?: {
10
+ innerRadius?: number
11
+ }
12
+ /** Consolidated composition symbol settings. */
13
+ compositionSettings?: {
14
+ type?: 'flag' | 'pie' | 'ring' | 'segment' | 'radar' | 'agepyramid' | 'halftone'
15
+ minSize?: number
16
+ maxSize?: number
17
+ strokeFill?: string
18
+ strokeWidth?: number
19
+ reverseOrder?: boolean
20
+ /** Category code order for composition rendering. */
21
+ order?: string[]
22
+ stripesOrientation?: number
23
+ offsetAngle?: number
24
+ agePyramidHeightFactor?: number
25
+ otherColor?: string
26
+ otherText?: string
27
+ }
18
28
  /** Tooltip pie radius. */
19
29
  tooltipPieRadius?: number
20
30
  /** Tooltip pie inner radius. */
@@ -23,18 +33,14 @@ export interface PieMapConfig extends MapConfig {
23
33
  catColors?: Record<string, string>
24
34
  /** Cat labels. */
25
35
  catLabels?: Record<string, string>
26
- /** Pie other color. */
27
- pieOtherColor?: string
28
- /** Pie other text. */
29
- pieOtherText?: string
30
36
  /** Show only when complete. */
31
37
  showOnlyWhenComplete?: boolean
32
38
  /** No data fill style. */
33
39
  noDataFillStyle?: string
34
40
  /** Dorling. */
35
41
  dorling?: boolean
36
- /** Pie total code. */
37
- pieTotalCode?: string
42
+ /** Total code used to compute optional 'other' composition share. */
43
+ compositionTotalCode?: string
38
44
  /** Stat codes. */
39
45
  statCodes?: string[]
40
46
  /** Legend. */
@@ -6,7 +6,7 @@ import type { StripeCompositionLegendConfig } from '../../../legend/composition/
6
6
  * Stripe map type.
7
7
  */
8
8
  export interface StripeMap extends MapInstance {
9
- legend(): StripeCompositionLegendConfig
9
+ legend(): StripeCompositionLegendConfig | false
10
10
  legend(config: StripeCompositionLegendConfig | false): this
11
11
 
12
12
  stripeWidth(): number
@@ -21,6 +21,12 @@ export interface StripeMap extends MapInstance {
21
21
  catLabels(): any
22
22
  catLabels(v: any): this
23
23
 
24
+ stripeOtherColor(): string
25
+ stripeOtherColor(v: string): this
26
+
27
+ stripeOtherText(): string
28
+ stripeOtherText(v: string): this
29
+
24
30
  showOnlyWhenComplete(): boolean
25
31
  showOnlyWhenComplete(v: boolean): this
26
32
 
@@ -33,6 +39,9 @@ export interface StripeMap extends MapInstance {
33
39
  pieChartInnerRadius(): number
34
40
  pieChartInnerRadius(v: number): this
35
41
 
42
+ stripeTotalCode(): string | undefined
43
+ stripeTotalCode(v: string | undefined): this
44
+
36
45
  statCodes(): string[] | undefined
37
46
  statCodes(v: string[] | undefined): this
38
47
 
@@ -47,6 +56,8 @@ export interface StripeMap extends MapInstance {
47
56
  /** Category labels. */
48
57
  categoryLabels?: string[],
49
58
  /** Category colors. */
50
- categoryColors?: string[]
59
+ categoryColors?: string[],
60
+ /** Total code. */
61
+ totalCode?: string
51
62
  ): this
52
63
  }
@@ -13,6 +13,10 @@ export interface StripeMapConfig extends MapConfig {
13
13
  catColors?: Record<string, string>
14
14
  /** Cat labels. */
15
15
  catLabels?: Record<string, string>
16
+ /** Stripe other color. */
17
+ stripeOtherColor?: string
18
+ /** Stripe other text. */
19
+ stripeOtherText?: string
16
20
  /** Show only when complete. */
17
21
  showOnlyWhenComplete?: boolean
18
22
  /** No data fill style. */
@@ -21,6 +25,8 @@ export interface StripeMapConfig extends MapConfig {
21
25
  pieChartRadius?: number
22
26
  /** Pie chart inner radius. */
23
27
  pieChartInnerRadius?: number
28
+ /** Stripe total code. */
29
+ stripeTotalCode?: string
24
30
  /** Stat codes. */
25
31
  statCodes?: string[]
26
32
  /** Legend. */
@@ -6,7 +6,7 @@ import type { WaffleLegendConfig } from '../../../legend/composition/WaffleLegen
6
6
  * Waffle map type.
7
7
  */
8
8
  export interface WaffleMap extends MapInstance {
9
- legend(): WaffleLegendConfig
9
+ legend(): WaffleLegendConfig | false
10
10
  legend(config: WaffleLegendConfig | false): this
11
11
 
12
12
  catColors(): any
@@ -6,7 +6,7 @@ import type { SparklineLegendConfig } from '../../legend/composition/SparklineLe
6
6
  * Spark map type.
7
7
  */
8
8
  export interface SparkMap extends MapInstance {
9
- legend(): SparklineLegendConfig
9
+ legend(): SparklineLegendConfig | false
10
10
  legend(config: SparklineLegendConfig | false): this
11
11
 
12
12
  sparkLineColor(): any
@@ -1,16 +1,32 @@
1
1
  /**
2
2
  * Statistical configuration for sparkline maps.
3
+ *
4
+ * Either `eurostatDatasetCode` + `dates` (Eurostat API path)
5
+ * or `customData` (custom data path) must be provided.
3
6
  */
4
7
  export interface SparkStatConfig {
5
- /** Eurostat dataset code. */
6
- eurostatDatasetCode: string
8
+ /**
9
+ * Custom data keyed by region ID then date string.
10
+ * Use instead of `eurostatDatasetCode` when supplying data directly.
11
+ * When `customData` is set, `eurostatDatasetCode` is not required;
12
+ * `dates` defaults to the key order of the first region's entries.
13
+ * @example
14
+ * customData: {
15
+ * ES: { '2020': 100, '2021': 120, '2022': 115 },
16
+ * DE: { '2020': 200, '2021': 190, '2022': 210 },
17
+ * }
18
+ */
19
+ customData?: Record<string, Record<string, number>>
20
+
21
+ /** Eurostat dataset code. Required when not using `customData`. */
22
+ eurostatDatasetCode?: string
7
23
  /** Filters. */
8
24
  filters?: Record<string, any>
9
25
  /** Unit text. */
10
26
  unitText?: string
11
27
  transform?: (value: number) => number
12
- /** Dates. */
13
- dates: string[]
14
- /** Labels. */
28
+ /** Date keys to fetch. Required when not using `customData`. */
29
+ dates?: string[]
30
+ /** Display labels for each date. */
15
31
  labels?: string[]
16
32
  }
package/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "eurostat-map",
3
- "version": "4.4.2",
3
+ "version": "4.4.4",
4
4
  "description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
5
5
  "keywords": [
6
+ "cartography",
7
+ "data visualization",
8
+ "dataviz",
9
+ "maps",
10
+ "d3",
11
+ "europe",
6
12
  "eurostat",
7
13
  "statistics",
8
- "europe",
9
14
  "SVG",
10
15
  "NUTS",
11
- "map",
12
- "D3",
13
- "cartography",
14
- "thematic",
15
- "mapping",
16
- "eurostat-map",
17
- "dataviz",
18
- "data visualization"
16
+ "thematic-mapping",
17
+ "eurostat-map"
19
18
  ],
20
19
  "homepage": "https://github.com/eurostat/eurostat-map",
21
20
  "author": "",
@@ -41,8 +40,9 @@
41
40
  "copy-types": "copyfiles -u 2 \"src/types/**/*.d.ts\" build/types",
42
41
  "check:types:legend-config-sync": "node test/scripts/check-legend-config-sync.js",
43
42
  "type-check": "npm run check:types:legend-config-sync && tsc --noEmit && tsc --noEmit test/typescript-test.ts",
44
- "docs:api": "typedoc --options typedoc.json",
45
- "docs": "npm run docs:api",
43
+ "update-docs": "typedoc --options typedoc.json",
44
+ "update-examples": "npm run update-examples-manifest && npm run generate-previews",
45
+ "update-examples-manifest": "node examples/scripts/update-examples-manifest.js",
46
46
  "generate-previews": "node examples/scripts/generate-previews.js"
47
47
  },
48
48
  "dependencies": {