Merge pull request #1408 from piever/plotlyjs

make plotlyjs use html in ijulia
This commit is contained in:
Michael Krabbe Borregaard 2018-02-24 12:09:04 +01:00 committed by GitHub
commit 9578fe03b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -794,6 +794,11 @@ function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyBackend})
write(io, html_head(plt) * html_body(plt))
end
function Base.show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend})
prepare_output(plt)
write(io, html_head(plt) * html_body(plt))
end
function _display(plt::Plot{PlotlyBackend})
standalone_html_window(plt)
end

View File

@ -171,7 +171,9 @@ const _mimeformats = Dict(
const _best_html_output_type = KW(
:pyplot => :png,
:unicodeplots => :txt,
:glvisualize => :png
:glvisualize => :png,
:plotlyjs => :html,
:plotly => :html
)
# a backup for html... passes to svg or png depending on the html_output_format arg
@ -270,6 +272,9 @@ end
elseif output_type == :svg
mime = "image/svg+xml"
Dict{String,String}(mime => sprint(show, MIME(mime), plt))
elseif output_type == :html
mime = "text/html"
Dict{String,String}(mime => sprint(show, MIME(mime), plt))
else
error("Unsupported output type $output_type")
end