fix transposing in plotlyjs (#3953)

* fix transposing

* fix plotly_series
This commit is contained in:
Simon Christ 2021-11-26 09:59:44 +01:00 committed by Zhanibek
parent b967a34abb
commit a2e449ca10
2 changed files with 4 additions and 10 deletions

View File

@ -754,7 +754,7 @@ function plotly_series(plt::Plot, series::Series)
plotly_polar!(plotattributes_out, series) plotly_polar!(plotattributes_out, series)
plotly_hover!(plotattributes_out, series[:hover]) plotly_hover!(plotattributes_out, series[:hover])
return [plotattributes_out] return plotattributes_out
end end
function plotly_series_shapes(plt::Plot, series::Series, clims) function plotly_series_shapes(plt::Plot, series::Series, clims)
@ -1030,11 +1030,7 @@ end
# get a list of dictionaries, each representing the series params # get a list of dictionaries, each representing the series params
function plotly_series(plt::Plot) function plotly_series(plt::Plot)
slist = [] [plotly_series(plt, series) for series in plt.series_list]
for series in plt.series_list
append!(slist, plotly_series(plt, series))
end
slist
end end
# get json string for a list of dictionaries, each representing the series params # get json string for a list of dictionaries, each representing the series params
@ -1110,10 +1106,7 @@ function js_body(plt::Plot, uuid)
end end
function plotly_show_js(io::IO, plot::Plot) function plotly_show_js(io::IO, plot::Plot)
data = [] data = plotly_series(plot)
for series in plot.series_list
append!(data, plotly_series(plot, series))
end
layout = plotly_layout(plot) layout = plotly_layout(plot)
JSON.print(io, Dict(:data => data, :layout => layout)) JSON.print(io, Dict(:data => data, :layout => layout))
end end

View File

@ -8,6 +8,7 @@ function plotlyjs_syncplot(plt::Plot{PlotlyJSBackend})
traces = PlotlyJS.GenericTrace[] traces = PlotlyJS.GenericTrace[]
for series_dict in plotly_series(plt) for series_dict in plotly_series(plt)
plotly_type = pop!(series_dict, :type) plotly_type = pop!(series_dict, :type)
series_dict[:transpose] = false
push!(traces, PlotlyJS.GenericTrace(plotly_type; series_dict...)) push!(traces, PlotlyJS.GenericTrace(plotly_type; series_dict...))
end end
PlotlyJS.addtraces!(plt.o, traces...) PlotlyJS.addtraces!(plt.o, traces...)