I have charts on x1 and x2 that share a legend. However there are duplicate legend entries as every trace adds an entry. I would like to only have 1 entry and ideally have both lines react to that legend entry being clicked.
Is that possible?
I tried either using 2 x-axes and tools.make_subplots
2 x axes:
traces.append(go.Scatter(
x=x,
y=y,
name=name,
line={'color': color},
xaxis='x1',
yaxis='y1',
))
traces.append(go.Scatter(
x=x,
y=y,
name=name,
line={'color': color},
xaxis='x2',
yaxis='y3',
))
Subplots:
When I do this and I click on a legend entry, it disables all traces in the legend, not just the one corresponding to the legend entry
fig.append_trace(go.Scatter(
x=x,
y=y,
name=name,
line={'color': color},
legendgroup='group1'
), 1, 1)
fig.append_trace(go.Scatter(
x=x,
y=y,
name=name,
line={'color': color},
legendgroup='group2'
), 1, 2)
graphs.append(dcc.Graph(figure=fig))