This is the documentation of version 0.64.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:

    • Hidden by default - set visible: true to show it
    • Requires fetching availability via getPlacesWithEVAvailability
    • Each PlacesModule can enable/disable independently

    When visible, 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.create(map, {
    evAvailability: { visible: true }
    });
    const stations = await discoverPlaces({ filters: { poiCategories: ['CHARGING_LOCATION'] } });
    places.show(await getPlacesWithEVAvailability(stations));

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

    // Combine with custom icon
    const places = await PlacesModule.create(map, {
    icon: {
    categoryIcons: [{
    id: 'CHARGING_LOCATION',
    image: customEvIconSvg,
    pixelRatio: 2
    }]
    },
    evAvailability: { visible: true }
    });
    type EVAvailabilityConfig = {
        formatText?: (available: number, total: number) => string;
        threshold?: number;
        visible?: boolean;
    }
    Index
    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.3
    
    visible?: boolean

    Shows the availability on EV charging station pins.

    Must be explicitly set to true to display availability.