use_remote for plotly html output
This commit is contained in:
parent
8204b51213
commit
90e655d979
@ -57,6 +57,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
|
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
|
||||||
|
const _plotly_js_path_remote = "https://cdn.plot.ly/plotly-latest.min.js"
|
||||||
|
|
||||||
function _initialize_backend(::PlotlyBackend; kw...)
|
function _initialize_backend(::PlotlyBackend; kw...)
|
||||||
@eval begin
|
@eval begin
|
||||||
@ -629,8 +630,12 @@ end
|
|||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
const _use_remote = Ref(false)
|
||||||
|
|
||||||
function html_head(plt::Plot{PlotlyBackend})
|
function html_head(plt::Plot{PlotlyBackend})
|
||||||
"<script src=\"$(joinpath(dirname(@__FILE__),"..","..","deps","plotly-latest.min.js"))\"></script>"
|
jsfilename = _use_remote[] ? _plotly_js_path_remote : _plotly_js_path
|
||||||
|
# "<script src=\"$(joinpath(dirname(@__FILE__),"..","..","deps","plotly-latest.min.js"))\"></script>"
|
||||||
|
"<script src=\"$jsfilename\"></script>"
|
||||||
end
|
end
|
||||||
|
|
||||||
function html_body(plt::Plot{PlotlyBackend}, style = nothing)
|
function html_body(plt::Plot{PlotlyBackend}, style = nothing)
|
||||||
|
|||||||
@ -55,7 +55,9 @@ tex(fn::AbstractString) = tex(current(), fn)
|
|||||||
function html(plt::Plot, fn::AbstractString)
|
function html(plt::Plot, fn::AbstractString)
|
||||||
fn = addExtension(fn, "html")
|
fn = addExtension(fn, "html")
|
||||||
io = open(fn, "w")
|
io = open(fn, "w")
|
||||||
|
_use_remote[] = true
|
||||||
show(io, MIME("text/html"), plt)
|
show(io, MIME("text/html"), plt)
|
||||||
|
_use_remote[] = false
|
||||||
close(io)
|
close(io)
|
||||||
end
|
end
|
||||||
html(fn::AbstractString) = html(current(), fn)
|
html(fn::AbstractString) = html(current(), fn)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user