Merge pull request #669 from YongHee-Kim/master
enable standalone window for plotlyjs() backend
This commit is contained in:
commit
1555876280
@ -102,8 +102,18 @@ _show(io::IO, ::MIME"image/png", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hac
|
|||||||
_show(io::IO, ::MIME"application/pdf", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "pdf")
|
_show(io::IO, ::MIME"application/pdf", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "pdf")
|
||||||
_show(io::IO, ::MIME"image/eps", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "eps")
|
_show(io::IO, ::MIME"image/eps", plt::Plot{PlotlyJSBackend}) = plotlyjs_save_hack(io, plt, "eps")
|
||||||
|
|
||||||
|
function write_temp_html(plt::Plot{PlotlyJSBackend})
|
||||||
|
filename = string(tempname(), ".html")
|
||||||
|
savefig(plt, filename)
|
||||||
|
filename
|
||||||
|
end
|
||||||
|
|
||||||
function _display(plt::Plot{PlotlyJSBackend})
|
function _display(plt::Plot{PlotlyJSBackend})
|
||||||
display(plt.o)
|
if get(ENV, "PLOTS_USE_ATOM_PLOTPANE", true) in (true, 1, "1", "true", "yes")
|
||||||
|
display(plt.o)
|
||||||
|
else
|
||||||
|
standalone_html_window(plt)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -302,6 +302,10 @@ function setup_atom()
|
|||||||
Media.render(pane, Atom.div(".fill", Atom.HTML(stringmime(MIME("text/html"), plt))))
|
Media.render(pane, Atom.div(".fill", Atom.HTML(stringmime(MIME("text/html"), plt))))
|
||||||
plt[:size] = sz
|
plt[:size] = sz
|
||||||
end
|
end
|
||||||
|
# special handling for PlotlyJS
|
||||||
|
function Media.render(pane::Atom.PlotPane, plt::Plot{PlotlyJSBackend})
|
||||||
|
display(Plots.PlotsDisplay(), plt)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
#
|
#
|
||||||
function Media.render(pane::Atom.PlotPane, plt::Plot)
|
function Media.render(pane::Atom.PlotPane, plt::Plot)
|
||||||
@ -317,11 +321,5 @@ function setup_atom()
|
|||||||
s = "PlotPane turned off. The plotly and plotlyjs backends cannot render in the PlotPane due to javascript issues."
|
s = "PlotPane turned off. The plotly and plotlyjs backends cannot render in the PlotPane due to javascript issues."
|
||||||
Media.render(pane, Atom.div(Atom.HTML(s)))
|
Media.render(pane, Atom.div(Atom.HTML(s)))
|
||||||
end
|
end
|
||||||
|
|
||||||
# special handling for PlotlyJS to pass through to that render method
|
|
||||||
function Media.render(pane::Atom.PlotPane, plt::Plot{PlotlyJSBackend})
|
|
||||||
Plots.prepare_output(plt)
|
|
||||||
Media.render(pane, plt.o)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user