Merge pull request #1950 from JuliaPlots/sd-plotlyjson

add plotly json mime to PlotlyBackend as well
This commit is contained in:
Michael Krabbe Borregaard 2019-03-12 14:21:07 +01:00 committed by GitHub
commit 3af60a81f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -853,11 +853,16 @@ end
# ----------------------------------------------------------------
function _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend})
write(io, html_head(plt) * html_body(plt))
function _show(io::IO, ::MIME"application/vnd.plotly.v1+json", plot::Plot{PlotlyBackend})
data = []
for series in plot.series_list
append!(data, plotly_series(plot, series))
end
layout = plotly_layout(plot)
JSON.print(io, Dict(:data => data, :layout => layout))
end
function _display(plt::Plot{PlotlyBackend})
standalone_html_window(plt)
end