eurostat-map 4.3.58 → 4.4.1
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/README.md +113 -49
- package/build/215.eurostatmap.min.js +1 -1
- package/build/215.eurostatmap.min.js.map +1 -1
- package/build/eurostatmap.js +11757 -12996
- package/build/eurostatmap.min.js +2 -4
- package/build/eurostatmap.min.js.map +1 -1
- package/build/package.json +87 -0
- package/build/types/core/DorlingSettings.d.ts +29 -0
- package/build/types/core/GridCartogramSettings.d.ts +30 -0
- package/build/types/core/InsetConfig.d.ts +23 -0
- package/build/types/core/MapConfig.d.ts +95 -0
- package/build/types/core/MapInstance.d.ts +349 -0
- package/build/types/core/MinimapConfig.d.ts +11 -0
- package/build/types/core/TooltipConfig.d.ts +16 -0
- package/build/types/core/decoration/CoastalMarginSettings.d.ts +21 -0
- package/build/types/core/decoration/ScalebarConfig.d.ts +48 -0
- package/build/types/core/decoration/StampConfig.d.ts +71 -0
- package/build/types/core/geo/centroids.d.ts +33 -0
- package/build/types/core/geo/geometries.d.ts +71 -0
- package/build/types/core/geo/kosovo.d.ts +12 -0
- package/build/types/core/geo/proj4.d.ts +26 -0
- package/build/types/core/geo/projection.d.ts +29 -0
- package/build/types/core/insets.d.ts +16 -0
- package/build/types/core/layout.d.ts +23 -0
- package/build/types/core/locations.d.ts +55 -0
- package/build/types/core/minimaps.d.ts +20 -0
- package/build/types/core/scale.d.ts +30 -0
- package/build/types/core/stat/StatConfig.d.ts +27 -0
- package/build/types/core/stat/StatData.d.ts +113 -0
- package/build/types/core/utils.d.ts +198 -0
- package/build/types/core/zoom.d.ts +21 -0
- package/build/types/index.d.ts +253 -0
- package/build/types/legend/CategoricalLegendConfig.d.ts +13 -0
- package/build/types/legend/CoxcombLegendConfig.d.ts +85 -0
- package/build/types/legend/LegendConfig.d.ts +51 -0
- package/build/types/legend/MushroomLegendConfig.d.ts +56 -0
- package/build/types/legend/PatternFillLegendConfig.d.ts +11 -0
- package/build/types/legend/PieChartLegendConfig.d.ts +68 -0
- package/build/types/legend/SparklineLegendConfig.d.ts +6 -0
- package/build/types/legend/StripeCompositionLegendConfig.d.ts +11 -0
- package/build/types/legend/WaffleLegendConfig.d.ts +74 -0
- package/build/types/legend/choropleth/BivariateLegendConfig.d.ts +59 -0
- package/build/types/legend/choropleth/ChoroplethLegendConfig.d.ts +0 -0
- package/build/types/legend/choropleth/HistogramLegendConfig.d.ts +26 -0
- package/build/types/legend/choropleth/TrivariateLegendConfig.d.ts +32 -0
- package/build/types/legend/choropleth/legend-choropleth-bivariate.d.ts +2 -0
- package/build/types/legend/choropleth/legend-choropleth-trivariate.d.ts +2 -0
- package/build/types/legend/choropleth/legend-choropleth.d.ts +2 -0
- package/build/types/legend/composition/BarChartLegendConfig.d.ts +68 -0
- package/build/types/legend/composition/CoxcombLegendConfig.d.ts +85 -0
- package/build/types/legend/composition/PieChartLegendConfig.d.ts +68 -0
- package/build/types/legend/composition/SparklineLegendConfig.d.ts +94 -0
- package/build/types/legend/composition/StripeCompositionLegendConfig.d.ts +11 -0
- package/build/types/legend/composition/WaffleLegendConfig.d.ts +74 -0
- package/build/types/legend/composition/legend-bar-chart.d.ts +2 -0
- package/build/types/legend/flow/FlowLegendConfig.d.ts +0 -0
- package/build/types/legend/flow/FlowMapLegendConfig.d.ts +117 -0
- package/build/types/legend/flow/legend-flow.d.ts +2 -0
- package/build/types/legend/legend-categorical.d.ts +2 -0
- package/build/types/legend/legend-continuous.d.ts +2 -0
- package/build/types/legend/legend-discrete.d.ts +2 -0
- package/build/types/legend/legend.d.ts +13 -0
- package/build/types/legend/proportional-symbol/PropSymbolLegendConfig.d.ts +0 -0
- package/build/types/legend/proportional-symbol/ProportionalSymbolsLegendConfig.d.ts +134 -0
- package/build/types/legend/proportional-symbol/legend-proportional-symbols.d.ts +2 -0
- package/build/types/map-types/CategoricalMap.d.ts +21 -0
- package/build/types/map-types/CategoricalMapConfig.d.ts +11 -0
- package/build/types/map-types/CateogricalMapConfig.d.ts +11 -0
- package/build/types/map-types/MapType.d.ts +34 -0
- package/build/types/map-types/choropleth/BivariateChoroplethConfig.d.ts +23 -0
- package/build/types/map-types/choropleth/BivariateChoroplethMap.d.ts +39 -0
- package/build/types/map-types/choropleth/ChoroplethConfig.d.ts +35 -0
- package/build/types/map-types/choropleth/ChoroplethMap.d.ts +48 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethConfig.d.ts +28 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethMap.d.ts +15 -0
- package/build/types/map-types/choropleth/ValueByAlphaConfig.d.ts +8 -0
- package/build/types/map-types/choropleth/ValueByAlphaMap.d.ts +9 -0
- package/build/types/map-types/choropleth/map-choropleth-bivariate.d.ts +4 -0
- package/build/types/map-types/choropleth/map-choropleth-trivariate.d.ts +4 -0
- package/build/types/map-types/choropleth/map-choropleth.d.ts +47 -0
- package/build/types/map-types/choropleth/map-value-by-alpha.d.ts +4 -0
- package/build/types/map-types/composition/BarMap.d.ts +86 -0
- package/build/types/map-types/composition/BarMapConfig.d.ts +30 -0
- package/build/types/map-types/composition/CompositionStatConfig.d.ts +34 -0
- package/build/types/map-types/composition/CoxcombMap.d.ts +42 -0
- package/build/types/map-types/composition/CoxcombMapConfig.d.ts +18 -0
- package/build/types/map-types/composition/PieMap.d.ts +62 -0
- package/build/types/map-types/composition/PieMapConfig.d.ts +24 -0
- package/build/types/map-types/composition/SparkMap.d.ts +46 -0
- package/build/types/map-types/composition/SparkMapConfig.d.ts +25 -0
- package/build/types/map-types/composition/StripeMap.d.ts +43 -0
- package/build/types/map-types/composition/StripeMapConfig.d.ts +16 -0
- package/build/types/map-types/composition/WaffleMap.d.ts +71 -0
- package/build/types/map-types/composition/WaffleMapConfig.d.ts +25 -0
- package/build/types/map-types/composition/bar/BarMap.d.ts +79 -0
- package/build/types/map-types/composition/bar/BarMapConfig.d.ts +54 -0
- package/build/types/map-types/composition/composition-map.d.ts +25 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +46 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +32 -0
- package/build/types/map-types/composition/coxcomb/CoxcombStatConfig.d.ts +16 -0
- package/build/types/map-types/composition/map-bar.d.ts +5 -0
- package/build/types/map-types/composition/map-coxcomb.d.ts +5 -0
- package/build/types/map-types/composition/map-pie.d.ts +10 -0
- package/build/types/map-types/composition/map-spark.d.ts +5 -0
- package/build/types/map-types/composition/map-stripe.d.ts +5 -0
- package/build/types/map-types/composition/map-waffle.d.ts +5 -0
- package/build/types/map-types/composition/pie/PieMap.d.ts +69 -0
- package/build/types/map-types/composition/pie/PieMapConfig.d.ts +42 -0
- package/build/types/map-types/composition/stripe/StripeMap.d.ts +52 -0
- package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +28 -0
- package/build/types/map-types/composition/waffle/WaffleMap.d.ts +78 -0
- package/build/types/map-types/composition/waffle/WaffleMapConfig.d.ts +44 -0
- package/build/types/map-types/flow/FlowMap.d.ts +97 -0
- package/build/types/map-types/flow/FlowMapConfig.d.ts +158 -0
- package/build/types/map-types/flow/map-flow.d.ts +5 -0
- package/build/types/map-types/map-categorical.d.ts +19 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolConfig.d.ts +17 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +90 -0
- package/build/types/map-types/proportional-symbol/map-proportional-symbols.d.ts +35 -0
- package/build/types/map-types/proportional-symbol/mushroom/MushroomMap.d.ts +30 -0
- package/build/types/map-types/proportional-symbol/mushroom/MushroomMapConfig.d.ts +20 -0
- package/build/types/map-types/spark/SparkMap.d.ts +52 -0
- package/build/types/map-types/spark/SparkMapConfig.d.ts +42 -0
- package/build/types/map-types/spark/SparkStatConfig.d.ts +16 -0
- package/build/types/utils/FillPatternOptions.d.ts +17 -0
- package/package.json +12 -5
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ensures a <g> element with the specified class exists within the container.
|
|
5
|
+
* If it exists, clears its contents; if not, creates it.
|
|
6
|
+
*/
|
|
7
|
+
export function ensureGroup(container: any, className: string): any
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Updates or creates a CSS rule for a given selector.
|
|
11
|
+
*/
|
|
12
|
+
export function updateCSSRule(selector: string, property: string, value: string): void
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the computed font size from a CSS class name.
|
|
16
|
+
*/
|
|
17
|
+
export function getFontSizeFromClass(className: string): number
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets a computed CSS property value from a CSS class name.
|
|
21
|
+
*/
|
|
22
|
+
export function getCSSPropertyFromClass(className: string, propertyName: string): string
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Applies inline styles from computed CSS to an SVG element and its descendants.
|
|
26
|
+
* Useful for exporting SVGs with CSS styles.
|
|
27
|
+
*/
|
|
28
|
+
export function applyInlineStylesFromCSS(svgElement: SVGElement): void
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Applies computed styles to an SVG element for export.
|
|
32
|
+
*/
|
|
33
|
+
export function applyComputedStylesToSVG(svg: SVGElement): void
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Ensures an SVG element has explicit width and height attributes.
|
|
37
|
+
*/
|
|
38
|
+
export function ensureSvgSize(svg: SVGSVGElement): void
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Converts a bounding box array to a GeoJSON polygon.
|
|
42
|
+
*/
|
|
43
|
+
export function getBBOXAsGeoJSON(bb: [number, number, number, number]): any
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Converts a JSON-stat object to an index keyed by geographic codes.
|
|
47
|
+
*/
|
|
48
|
+
export function jsonstatToIndex(jsData: any): Record<string, any>
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Converts CSV data to an index keyed by geographic codes.
|
|
52
|
+
*/
|
|
53
|
+
export function csvToIndex(csvData: string, geoCol: string, valueCol: string): Record<string, number>
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Formats a number with spaces as thousand separators.
|
|
57
|
+
*/
|
|
58
|
+
export function spaceAsThousandSeparator(number: number): string
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Base URL for Eurostat REST API.
|
|
62
|
+
*/
|
|
63
|
+
export const getEstatRestDataURLBase: string
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Constructs a URL for fetching Eurostat data.
|
|
67
|
+
*/
|
|
68
|
+
export function getEstatDataURL(datasetCode: string, filters: any, lang?: string, format?: string): string
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Gets a URL parameter by name.
|
|
72
|
+
*/
|
|
73
|
+
export function getURLParameterByName(name: string): string | null
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Gets a URL parameter by name (alias).
|
|
77
|
+
*/
|
|
78
|
+
export function getParameterByName(name: string): string | null
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Checks if a map has a diverging color scheme.
|
|
82
|
+
*/
|
|
83
|
+
export function checkIfDiverging(map: MapInstance): boolean
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Centers a diverging color function around a point of divergence.
|
|
87
|
+
*/
|
|
88
|
+
export function centerDivergingColorFunction(colorFunc: any, domain: number[], pointOfDivergence?: number, transform?: (d: number) => number): any
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generates a unique ID with an optional prefix.
|
|
92
|
+
*/
|
|
93
|
+
export function generateUniqueId(prefix: string): string
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Eurostat flag codes and descriptions.
|
|
97
|
+
*/
|
|
98
|
+
export const flags: Record<string, string>
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Executes a function for all insets recursively.
|
|
102
|
+
*/
|
|
103
|
+
export function executeForAllInsets(
|
|
104
|
+
/** Insets. */
|
|
105
|
+
insets: any,
|
|
106
|
+
/** Main svg id. */
|
|
107
|
+
mainSvgId: string,
|
|
108
|
+
functionToExecute: (inset: MapInstance, ...args: any[]) => void,
|
|
109
|
+
/** Parameter. */
|
|
110
|
+
parameter?: any,
|
|
111
|
+
/** Parameter2. */
|
|
112
|
+
parameter2?: any
|
|
113
|
+
): void
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Converts first letter of a string to uppercase.
|
|
117
|
+
*/
|
|
118
|
+
export function upperCaseFirstLetter(string: string): string
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Converts a string to lowercase except for first letters of words.
|
|
122
|
+
*/
|
|
123
|
+
export function lowerCaseAllWordsExceptFirstLetters(string: string): string
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Creates a download URL for an SVG element.
|
|
127
|
+
*/
|
|
128
|
+
export function getDownloadURL(svgNode: SVGElement): string
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Serializes an SVG element to a string.
|
|
132
|
+
*/
|
|
133
|
+
export function serialize(svg: SVGElement): string
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Rasterizes an SVG element to a canvas blob.
|
|
137
|
+
*/
|
|
138
|
+
export function rasterize(svg: SVGElement): Promise<Blob>
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Converts hex color to RGB object.
|
|
142
|
+
*/
|
|
143
|
+
export function hexToRgb(hex: string): { r: number; g: number; b: number }
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Blends multiple colors using multiply blending mode.
|
|
147
|
+
*/
|
|
148
|
+
export function multiplyBlendMultipleHex(colors: string[]): string
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Blends colors using average blending.
|
|
152
|
+
*/
|
|
153
|
+
export function averageBlendHex(colors: string[]): string
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Interpolates color intensity.
|
|
157
|
+
*/
|
|
158
|
+
export function interpolateIntensity(baseColor: string, idx: number): string
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Converts rectangle coordinates to an SVG path string.
|
|
162
|
+
*/
|
|
163
|
+
export function convertRectanglesToPaths(x: number, y: number, width: number, height: number): string
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Determines appropriate text color (black/white) for a given background color.
|
|
167
|
+
*/
|
|
168
|
+
export function getTextColorForBackground(backgroundColor: string): string
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Gets the CSS selector for data-driven regions on a map.
|
|
172
|
+
*/
|
|
173
|
+
export function getRegionsSelector(map: MapInstance): string
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Gets the CSS selector for legend region highlighting.
|
|
177
|
+
*/
|
|
178
|
+
export function getLegendRegionsSelector(map: MapInstance): string
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Gets an approximate geographic bounding box for the current map view.
|
|
182
|
+
*/
|
|
183
|
+
export function getApproxCurrentGeoBbox(map: MapInstance): number[]
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Gets a region element by ID from the map.
|
|
187
|
+
*/
|
|
188
|
+
export function getRegionById(map: MapInstance, id: string): any
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Compact number formatter (e.g., 1000 → "1K").
|
|
192
|
+
*/
|
|
193
|
+
export const compactFormatter: Intl.NumberFormat
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Long number formatter.
|
|
197
|
+
*/
|
|
198
|
+
export const longFormatter: Intl.NumberFormat
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Defines the D3 zoom behavior for a map instance.
|
|
5
|
+
* Handles both geographic zoom and grid cartogram zoom.
|
|
6
|
+
* @param map - The map instance to add zoom behavior to
|
|
7
|
+
*/
|
|
8
|
+
export function defineMapZoom(map: MapInstance): void
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Defines geographic zoom behavior with pan locking and snap-back.
|
|
12
|
+
* @param map - The map instance
|
|
13
|
+
*/
|
|
14
|
+
export function defineGeographicZoom(map: MapInstance): void
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Sets the map view to a specific position and zoom level.
|
|
18
|
+
* @param map - The map instance
|
|
19
|
+
* @param pos - Position object with x, y coordinates and z zoom level
|
|
20
|
+
*/
|
|
21
|
+
export function setMapView(map: MapInstance, pos: { x?: number; y?: number; z?: number }): void
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for eurostat-map
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// ==================== Core Type Imports (needed for local use in function signatures) ====================
|
|
6
|
+
|
|
7
|
+
import type { MapConfig } from './core/MapConfig'
|
|
8
|
+
import type { MapType } from './map-types/MapType'
|
|
9
|
+
import type { MapInstance } from './core/MapInstance'
|
|
10
|
+
|
|
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 } from './map-types/choropleth/TrivariateChoroplethConfig'
|
|
19
|
+
import type { TrivariateChoroplethMap } from './map-types/choropleth/TrivariateChoroplethMap'
|
|
20
|
+
|
|
21
|
+
// Categorical map types
|
|
22
|
+
import type { CategoricalMapConfig } from './map-types/CategoricalMapConfig'
|
|
23
|
+
import type { CategoricalMap } from './map-types/CategoricalMap'
|
|
24
|
+
|
|
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'
|
|
30
|
+
|
|
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'
|
|
44
|
+
|
|
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'
|
|
49
|
+
|
|
50
|
+
// Flow map types
|
|
51
|
+
import type { FlowMapConfig } from './map-types/flow/FlowMapConfig'
|
|
52
|
+
import type { FlowMap } from './map-types/flow/FlowMap'
|
|
53
|
+
|
|
54
|
+
// ==================== Core Type Exports ====================
|
|
55
|
+
|
|
56
|
+
export type { MapConfig, MapType, MapInstance }
|
|
57
|
+
export type EurostatMap = MapInstance
|
|
58
|
+
export type { TooltipConfig } from './core/TooltipConfig'
|
|
59
|
+
export type { LegendConfig } from './legend/LegendConfig'
|
|
60
|
+
export type { StatConfig } from './core/stat/StatConfig'
|
|
61
|
+
export type { InsetConfig } from './core/InsetConfig'
|
|
62
|
+
export type { CoastalMarginSettings } from './core/decoration/CoastalMarginSettings'
|
|
63
|
+
export type { GridCartogramSettings, GridCartogramMargins } from './core/GridCartogramSettings'
|
|
64
|
+
export type { DorlingSettings, DorlingStrength } from './core/DorlingSettings'
|
|
65
|
+
|
|
66
|
+
// ==================== Legend Configuration Type Exports ====================
|
|
67
|
+
|
|
68
|
+
// Main legend types
|
|
69
|
+
export type { CategoricalLegendConfig } from './legend/CategoricalLegendConfig'
|
|
70
|
+
export type { MushroomLegendConfig } from './legend/MushroomLegendConfig'
|
|
71
|
+
export type { PatternFillLegendConfig } from './legend/PatternFillLegendConfig'
|
|
72
|
+
|
|
73
|
+
// Choropleth legend types
|
|
74
|
+
export type { BivariateLegendConfig } from './legend/choropleth/BivariateLegendConfig'
|
|
75
|
+
export type { HistogramLegendConfig } from './legend/choropleth/HistogramLegendConfig'
|
|
76
|
+
|
|
77
|
+
// Composition legend types
|
|
78
|
+
export type { BarChartLegendConfig } from './legend/composition/BarChartLegendConfig'
|
|
79
|
+
export type { CoxcombLegendConfig } from './legend/composition/CoxcombLegendConfig'
|
|
80
|
+
export type { PieChartLegendConfig } from './legend/composition/PieChartLegendConfig'
|
|
81
|
+
export type { WaffleLegendConfig } from './legend/composition/WaffleLegendConfig'
|
|
82
|
+
export type { StripeCompositionLegendConfig } from './legend/composition/StripeCompositionLegendConfig'
|
|
83
|
+
export type {
|
|
84
|
+
SparklineLegendConfig,
|
|
85
|
+
SparklineScaleLegendConfig,
|
|
86
|
+
SparklineColorLegendConfig,
|
|
87
|
+
SparklineNoDataLegendConfig,
|
|
88
|
+
} from './legend/composition/SparklineLegendConfig'
|
|
89
|
+
|
|
90
|
+
// Flow legend types
|
|
91
|
+
export type { FlowMapLegendConfig } from './legend/flow/FlowMapLegendConfig'
|
|
92
|
+
|
|
93
|
+
// Proportional symbol legend types
|
|
94
|
+
export type { ProportionalSymbolsLegendConfig } from './legend/proportional-symbol/ProportionalSymbolsLegendConfig'
|
|
95
|
+
|
|
96
|
+
// ==================== Map Type Exports ====================
|
|
97
|
+
|
|
98
|
+
// Choropleth map types
|
|
99
|
+
export type {
|
|
100
|
+
ChoroplethConfig,
|
|
101
|
+
ChoroplethMap,
|
|
102
|
+
ValueByAlphaConfig,
|
|
103
|
+
ValueByAlphaMap,
|
|
104
|
+
BivariateChoroplethConfig,
|
|
105
|
+
BivariateChoroplethMap,
|
|
106
|
+
TrivariateChoroplethConfig,
|
|
107
|
+
TrivariateChoroplethMap,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Categorical map types
|
|
111
|
+
export type { CategoricalMapConfig, CategoricalMap }
|
|
112
|
+
|
|
113
|
+
// Proportional symbol map types
|
|
114
|
+
export type { ProportionalSymbolConfig, ProportionalSymbolMap, MushroomMapConfig, MushroomMap }
|
|
115
|
+
|
|
116
|
+
// Composition map types
|
|
117
|
+
export type {
|
|
118
|
+
CompositionStatConfig,
|
|
119
|
+
CoxcombMapConfig,
|
|
120
|
+
CoxcombMap,
|
|
121
|
+
CoxcombStatConfig,
|
|
122
|
+
BarMapConfig,
|
|
123
|
+
BarMap,
|
|
124
|
+
PieMapConfig,
|
|
125
|
+
PieMap,
|
|
126
|
+
StripeMapConfig,
|
|
127
|
+
StripeMap,
|
|
128
|
+
WaffleMapConfig,
|
|
129
|
+
WaffleMap,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Spark map types
|
|
133
|
+
export type { SparkMapConfig, SparkMap, SparkStatConfig }
|
|
134
|
+
|
|
135
|
+
// Flow map types
|
|
136
|
+
export type { FlowMapConfig, FlowMap }
|
|
137
|
+
|
|
138
|
+
// ==================== Pattern Fill Options ====================
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Options for fill pattern definitions
|
|
142
|
+
*/
|
|
143
|
+
export interface FillPatternOptions {
|
|
144
|
+
/** Shape. */
|
|
145
|
+
shape?: 'circle' | 'square'
|
|
146
|
+
/** Pattern size. */
|
|
147
|
+
patternSize?: number
|
|
148
|
+
/** Min size. */
|
|
149
|
+
minSize?: number
|
|
150
|
+
/** Max size. */
|
|
151
|
+
maxSize?: number
|
|
152
|
+
/** Bck color. */
|
|
153
|
+
bckColor?: string
|
|
154
|
+
/** Symb color. */
|
|
155
|
+
symbColor?: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ==================== Main Factory Function ====================
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Main factory function to create maps
|
|
162
|
+
*
|
|
163
|
+
* @param type - The type of map to create
|
|
164
|
+
* @param config - Configuration object
|
|
165
|
+
* @returns A map object with builder pattern methods
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* import eurostatmap from 'eurostatmap';
|
|
170
|
+
*
|
|
171
|
+
* const map = eurostatmap.map('choropleth', {
|
|
172
|
+
* title: 'Population Density',
|
|
173
|
+
* stat: { eurostatDatasetCode: 'demo_r_d3dens' }
|
|
174
|
+
* });
|
|
175
|
+
* map.build();
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export function map(type: 'choropleth' | 'ch', config?: ChoroplethConfig): ChoroplethMap
|
|
179
|
+
export function map(type: 'proportionalSymbol' | 'proportionalSymbols' | 'ps', config?: ProportionalSymbolConfig): ProportionalSymbolMap
|
|
180
|
+
export function map(type: 'categorical' | 'ct', config?: CategoricalMapConfig): CategoricalMap
|
|
181
|
+
export function map(type: 'bivariateChoropleth' | 'chbi', config?: BivariateChoroplethConfig): BivariateChoroplethMap
|
|
182
|
+
export function map(type: 'trivariateChoropleth' | 'ternary' | 'chtri', config?: TrivariateChoroplethConfig): TrivariateChoroplethMap
|
|
183
|
+
export function map(type: 'alpha' | 'valueByAlpha', config?: ValueByAlphaConfig): ValueByAlphaMap
|
|
184
|
+
export function map(type: 'coxcomb' | 'polar', config?: CoxcombMapConfig): CoxcombMap
|
|
185
|
+
export function map(type: 'bar' | 'barComposition', config?: BarMapConfig): BarMap
|
|
186
|
+
export function map(type: 'stripeComposition' | 'scomp' | 'stripe', config?: StripeMapConfig): StripeMap
|
|
187
|
+
export function map(type: 'waffle', config?: WaffleMapConfig): WaffleMap
|
|
188
|
+
export function map(type: 'mushroom', config?: MushroomMapConfig): MushroomMap
|
|
189
|
+
export function map(type: 'pieChart' | 'pie', config?: PieMapConfig): PieMap
|
|
190
|
+
export function map(type: 'sparkline' | 'spark' | 'sparklines', config?: SparkMapConfig): SparkMap
|
|
191
|
+
export function map(type: 'flow' | 'flowmap', config?: FlowMapConfig): FlowMap
|
|
192
|
+
export function map(type: MapType, config?: MapConfig): MapInstance
|
|
193
|
+
|
|
194
|
+
// ==================== Utility Functions ====================
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get a function that defines fill patterns for legends
|
|
198
|
+
*
|
|
199
|
+
* @param opts - Pattern options
|
|
200
|
+
* @returns Function that creates pattern definitions
|
|
201
|
+
*/
|
|
202
|
+
export function getFillPatternDefinitionFunction(opts?: FillPatternOptions): (svg: any, numberOfClasses: number) => void
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get default labels for the map
|
|
206
|
+
*/
|
|
207
|
+
export function getDefaultLabels(): { [key: string]: string }
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Project coordinates from map pixel space to geographic coordinates
|
|
211
|
+
*
|
|
212
|
+
* @param map - The map object
|
|
213
|
+
* @param x - X pixel coordinate
|
|
214
|
+
* @param y - Y pixel coordinate
|
|
215
|
+
* @returns [longitude, latitude]
|
|
216
|
+
*/
|
|
217
|
+
export function projectFromMap(map: MapInstance, x: number, y: number): [number, number]
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Project geographic coordinates to map pixel space
|
|
221
|
+
*
|
|
222
|
+
* @param map - The map object
|
|
223
|
+
* @param lon - Longitude
|
|
224
|
+
* @param lat - Latitude
|
|
225
|
+
* @returns [x, y] pixel coordinates
|
|
226
|
+
*/
|
|
227
|
+
export function projectToMap(map: MapInstance, lon: number, lat: number): [number, number]
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Library version
|
|
231
|
+
*/
|
|
232
|
+
export const version: string
|
|
233
|
+
|
|
234
|
+
// ==================== Default Export ====================
|
|
235
|
+
|
|
236
|
+
declare const eurostatmap: {
|
|
237
|
+
/** Map. */
|
|
238
|
+
map: typeof map
|
|
239
|
+
/** Get fill pattern definition function. */
|
|
240
|
+
getFillPatternDefinitionFunction: typeof getFillPatternDefinitionFunction
|
|
241
|
+
/** Get fill pattern definition fun. */
|
|
242
|
+
getFillPatternDefinitionFun: typeof getFillPatternDefinitionFun
|
|
243
|
+
/** Get default labels. */
|
|
244
|
+
getDefaultLabels: typeof getDefaultLabels
|
|
245
|
+
/** Project from map. */
|
|
246
|
+
projectFromMap: typeof projectFromMap
|
|
247
|
+
/** Project to map. */
|
|
248
|
+
projectToMap: typeof projectToMap
|
|
249
|
+
/** Version. */
|
|
250
|
+
version: typeof version
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export default eurostatmap
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LegendConfig } from './LegendConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for categorical map legends.
|
|
5
|
+
* Used to display a legend with colored rectangles representing different categories.
|
|
6
|
+
*/
|
|
7
|
+
export interface CategoricalLegendConfig extends LegendConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Custom order for legend elements. If not specified, uses the domain order from the classifier.
|
|
10
|
+
* Provide an array of category codes in the desired display order.
|
|
11
|
+
*/
|
|
12
|
+
order?: string[]
|
|
13
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { LegendConfig } from './LegendConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for size legend in coxcomb (polar area) charts.
|
|
5
|
+
*/
|
|
6
|
+
export interface CoxcombSizeLegendConfig {
|
|
7
|
+
/** Title for the size legend. */
|
|
8
|
+
title?: string | null
|
|
9
|
+
|
|
10
|
+
/** Padding between title and legend content in pixels. @default 15 */
|
|
11
|
+
titlePadding?: number
|
|
12
|
+
|
|
13
|
+
/** Custom values to display in the size legend. If not specified, values are auto-generated. */
|
|
14
|
+
values?: number[] | null
|
|
15
|
+
|
|
16
|
+
/** Custom labels for the size legend values. */
|
|
17
|
+
labels?: string[] | null
|
|
18
|
+
|
|
19
|
+
/** Custom formatter function for legend labels. */
|
|
20
|
+
labelFormatter?: ((value: number) => string) | null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for color legend in coxcomb (polar area) charts.
|
|
25
|
+
*/
|
|
26
|
+
export interface CoxcombColorLegendConfig {
|
|
27
|
+
/** Title for the color legend. */
|
|
28
|
+
title?: string | null
|
|
29
|
+
|
|
30
|
+
/** Padding between title and legend content in pixels. @default 15 */
|
|
31
|
+
titlePadding?: number
|
|
32
|
+
|
|
33
|
+
/** Top margin for the color legend in pixels. @default 23 */
|
|
34
|
+
marginTop?: number
|
|
35
|
+
|
|
36
|
+
/** Offset adjustments for labels. @default { x: 5, y: 5 } */
|
|
37
|
+
labelOffsets?: { x: number; y: number }
|
|
38
|
+
|
|
39
|
+
/** Width of color swatches in pixels. @default 25 */
|
|
40
|
+
shapeWidth?: number
|
|
41
|
+
|
|
42
|
+
/** Height of color swatches in pixels. @default 20 */
|
|
43
|
+
shapeHeight?: number
|
|
44
|
+
|
|
45
|
+
/** Padding between swatches in pixels. @default 1 */
|
|
46
|
+
shapePadding?: number
|
|
47
|
+
|
|
48
|
+
/** Whether to show a "no data" item. @default true */
|
|
49
|
+
noData?: boolean
|
|
50
|
+
|
|
51
|
+
/** Text label for "no data" item. @default 'No data' */
|
|
52
|
+
noDataText?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Configuration for time legend in coxcomb (polar area) charts.
|
|
57
|
+
*/
|
|
58
|
+
export interface CoxcombTimeLegendConfig {
|
|
59
|
+
/** Title for the time legend. */
|
|
60
|
+
title?: string | null
|
|
61
|
+
|
|
62
|
+
/** Padding between title and legend content in pixels. @default 15 */
|
|
63
|
+
titlePadding?: number
|
|
64
|
+
|
|
65
|
+
/** Top margin for the time legend in pixels. @default 20 */
|
|
66
|
+
marginTop?: number
|
|
67
|
+
|
|
68
|
+
/** Radius of the time legend circle in pixels. @default 35 */
|
|
69
|
+
radius?: number
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Configuration for coxcomb (polar area) chart legends.
|
|
74
|
+
* Supports separate sub-legends for size, color, and time dimensions.
|
|
75
|
+
*/
|
|
76
|
+
export interface CoxcombLegendConfig extends LegendConfig {
|
|
77
|
+
/** Configuration for the wedge size legend. */
|
|
78
|
+
sizeLegend?: Partial<CoxcombSizeLegendConfig>
|
|
79
|
+
|
|
80
|
+
/** Configuration for the color/category legend. */
|
|
81
|
+
colorLegend?: Partial<CoxcombColorLegendConfig>
|
|
82
|
+
|
|
83
|
+
/** Configuration for the time period legend. */
|
|
84
|
+
timeLegend?: Partial<CoxcombTimeLegendConfig>
|
|
85
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parent configuration for map legends. Each map type will extend this with its own specific properties, but these are the common ones that apply to all legend types.
|
|
3
|
+
*/
|
|
4
|
+
export interface LegendConfig {
|
|
5
|
+
/** Legend origin x-coordinate in pixels. */
|
|
6
|
+
x?: number
|
|
7
|
+
/** Legend origin y-coordinate in pixels. */
|
|
8
|
+
y?: number
|
|
9
|
+
/** Legend width in pixels. */
|
|
10
|
+
width?: number
|
|
11
|
+
/** Legend height in pixels. */
|
|
12
|
+
height?: number
|
|
13
|
+
|
|
14
|
+
/** Legend title text. */
|
|
15
|
+
title?: string
|
|
16
|
+
/** Legend title font size in pixels. */
|
|
17
|
+
titleFontSize?: number
|
|
18
|
+
|
|
19
|
+
/** Box styling. */
|
|
20
|
+
/** Inner spacing around legend content. */
|
|
21
|
+
boxPadding?: number
|
|
22
|
+
|
|
23
|
+
/** Shape styling (for proportional symbol legends). */
|
|
24
|
+
/** Symbol swatch width in pixels. */
|
|
25
|
+
shapeWidth?: number
|
|
26
|
+
/** Symbol swatch height in pixels. */
|
|
27
|
+
shapeHeight?: number
|
|
28
|
+
/** Horizontal gap between shape and label. */
|
|
29
|
+
shapePadding?: number
|
|
30
|
+
|
|
31
|
+
/** Label styling. */
|
|
32
|
+
/** Label font size in pixels. */
|
|
33
|
+
labelFontSize?: number
|
|
34
|
+
/** Pixel offset applied to labels. */
|
|
35
|
+
labelOffset?: number
|
|
36
|
+
|
|
37
|
+
/** Legend layout direction. */
|
|
38
|
+
orientation?: 'vertical' | 'horizontal'
|
|
39
|
+
/** Sort legend entries in ascending order when true. */
|
|
40
|
+
ascending?: boolean
|
|
41
|
+
|
|
42
|
+
/** Manual legend cell definitions. */
|
|
43
|
+
cells?: any[]
|
|
44
|
+
|
|
45
|
+
/** Whether to display the no-data legend item. */
|
|
46
|
+
noData?: boolean
|
|
47
|
+
/** Label used for no-data legend item. */
|
|
48
|
+
noDataText?: string
|
|
49
|
+
|
|
50
|
+
[key: string]: any
|
|
51
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LegendConfig } from './LegendConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for size legend in mushroom (dual semi-circle) charts.
|
|
5
|
+
*/
|
|
6
|
+
export interface MushroomSizeLegendConfig {
|
|
7
|
+
/** Top margin for the size legend in pixels. @default 15 */
|
|
8
|
+
marginTop?: number
|
|
9
|
+
|
|
10
|
+
/** Custom values to display in the size legend (when using single scale). Raw data values. */
|
|
11
|
+
values?: number[]
|
|
12
|
+
|
|
13
|
+
/** Custom values for variable 1 side (when using independent scales). Raw data values. */
|
|
14
|
+
valuesV1?: number[]
|
|
15
|
+
|
|
16
|
+
/** Custom values for variable 2 side (when using independent scales). Raw data values. */
|
|
17
|
+
valuesV2?: number[]
|
|
18
|
+
|
|
19
|
+
/** Custom labels for the size legend values. */
|
|
20
|
+
labels?: string[] | null
|
|
21
|
+
|
|
22
|
+
/** Custom labels for variable 1 side. */
|
|
23
|
+
labelsV1?: string[] | null
|
|
24
|
+
|
|
25
|
+
/** Custom labels for variable 2 side. */
|
|
26
|
+
labelsV2?: string[] | null
|
|
27
|
+
|
|
28
|
+
/** Vertical spacing between legend items in pixels. @default 2 */
|
|
29
|
+
shapePadding?: number
|
|
30
|
+
|
|
31
|
+
/** Offset adjustments for labels. @default { x: 5, y: 0 } */
|
|
32
|
+
labelOffsets?: { x: number; y: number }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for color legend in mushroom (dual semi-circle) charts.
|
|
37
|
+
*/
|
|
38
|
+
export interface MushroomColorLegendConfig {
|
|
39
|
+
/** Top margin for the color legend in pixels. @default 5 */
|
|
40
|
+
marginTop?: number
|
|
41
|
+
|
|
42
|
+
/** Offset adjustments for labels. @default { x: 5, y: 5 } */
|
|
43
|
+
labelOffsets?: { x: number; y: number }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for mushroom (dual semi-circle) chart legends.
|
|
48
|
+
* Mushroom charts show two variables as semi-circles forming a circle, with size and color dimensions.
|
|
49
|
+
*/
|
|
50
|
+
export interface MushroomLegendConfig extends LegendConfig {
|
|
51
|
+
/** Configuration for the mushroom size legend. */
|
|
52
|
+
sizeLegend?: Partial<MushroomSizeLegendConfig>
|
|
53
|
+
|
|
54
|
+
/** Configuration for the color/category legend. */
|
|
55
|
+
colorLegend?: Partial<MushroomColorLegendConfig>
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LegendConfig } from './LegendConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for pattern fill legends.
|
|
5
|
+
* Used to display a legend showing hatching/pattern options for regions.
|
|
6
|
+
* The pattern fill legend is typically appended below the main choropleth legend.
|
|
7
|
+
*/
|
|
8
|
+
export interface PatternFillLegendConfig extends LegendConfig {
|
|
9
|
+
// Inherits all properties from LegendConfig
|
|
10
|
+
// Pattern fill legends use the base configuration for display
|
|
11
|
+
}
|