def legend_toggle_callback():
    """JS callback for legend toggle Dropdown menu

    Returns
    -------
    code : :obj:`str`
    """
    code = """
                //Show only the legend for the first item
                if (cb_obj.active.includes(0)){
                        legs[0].visible = true;
                }

                else{
                        legs[0].visible = false;
                }

           """
    return code
