Skip to content

Commit

Permalink
Merge pull request #193 from piever/webio
Browse files Browse the repository at this point in the history
webio integration
  • Loading branch information
sglyon authored Jun 27, 2018
2 parents 10bbefc + a7244f6 commit 016a656
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Base.copy(sp::SyncPlot) = fork(sp) # defined by each SyncPlot{TD}
# ----------------- #

@require Juno include("displays/juno.jl")
@require WebIO include("displays/webio.jl")
include("displays/electron.jl")
include("displays/ijulia.jl")

Expand Down
13 changes: 13 additions & 0 deletions src/displays/webio.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
WebIO.render(p::SyncPlot) = WebIO.render(p.plot)

function WebIO.render(p::Plot)
scp = WebIO.Scope(imports = ["plotly" => _js_path])
scp.dom = WebIO.Node(:div, id = string(p.divid), className = "plotly-graph-div")
WebIO.onimport(scp, WebIO.js"""function (Plotly) {
window.PLOTLYENV=window.PLOTLYENV || {};
window.PLOTLYENV.BASE_URL="https://plot.ly";
$(WebIO.JSString(PlotlyJS.script_content(p)))
}
""")
WebIO.render(scp)
end

0 comments on commit 016a656

Please sign in to comment.