eurostat-map
    Preparing search index...

    Interface LabelsConfig

    Configuration for map labels (country names, statistical values, etc.)

    interface LabelsConfig {
        labels?: Label[];
        values?: boolean;
        halos?: boolean;
        shadows?: boolean;
        backgrounds?: boolean;
        backgroundFill?: string;
        scaleOnZoom?: boolean;
        valuesFormatter?: (value: number) => string;
        statLabelsFilterFunction?: (region: any, map: any) => boolean;
        statLabelsPositions?: Record<string, { x: number; y: number }>;
        processValueLabelCentroids?: (
            region: any,
            centroid: [number, number],
        ) => [number, number];
    }
    Index

    Properties

    labels?: Label[]

    Array of label objects with text and coordinates. Use eurostatmap.getDefaultLabels() to get predefined geographic labels.

    values?: boolean

    Show statistical values as labels on regions.

    false
    
    halos?: boolean

    Apply halo/shadow effect around labels for better readability.

    false
    
    shadows?: boolean

    Legacy alias for halos.

    Use halos instead

    backgrounds?: boolean

    Apply solid background rectangles behind labels. Takes precedence over halos when both are set.

    false
    
    backgroundFill?: string

    Fill color for label background rectangles (CSS color string). Only applies when backgrounds is true.

    '#ffffff'
    
    'white'
    
    '#B19122'
    
    'rgba(255, 255, 255, 0.9)'
    
    scaleOnZoom?: boolean

    Scale labels when zooming in/out.

    true
    
    valuesFormatter?: (value: number) => string

    Custom formatter function for statistical value labels.

    (value) => value.toFixed(1) + '%'
    
    statLabelsFilterFunction?: (region: any, map: any) => boolean

    Filter function to show/hide statistical value labels for specific regions.

    Type Declaration

      • (region: any, map: any): boolean
      • Parameters

        • region: any

          GeoJSON feature object

        • map: any

          Map instance

        Returns boolean

        true to show label, false to hide

    statLabelsPositions?: Record<string, { x: number; y: number }>

    Override default centroid positions for statistical value labels. Keys are region IDs (e.g., 'DE', 'FR01'), values are {x, y} coordinates.

    processValueLabelCentroids?: (
        region: any,
        centroid: [number, number],
    ) => [number, number]

    Function to adjust calculated centroids for value labels.

    Type Declaration

      • (region: any, centroid: [number, number]): [number, number]
      • Parameters

        • region: any

          GeoJSON feature object

        • centroid: [number, number]

          Calculated centroid [x, y]

        Returns [number, number]

        Adjusted centroid [x, y]

    (region, centroid) => [centroid[0] + 10, centroid[1] - 10]