`legend_groupclick = "toggleitem"` doesn't seem to work in PlotlyJS

Currently legend_groupclick="toggleitem" doesn’t seem to work as can be tested in the result of

using PlotlyJS

function getData()
    x = range(start=0, stop=10, length=101)
    y1 = sin.(x)
    y2 = sin.(x) .- 0.1
    y3 = cos.(x)
    y4 = cos.(x) .- 0.1

    trace1 = scatter(x=x, y=y1, legendgroup="sin", legendgrouptitle_text="sin")
    trace2 = scatter(x=x, y=y2, legendgroup="sin", legendgrouptitle_text="sin")
    trace3 = scatter(x=x, y=y3, legendgroup="cos", legendgrouptitle_text="cos")
    trace4 = scatter(x=x, y=y4, legendgroup="cos", legendgrouptitle_text="cos")

    return [trace1, trace2, trace3, trace4]
end
data = getData()

layout = Layout(legend_groupclick="toggleitem")

fig = Plot(data, layout)

@assert fig.layout.fields[:legend][:groupclick] == "toggleitem"

open("plotly_julia.html", "w") do io
    PlotlyBase.to_html(io, fig)
end

Am I doing something wrong here? If not, is this a Julia issue and I can file an issue at that repository or is this because the same bug exists in the JavaScript library as can be seen in the filed issue?


In Python there also was this bug, but it was fixed as can be seen at

And here the same code as above in python to prove that it works

import numpy as np
import plotly.graph_objects as go


x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)

fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y1 - 0.0, legendgroup='sin', legendgrouptitle_text='sin'))
fig.add_trace(go.Scatter(x=x, y=y1 - 0.1, legendgroup='sin', legendgrouptitle_text='sin'))
fig.add_trace(go.Scatter(x=x, y=y2 - 0.0, legendgroup='cos', legendgrouptitle_text='cos'))
fig.add_trace(go.Scatter(x=x, y=y2 - 0.1, legendgroup='cos', legendgrouptitle_text='cos'))

fig.update_layout(legend_groupclick='toggleitem')

fig.write_html('plotly_python.html')

Maybe also related

For the record. The issue seems to be that the requested feature was introduced in Plotly.js v2.4.1, but PlotlyBase.jl currently refers to v2.3.0.