from typing import Iterable


def create_visualmap_pieces(groups: Iterable[str]) -> list[dict]:
    """Return tooltip formatter code.

    Parameters
    ----------
    groups : iterable of str
        Groups.

    Returns
    -------
    list of dict

    Examples
    --------
    >>> create_visualmap_pieces(['travel', 'live'])
    [{'value': 0, 'label': 'travel'}, {'value': 1, 'label': 'live'}]
    """
    return [{
        'value': index, 'label': group
    } for (index, group) in enumerate(groups)]