eurostat-map 4.3.58 → 4.4.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 +14318 -17933
- 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/InsetConfig.d.ts +15 -0
- package/build/types/core/MapConfig.d.ts +85 -0
- package/build/types/core/MapInstance.d.ts +354 -0
- package/build/types/core/MinimapConfig.d.ts +11 -0
- package/build/types/core/TooltipConfig.d.ts +13 -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 +56 -0
- package/build/types/core/geo/kosovo.d.ts +10 -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 +107 -0
- package/build/types/core/utils.d.ts +194 -0
- package/build/types/core/zoom.d.ts +21 -0
- package/build/types/index.d.ts +237 -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 +43 -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 +68 -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/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 +15 -0
- package/build/types/map-types/choropleth/BivariateChoroplethMap.d.ts +39 -0
- package/build/types/map-types/choropleth/ChoroplethConfig.d.ts +29 -0
- package/build/types/map-types/choropleth/ChoroplethMap.d.ts +48 -0
- package/build/types/map-types/choropleth/TrivariateChoroplethConfig.d.ts +18 -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 +21 -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 +78 -0
- package/build/types/map-types/composition/bar/BarMapConfig.d.ts +30 -0
- package/build/types/map-types/composition/composition-map.d.ts +25 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +42 -0
- package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +18 -0
- package/build/types/map-types/composition/coxcomb/CoxcombStatConfig.d.ts +14 -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 +62 -0
- package/build/types/map-types/composition/pie/PieMapConfig.d.ts +24 -0
- package/build/types/map-types/composition/stripe/StripeMap.d.ts +43 -0
- package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +16 -0
- package/build/types/map-types/composition/waffle/WaffleMap.d.ts +71 -0
- package/build/types/map-types/composition/waffle/WaffleMapConfig.d.ts +25 -0
- package/build/types/map-types/flow/FlowMap.d.ts +97 -0
- package/build/types/map-types/flow/FlowMapConfig.d.ts +103 -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 +24 -0
- package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +99 -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 +15 -0
- package/build/types/map-types/spark/SparkMap.d.ts +48 -0
- package/build/types/map-types/spark/SparkMapConfig.d.ts +25 -0
- package/build/types/map-types/spark/SparkStatConfig.d.ts +10 -0
- package/build/types/utils/FillPatternOptions.d.ts +17 -0
- package/package.json +8 -5
|
@@ -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,56 @@
|
|
|
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?: any[]
|
|
17
|
+
nutsbn?: any[]
|
|
18
|
+
cntrg?: any[]
|
|
19
|
+
cntbn?: any[]
|
|
20
|
+
worldrg?: any[]
|
|
21
|
+
graticule?: any[]
|
|
22
|
+
mixed?: any
|
|
23
|
+
}
|
|
24
|
+
/** User-provided custom geometries */
|
|
25
|
+
userGeometries: boolean
|
|
26
|
+
/** Centroid features with projected coordinates */
|
|
27
|
+
centroidsFeatures: any[]
|
|
28
|
+
/** Master copy of all centroid features before filtering */
|
|
29
|
+
_allCentroidsFeatures: any[]
|
|
30
|
+
|
|
31
|
+
/** Fetches default geographic data from NUTS2JSON */
|
|
32
|
+
getDefaultGeoData(geo: string, filterFunction: any, nutsLevel: number | string): Promise<void>
|
|
33
|
+
/** Sets user-defined custom geometries */
|
|
34
|
+
setUserGeometries(geometries: any[]): void
|
|
35
|
+
/** Adds default NUTS geometries to the map */
|
|
36
|
+
addDefaultGeometriesToMap(
|
|
37
|
+
zoomGroup: any,
|
|
38
|
+
drawGraticule: boolean,
|
|
39
|
+
pathFunction: any,
|
|
40
|
+
nutsLevel: number | string,
|
|
41
|
+
nutsYear: number,
|
|
42
|
+
geo: string,
|
|
43
|
+
proj: string,
|
|
44
|
+
scale: string
|
|
45
|
+
): void
|
|
46
|
+
/** Adds user-defined geometries to the map */
|
|
47
|
+
addUserGeometriesToMap(geometries: any[], zoomGroup: any, pathFunction: any): void
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Factory function that creates a Geometries instance for a map.
|
|
52
|
+
* @param map - The map instance
|
|
53
|
+
* @param withCenterPoints - Whether to load centroid data
|
|
54
|
+
* @returns Geometries instance
|
|
55
|
+
*/
|
|
56
|
+
export function Geometries(map: MapInstance, withCenterPoints: boolean): GeometriesClass
|
|
@@ -0,0 +1,10 @@
|
|
|
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: 'FeatureCollection'
|
|
8
|
+
features: any[]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -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,107 @@
|
|
|
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?: string
|
|
87
|
+
href?: string
|
|
88
|
+
source?: string
|
|
89
|
+
updated?: string
|
|
90
|
+
time?: string
|
|
91
|
+
extension?: any
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Eurostat dataset code. */
|
|
95
|
+
eurostatDatasetCode_?: string
|
|
96
|
+
/** CSV source URL. */
|
|
97
|
+
csvURL_?: string
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Fetches data from the configured remote source (Eurostat API or CSV).
|
|
101
|
+
* Called internally by the map build pipeline.
|
|
102
|
+
* @param nutsLevel - NUTS level (0–3).
|
|
103
|
+
* @param lang - BCP 47 language code. e.g. 'en'
|
|
104
|
+
* @param callback - Called when data is ready.
|
|
105
|
+
*/
|
|
106
|
+
retrieveFromRemote(nutsLevel: number, lang: string, callback: () => void): this
|
|
107
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
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: any,
|
|
105
|
+
mainSvgId: string,
|
|
106
|
+
functionToExecute: (inset: MapInstance, ...args: any[]) => void,
|
|
107
|
+
parameter?: any,
|
|
108
|
+
parameter2?: any
|
|
109
|
+
): void
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Converts first letter of a string to uppercase.
|
|
113
|
+
*/
|
|
114
|
+
export function upperCaseFirstLetter(string: string): string
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Converts a string to lowercase except for first letters of words.
|
|
118
|
+
*/
|
|
119
|
+
export function lowerCaseAllWordsExceptFirstLetters(string: string): string
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Creates a download URL for an SVG element.
|
|
123
|
+
*/
|
|
124
|
+
export function getDownloadURL(svgNode: SVGElement): string
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Serializes an SVG element to a string.
|
|
128
|
+
*/
|
|
129
|
+
export function serialize(svg: SVGElement): string
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Rasterizes an SVG element to a canvas blob.
|
|
133
|
+
*/
|
|
134
|
+
export function rasterize(svg: SVGElement): Promise<Blob>
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Converts hex color to RGB object.
|
|
138
|
+
*/
|
|
139
|
+
export function hexToRgb(hex: string): { r: number; g: number; b: number }
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Blends multiple colors using multiply blending mode.
|
|
143
|
+
*/
|
|
144
|
+
export function multiplyBlendMultipleHex(colors: string[]): string
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Blends colors using average blending.
|
|
148
|
+
*/
|
|
149
|
+
export function averageBlendHex(colors: string[]): string
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Interpolates color intensity.
|
|
153
|
+
*/
|
|
154
|
+
export function interpolateIntensity(baseColor: string, idx: number): string
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Converts rectangle coordinates to an SVG path string.
|
|
158
|
+
*/
|
|
159
|
+
export function convertRectanglesToPaths(x: number, y: number, width: number, height: number): string
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Determines appropriate text color (black/white) for a given background color.
|
|
163
|
+
*/
|
|
164
|
+
export function getTextColorForBackground(backgroundColor: string): string
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Gets the CSS selector for data-driven regions on a map.
|
|
168
|
+
*/
|
|
169
|
+
export function getRegionsSelector(map: MapInstance): string
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Gets the CSS selector for legend region highlighting.
|
|
173
|
+
*/
|
|
174
|
+
export function getLegendRegionsSelector(map: MapInstance): string
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Gets an approximate geographic bounding box for the current map view.
|
|
178
|
+
*/
|
|
179
|
+
export function getApproxCurrentGeoBbox(map: MapInstance): number[]
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Gets a region element by ID from the map.
|
|
183
|
+
*/
|
|
184
|
+
export function getRegionById(map: MapInstance, id: string): any
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Compact number formatter (e.g., 1000 → "1K").
|
|
188
|
+
*/
|
|
189
|
+
export const compactFormatter: Intl.NumberFormat
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Long number formatter.
|
|
193
|
+
*/
|
|
194
|
+
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
|