Merge pull request #1510 from chfin/segments-legendgroup-fix

Make series of shapes and segments toggle together in plotly[js] (fixes #1488)
This commit is contained in:
Daniel Schwabeneder 2018-05-06 21:46:10 +02:00 committed by GitHub
commit 49f4773e81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -388,6 +388,7 @@ function plotly_layout(plt::Plot)
:bgcolor => rgba_string(sp[:background_color_legend]),
:bordercolor => rgba_string(sp[:foreground_color_legend]),
:font => plotly_font(legendfont(sp)),
:tracegroupgap => 0,
:x => xpos,
:y => ypos
)
@ -664,8 +665,8 @@ function plotly_series_shapes(plt::Plot, series::Series)
:xaxis => "x$(x_idx)",
:yaxis => "y$(y_idx)",
:name => series[:label],
:legendgroup => series[:label],
)
# d_base[:legendgroup] = series[:label]
x, y = (plotly_data(series, letter, data)
for (letter, data) in zip((:x, :y), shape_data(series))
@ -722,6 +723,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
d_out = deepcopy(d_base)
d_out[:showlegend] = i==1 ? should_add_to_legend(series) : false
d_out[:legendgroup] = series[:label]
# set the type
if st in (:path, :scatter, :scattergl, :straightline)