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

View File

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