This is the documentation of version 0.50.0. Go to the latest version, 1.0.0.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias EVAvailabilityConfig

    Configuration for EV charging station availability display.

    Opt-In Feature:

    • Disabled by default - set enabled: true to activate
    • Requires fetching availability via getPlacesWithEVAvailability
    • Each PlacesModule can enable/disable independently

    When enabled, displays formatted availability text (e.g., "3/10") below the station name with color-coding based on availability ratio: green (high), orange (limited), red (none/low).

    // Enable with defaults
    const places = await PlacesModule.get(map, {
    evAvailability: { enabled: true }
    });
    const stations = await search({ poiCategories: ['ELECTRIC_VEHICLE_STATION'] });
    places.show(await getPlacesWithEVAvailability(stations));

    // Custom threshold and format
    const places = await PlacesModule.get(map, {
    evAvailability: {
    enabled: true,
    threshold: 0.5,
    formatText: (available, total) => `${available} of ${total}`
    }
    });

    // Combine with custom icon
    const places = await PlacesModule.get(map, {
    icon: {
    categoryIcons: [{
    id: 'ELECTRIC_VEHICLE_STATION',
    image: customEvIconSvg,
    pixelRatio: 2
    }]
    },
    evAvailability: { enabled: true }
    });
    type EVAvailabilityConfig = {
        enabled?: boolean;
        formatText?: (available: number, total: number) => string;
        threshold?: number;
    }
    Index

    Properties

    enabled?: boolean

    Enable or disable EV availability display.

    Must be explicitly set to true to display availability.

    formatText?: (available: number, total: number) => string

    Custom function to format the availability text.

    Type Declaration

      • (available: number, total: number): string
      • Parameters

        • available: number

          Number of available charging points

        • total: number

          Total number of charging points

        Returns string

        Formatted availability text

    (available, total) => ${available}/${total}

    threshold?: number

    Availability ratio threshold for determining available vs occupied.

    • ratio >= threshold: Available (green)
    • ratio < threshold: Occupied (red)
    0