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,48 @@
|
|
|
1
|
+
export interface ScalebarConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to show the scalebar.
|
|
4
|
+
* Replaces showScalebar(true/false).
|
|
5
|
+
*/
|
|
6
|
+
show?: boolean
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Scalebar anchor position in SVG pixels: [x, y]
|
|
10
|
+
*/
|
|
11
|
+
position?: [number, number]
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Label suffix, usually " km", but can also be " m", " mi", etc.
|
|
15
|
+
* Note: current implementation still computes values in metres internally.
|
|
16
|
+
*/
|
|
17
|
+
units?: string
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Label offset from the tick position: [x, y]
|
|
21
|
+
*/
|
|
22
|
+
textOffset?: [number, number]
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Maximum width of the scalebar in pixels.
|
|
26
|
+
*/
|
|
27
|
+
maxWidth?: number
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Total height reserved for the scalebar group in pixels.
|
|
31
|
+
*/
|
|
32
|
+
height?: number
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Stroke width used by scalebar lines.
|
|
36
|
+
*/
|
|
37
|
+
strokeWidth?: number
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Height of the horizontal middle segment line.
|
|
41
|
+
*/
|
|
42
|
+
segmentHeight?: number
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Height of the vertical ticks.
|
|
46
|
+
*/
|
|
47
|
+
tickHeight?: number
|
|
48
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a stamp/watermark annotation rendered on the map.
|
|
3
|
+
* @example
|
|
4
|
+
* map.stamp({ x: 230, y: 100, text: 'DRAFT', shape: 'circle', size: 60 })
|
|
5
|
+
*/
|
|
6
|
+
export interface StampConfig {
|
|
7
|
+
/** Text content of the stamp. Use ¶ for forced line breaks, ~ for non-breaking spaces. */
|
|
8
|
+
text: string
|
|
9
|
+
|
|
10
|
+
/** Horizontal centre position in SVG pixels. @default 230 */
|
|
11
|
+
x?: number
|
|
12
|
+
|
|
13
|
+
/** Vertical centre position in SVG pixels. @default 100 */
|
|
14
|
+
y?: number
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shape of the stamp border.
|
|
18
|
+
* @default 'circle'
|
|
19
|
+
*/
|
|
20
|
+
shape?: 'circle' | 'square' | 'rectangle' | 'eu-stars'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Size of the stamp in SVG pixels.
|
|
24
|
+
* For circle/square: diameter. For rectangle: controls text fit height.
|
|
25
|
+
* Ignored when fontSize is set.
|
|
26
|
+
* @default 60
|
|
27
|
+
*/
|
|
28
|
+
size?: number
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Fix the rendered font size in pixels and let the shape grow to contain
|
|
32
|
+
* the text, instead of scaling text to fit a fixed shape size.
|
|
33
|
+
*/
|
|
34
|
+
fontSize?: number
|
|
35
|
+
|
|
36
|
+
/** Text colour. @default '#585858' */
|
|
37
|
+
textColor?: string
|
|
38
|
+
|
|
39
|
+
/** Border/shape colour. @default '#9e9e9e' */
|
|
40
|
+
stampColor?: string
|
|
41
|
+
|
|
42
|
+
/** Border stroke width in pixels. @default 1 */
|
|
43
|
+
strokeWidth?: number
|
|
44
|
+
|
|
45
|
+
/** Line height of the unscaled text element in pixels. @default 15 */
|
|
46
|
+
lineHeight?: number
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Text horizontal alignment.
|
|
50
|
+
* 'middle': stamp is centred on x (default).
|
|
51
|
+
* 'start': stamp's left edge is at x, growing rightward.
|
|
52
|
+
* @default 'middle'
|
|
53
|
+
*/
|
|
54
|
+
textAnchor?: 'middle' | 'start'
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Padding between the text and the shape border in pixels.
|
|
58
|
+
* @default 0 for circle/square/eu-stars, 1 for rectangle
|
|
59
|
+
*/
|
|
60
|
+
padding?: number
|
|
61
|
+
|
|
62
|
+
/** Corner radius for square and rectangle shapes (SVG rx attribute). @default 0 */
|
|
63
|
+
rx?: number
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Size multiplier for individual stars in the 'eu-stars' shape.
|
|
67
|
+
* Does not affect the ring radius.
|
|
68
|
+
* @default 1
|
|
69
|
+
*/
|
|
70
|
+
starSize?: number
|
|
71
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MapInstance } from '../MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adds centroid features to the map for proportional symbol rendering.
|
|
5
|
+
* Centroids are either loaded from pre-computed data or calculated from geometries.
|
|
6
|
+
* @param map - The map instance
|
|
7
|
+
*/
|
|
8
|
+
export function addCentroidsToMap(map: MapInstance): void
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the D3 selection for the proportional symbols (centroids) container.
|
|
12
|
+
* Uses a map-specific ID to avoid collisions with insets.
|
|
13
|
+
* @param map - The map instance
|
|
14
|
+
* @returns D3 selection of the centroids group
|
|
15
|
+
*/
|
|
16
|
+
export function getCentroidsGroup(map: MapInstance): any
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Refreshes the centroids display by filtering to only show regions with statistical data.
|
|
20
|
+
* Removes centroids without data and adds centroids for regions that just received data.
|
|
21
|
+
* @param map - The map instance
|
|
22
|
+
* @returns The map instance for chaining
|
|
23
|
+
*/
|
|
24
|
+
export function refreshCentroids(map: MapInstance): MapInstance
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a region has statistical data attached.
|
|
28
|
+
* Used to filter which centroids should be displayed.
|
|
29
|
+
* @param id - The region ID
|
|
30
|
+
* @param map - The map instance
|
|
31
|
+
* @returns True if the region has statistical data
|
|
32
|
+
*/
|
|
33
|
+
export function centroidHasStatData(id: string, map: MapInstance): boolean
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { MapInstance } from '../MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Geometries class for managing geographic data loading and rendering.
|
|
5
|
+
* Handles NUTS regions, country boundaries, centroids, and custom geometries.
|
|
6
|
+
*/
|
|
7
|
+
export interface GeometriesClass {
|
|
8
|
+
/** Default geographic data (NUTS regions, countries, etc.) */
|
|
9
|
+
defaultGeoData: any
|
|
10
|
+
/** All NUTS level data (for mixed level maps) */
|
|
11
|
+
allNUTSGeoData: any
|
|
12
|
+
/** Centroid point data */
|
|
13
|
+
centroidsData: any
|
|
14
|
+
/** Processed GeoJSON features organized by type */
|
|
15
|
+
geoJSONs: {
|
|
16
|
+
/** Nutsrg. */
|
|
17
|
+
nutsrg?: any[]
|
|
18
|
+
/** Nutsbn. */
|
|
19
|
+
nutsbn?: any[]
|
|
20
|
+
/** Cntrg. */
|
|
21
|
+
cntrg?: any[]
|
|
22
|
+
/** Cntbn. */
|
|
23
|
+
cntbn?: any[]
|
|
24
|
+
/** Worldrg. */
|
|
25
|
+
worldrg?: any[]
|
|
26
|
+
/** Graticule. */
|
|
27
|
+
graticule?: any[]
|
|
28
|
+
/** Mixed. */
|
|
29
|
+
mixed?: any
|
|
30
|
+
}
|
|
31
|
+
/** User-provided custom geometries */
|
|
32
|
+
userGeometries: boolean
|
|
33
|
+
/** Centroid features with projected coordinates */
|
|
34
|
+
centroidsFeatures: any[]
|
|
35
|
+
/** Master copy of all centroid features before filtering */
|
|
36
|
+
_allCentroidsFeatures: any[]
|
|
37
|
+
|
|
38
|
+
/** Fetches default geographic data from NUTS2JSON */
|
|
39
|
+
getDefaultGeoData(geo: string, filterFunction: any, nutsLevel: number | string): Promise<void>
|
|
40
|
+
/** Sets user-defined custom geometries */
|
|
41
|
+
setUserGeometries(geometries: any[]): void
|
|
42
|
+
/** Adds default NUTS geometries to the map */
|
|
43
|
+
addDefaultGeometriesToMap(
|
|
44
|
+
/** Zoom group. */
|
|
45
|
+
zoomGroup: any,
|
|
46
|
+
/** Draw graticule. */
|
|
47
|
+
drawGraticule: boolean,
|
|
48
|
+
/** Path function. */
|
|
49
|
+
pathFunction: any,
|
|
50
|
+
/** Nuts level. */
|
|
51
|
+
nutsLevel: number | string,
|
|
52
|
+
/** Nuts year. */
|
|
53
|
+
nutsYear: number,
|
|
54
|
+
/** Geo. */
|
|
55
|
+
geo: string,
|
|
56
|
+
/** Proj. */
|
|
57
|
+
proj: string,
|
|
58
|
+
/** Scale. */
|
|
59
|
+
scale: string
|
|
60
|
+
): void
|
|
61
|
+
/** Adds user-defined geometries to the map */
|
|
62
|
+
addUserGeometriesToMap(geometries: any[], zoomGroup: any, pathFunction: any): void
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Factory function that creates a Geometries instance for a map.
|
|
67
|
+
* @param map - The map instance
|
|
68
|
+
* @param withCenterPoints - Whether to load centroid data
|
|
69
|
+
* @returns Geometries instance
|
|
70
|
+
*/
|
|
71
|
+
export function Geometries(map: MapInstance, withCenterPoints: boolean): GeometriesClass
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kosovo boundary features for different NUTS years.
|
|
3
|
+
* Used to add Kosovo boundaries to maps since they are not included in standard NUTS datasets.
|
|
4
|
+
*/
|
|
5
|
+
export const kosovoBnFeatures: {
|
|
6
|
+
[year: number]: {
|
|
7
|
+
/** Type. */
|
|
8
|
+
type: 'FeatureCollection'
|
|
9
|
+
/** Features. */
|
|
10
|
+
features: any[]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { MapInstance } from '../MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Initializes proj4 with common projection definitions.
|
|
5
|
+
* Loads EPSG definitions for dynamic minimap projections and placename labels.
|
|
6
|
+
*/
|
|
7
|
+
export function initProj4(): void
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Projects geographic coordinates (lon, lat) to map coordinates (x, y)
|
|
11
|
+
* based on the map's projection.
|
|
12
|
+
* @param map - The map instance
|
|
13
|
+
* @param lon - Longitude in degrees
|
|
14
|
+
* @param lat - Latitude in degrees
|
|
15
|
+
* @returns Projected coordinates [x, y] or null if projection fails
|
|
16
|
+
*/
|
|
17
|
+
export function projectToMap(map: MapInstance, lon: number, lat: number): [number, number] | null
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Inverse projects map coordinates (x, y) to geographic coordinates (lon, lat).
|
|
21
|
+
* @param map - The map instance
|
|
22
|
+
* @param x - X coordinate in the map's projection
|
|
23
|
+
* @param y - Y coordinate in the map's projection
|
|
24
|
+
* @returns Geographic coordinates [lon, lat] or null if projection fails
|
|
25
|
+
*/
|
|
26
|
+
export function projectFromMap(map: MapInstance, x: number, y: number): [number, number] | null
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MapInstance } from '../MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Defines the D3 projection for the map based on geographic context.
|
|
5
|
+
* Sets up Robinson projection for world maps or identity projection for regional maps.
|
|
6
|
+
* @param map - The map instance
|
|
7
|
+
*/
|
|
8
|
+
export function defineProjection(map: MapInstance): void
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Defines the D3 path function using the map's projection.
|
|
12
|
+
* Used to render geographic features as SVG paths.
|
|
13
|
+
* @param map - The map instance
|
|
14
|
+
*/
|
|
15
|
+
export function definePathFunction(map: MapInstance): void
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Sets the default position (center coordinates and zoom level) for the map
|
|
19
|
+
* based on the geographic area and projection.
|
|
20
|
+
* @param map - The map instance
|
|
21
|
+
*/
|
|
22
|
+
export function defineDefaultPosition(map: MapInstance): void
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Gets the default zoom level (z value) for a given map configuration.
|
|
26
|
+
* @param map - The map instance
|
|
27
|
+
* @returns The default z value (pixel size in map units)
|
|
28
|
+
*/
|
|
29
|
+
export function getDefaultZ(map: MapInstance): number
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builds inset maps based on the configuration in the map instance.
|
|
5
|
+
* Creates sub-maps for specific geographic regions (e.g., islands, overseas territories).
|
|
6
|
+
* @param map - The map instance
|
|
7
|
+
* @param withCenterPoints - Whether to include region centroids
|
|
8
|
+
* @param mapType - The type of map (e.g., 'choropleth', 'proportional-symbol')
|
|
9
|
+
*/
|
|
10
|
+
export function buildInsets(map: MapInstance, withCenterPoints: boolean, mapType: string): void
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Removes all existing insets from a map instance.
|
|
14
|
+
* @param map - The map instance
|
|
15
|
+
*/
|
|
16
|
+
export function removeInsets(map: MapInstance): void
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates or retrieves the main SVG element for a map.
|
|
5
|
+
* @param map - The map instance
|
|
6
|
+
* @returns The D3 selection of the SVG element
|
|
7
|
+
*/
|
|
8
|
+
export function createMapSVG(map: MapInstance): any
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps the map SVG in a container div to enable HTML overlays
|
|
12
|
+
* (spinner, tooltip) to sit above the SVG.
|
|
13
|
+
* @param svg - The D3 selection of the SVG element
|
|
14
|
+
* @returns The wrapper element
|
|
15
|
+
*/
|
|
16
|
+
export function wrapMapSvg(svg: any): HTMLElement
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Recalculates and applies the layout for header, drawing area, and footer.
|
|
20
|
+
* Adjusts clip paths and positioning based on content.
|
|
21
|
+
* @param map - The map instance
|
|
22
|
+
*/
|
|
23
|
+
export function recalculateLayout(map: MapInstance): void
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Available location marker shapes
|
|
5
|
+
*/
|
|
6
|
+
export const LOCATION_SHAPES: {
|
|
7
|
+
CIRCLE: 'circle'
|
|
8
|
+
SQUARE: 'square'
|
|
9
|
+
DIAMOND: 'diamond'
|
|
10
|
+
TRIANGLE: 'triangle'
|
|
11
|
+
STAR: 'star'
|
|
12
|
+
CROSS: 'cross'
|
|
13
|
+
PLUS: 'plus'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for a single location marker
|
|
18
|
+
*/
|
|
19
|
+
export interface LocationConfig {
|
|
20
|
+
/** Unique identifier for the location */
|
|
21
|
+
id?: string
|
|
22
|
+
/** Longitude coordinate */
|
|
23
|
+
lon: number
|
|
24
|
+
/** Latitude coordinate */
|
|
25
|
+
lat: number
|
|
26
|
+
/** Label text to display */
|
|
27
|
+
label?: string
|
|
28
|
+
/** 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
|
|
34
|
+
/** Stroke color. @default '#fff' */
|
|
35
|
+
stroke?: string
|
|
36
|
+
/** Stroke width in pixels. @default 1 */
|
|
37
|
+
strokeWidth?: number
|
|
38
|
+
/** Custom CSS class */
|
|
39
|
+
class?: string
|
|
40
|
+
/** Custom data attached to the location */
|
|
41
|
+
data?: any
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Updates and redraws location markers on the map.
|
|
46
|
+
* @param map - The map instance
|
|
47
|
+
*/
|
|
48
|
+
export function updateLocations(map: MapInstance): void
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Attaches the locations API methods to a map instance.
|
|
52
|
+
* Adds methods like addLocation(), removeLocation(), etc.
|
|
53
|
+
* @param map - The map instance
|
|
54
|
+
*/
|
|
55
|
+
export function attachLocationsApi(map: MapInstance): void
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MapInstance } from './MapInstance'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the minimap globe feature.
|
|
5
|
+
*/
|
|
6
|
+
export interface MinimapConfig {
|
|
7
|
+
/** Size of the minimap in pixels. @default 150 */
|
|
8
|
+
size?: number
|
|
9
|
+
/** Debounce delay in milliseconds for updating the minimap during zoom/pan. @default 3 */
|
|
10
|
+
debounce?: number
|
|
11
|
+
/** Position [x, y] in pixels. If not specified, positioned in top-left corner */
|
|
12
|
+
position?: [number, number]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Appends a minimap (globe visualization) to the map.
|
|
17
|
+
* Shows the current map viewport on a world globe.
|
|
18
|
+
* @param map - The map instance
|
|
19
|
+
*/
|
|
20
|
+
export function appendMinimap(map: MapInstance): void
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a square root scale for proportional symbol sizing.
|
|
3
|
+
* Good for area-based symbols like circles where visual size should be
|
|
4
|
+
* proportional to the square root of the data value.
|
|
5
|
+
* @param rawData - Array of numeric values to scale
|
|
6
|
+
* @param maxSize - Maximum output size in pixels. @default 20
|
|
7
|
+
* @param minSize - Minimum output size in pixels. @default 0
|
|
8
|
+
* @returns D3 scale function
|
|
9
|
+
*/
|
|
10
|
+
export function createSqrtScale(rawData?: number[], maxSize?: number, minSize?: number): any
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a radial scale for circular symbol sizing.
|
|
14
|
+
* Maps data values directly to radii.
|
|
15
|
+
* @param rawData - Array of numeric values to scale
|
|
16
|
+
* @param maxSize - Maximum output radius in pixels. @default 20
|
|
17
|
+
* @param minSize - Minimum output radius in pixels. @default 0
|
|
18
|
+
* @returns D3 scale function
|
|
19
|
+
*/
|
|
20
|
+
export function createRadialScale(rawData?: number[], maxSize?: number, minSize?: number): any
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a linear scale for proportional symbol sizing.
|
|
24
|
+
* Maps data values linearly to visual sizes.
|
|
25
|
+
* @param rawData - Array of numeric values to scale
|
|
26
|
+
* @param maxSize - Maximum output size in pixels. @default 20
|
|
27
|
+
* @param minSize - Minimum output size in pixels. @default 0
|
|
28
|
+
* @returns D3 scale function
|
|
29
|
+
*/
|
|
30
|
+
export function createLinearScale(rawData?: number[], maxSize?: number, minSize?: number): any
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a statistical data source.
|
|
3
|
+
* Pass this to map.stat() or as the config argument to statData().
|
|
4
|
+
*/
|
|
5
|
+
export interface StatConfig {
|
|
6
|
+
/** Eurostat dataset code. e.g. 'demo_r_d3dens' */
|
|
7
|
+
eurostatDatasetCode?: string
|
|
8
|
+
/**
|
|
9
|
+
* Filters for the Eurostat API query.
|
|
10
|
+
* @example { TIME: '2024', UNIT: 'EUR_HAB' }
|
|
11
|
+
*/
|
|
12
|
+
filters?: Record<string, string>
|
|
13
|
+
/** Number of decimal places for Eurostat API data. @default 2 */
|
|
14
|
+
precision?: number
|
|
15
|
+
/** URL of a CSV file to use as the data source. */
|
|
16
|
+
csvURL?: string
|
|
17
|
+
/** CSV column containing NUTS region IDs. @default 'geo' */
|
|
18
|
+
geoCol?: string
|
|
19
|
+
/** CSV column containing statistical values. @default 'value' */
|
|
20
|
+
valueCol?: string
|
|
21
|
+
/** Unit of measure label shown in tooltips. e.g. 'people/km²' */
|
|
22
|
+
unitText?: string
|
|
23
|
+
/** Optional transform function applied to raw values after data loads. e.g. v => v * 1000 */
|
|
24
|
+
transform?: (value: number) => number
|
|
25
|
+
/** Dataset label/name from the Eurostat API response. */
|
|
26
|
+
label?: string
|
|
27
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { StatConfig } from './StatConfig'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A statistical dataset indexed by NUTS region ID.
|
|
5
|
+
* Returned by map.statData() and created internally by statData().
|
|
6
|
+
*/
|
|
7
|
+
export interface StatData {
|
|
8
|
+
/**
|
|
9
|
+
* Returns the stat entry {value, status} for a given NUTS ID.
|
|
10
|
+
* If called with no argument, returns the entire data index.
|
|
11
|
+
* @example map.statData().get('DE') // → { value: 120, status: 'e' }
|
|
12
|
+
*/
|
|
13
|
+
get(nutsId?: string): { value: any; status?: string } | Record<string, { value: any; status?: string }> | undefined
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns the raw value for a given NUTS ID.
|
|
17
|
+
* @example map.statData().getValue('DE') // → 120
|
|
18
|
+
*/
|
|
19
|
+
getValue(nutsId: string): any
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sets a stat value for a given NUTS ID.
|
|
23
|
+
* @param nutsId - The NUTS region ID.
|
|
24
|
+
* @param stat - Either a value directly or an object { value, status }.
|
|
25
|
+
* @example map.statData().set('DE', 120)
|
|
26
|
+
* @example map.statData().set('DE', { value: 120, status: 'e' })
|
|
27
|
+
*/
|
|
28
|
+
set(nutsId: string, stat: any): this
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Sets the entire dataset at once, indexed by NUTS ID.
|
|
32
|
+
* Overwrites any previously loaded data.
|
|
33
|
+
* @example
|
|
34
|
+
* map.statData().setData({ DE: 120, FR: 95, IT: 88 })
|
|
35
|
+
* // or with status:
|
|
36
|
+
* map.statData().setData({ DE: { value: 120, status: 'e' }, FR: 95 })
|
|
37
|
+
*/
|
|
38
|
+
setData(data: Record<string, number | string | { value: any; status?: string }>): this
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Sets multi-date data for sparkline maps.
|
|
42
|
+
* @example
|
|
43
|
+
* map.statData().setManualMultiDate({ DE: { '2020': 100, '2021': 110 } })
|
|
44
|
+
*/
|
|
45
|
+
setManualMultiDate(data: Record<string, Record<string, number>>): this
|
|
46
|
+
|
|
47
|
+
/** Returns true if data has been loaded. */
|
|
48
|
+
hasData(): boolean
|
|
49
|
+
|
|
50
|
+
/** Returns true if the loaded data contains at least one finite numeric value. */
|
|
51
|
+
hasNumericData(): boolean
|
|
52
|
+
|
|
53
|
+
/** Returns all stat values as a flat array, for use in classification. */
|
|
54
|
+
getArray(): any[]
|
|
55
|
+
|
|
56
|
+
/** Returns all unique stat values, for use in categorical maps. */
|
|
57
|
+
getUniqueValues(): any[]
|
|
58
|
+
|
|
59
|
+
/** Returns the minimum numeric value in the dataset. */
|
|
60
|
+
getMin(): number | undefined
|
|
61
|
+
|
|
62
|
+
/** Returns the maximum numeric value in the dataset. */
|
|
63
|
+
getMax(): number | undefined
|
|
64
|
+
|
|
65
|
+
/** Returns the NUTS ID of the region with the highest value. */
|
|
66
|
+
getMaxRegionId(): string | undefined
|
|
67
|
+
|
|
68
|
+
/** Returns the NUTS ID of the region with the lowest value. */
|
|
69
|
+
getMinRegionId(): string | undefined
|
|
70
|
+
|
|
71
|
+
/** Returns true if the data is ready to be used for rendering. */
|
|
72
|
+
isReady(): boolean
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the time stamp of the loaded Eurostat dataset.
|
|
76
|
+
* Reflects the 'time' filter if set, otherwise the first time dimension in the API response.
|
|
77
|
+
*/
|
|
78
|
+
getTime(): string | undefined
|
|
79
|
+
|
|
80
|
+
/** Unit of measure label shown in tooltips. e.g. 'people/km²' */
|
|
81
|
+
unitText(): string | undefined
|
|
82
|
+
unitText(text: string): this
|
|
83
|
+
|
|
84
|
+
/** Metadata from the Eurostat API response or CSV source. */
|
|
85
|
+
metadata?: {
|
|
86
|
+
/** Label. */
|
|
87
|
+
label?: string
|
|
88
|
+
/** Href. */
|
|
89
|
+
href?: string
|
|
90
|
+
/** Source. */
|
|
91
|
+
source?: string
|
|
92
|
+
/** Updated. */
|
|
93
|
+
updated?: string
|
|
94
|
+
/** Time. */
|
|
95
|
+
time?: string
|
|
96
|
+
/** Extension. */
|
|
97
|
+
extension?: any
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Eurostat dataset code. */
|
|
101
|
+
eurostatDatasetCode_?: string
|
|
102
|
+
/** CSV source URL. */
|
|
103
|
+
csvURL_?: string
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Fetches data from the configured remote source (Eurostat API or CSV).
|
|
107
|
+
* Called internally by the map build pipeline.
|
|
108
|
+
* @param nutsLevel - NUTS level (0–3).
|
|
109
|
+
* @param lang - BCP 47 language code. e.g. 'en'
|
|
110
|
+
* @param callback - Called when data is ready.
|
|
111
|
+
*/
|
|
112
|
+
retrieveFromRemote(nutsLevel: number, lang: string, callback: () => void): this
|
|
113
|
+
}
|