Skip to content

Commit

Permalink
ENH: add update and update! for jupyter frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
sglyon committed Jan 29, 2018
1 parent 5d2e03d commit 6c8e423
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PlotlyJS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ using Base.Iterators

# need to import some functions because methods are meta-generated
import PlotlyBase:
restyle!, relayout!, addtraces!, deletetraces!, movetraces!, redraw!,
extendtraces!, prependtraces!, purge!, to_image, download_image,
restyle, relayout, addtraces, deletetraces, movetraces, redraw,
restyle!, relayout!, update!, addtraces!, deletetraces!, movetraces!,
redraw!, extendtraces!, prependtraces!, purge!, to_image, download_image,
restyle, relayout, update, addtraces, deletetraces, movetraces, redraw,
extendtraces, prependtraces, prep_kwargs, sizes, savefig

using Blink
Expand Down
21 changes: 21 additions & 0 deletions src/displays/ijulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,27 @@ end
restyle!(jd::JupyterDisplay, update::Associative=Dict(); kwargs...) =
_call_plotlyjs(jd, "restyle", merge(update, prep_kwargs(kwargs)))

function update!(
jd::JupyterDisplay, ind::Int, update::Associative=Dict();
layout::Layout=Layout(), kwargs...
)
_call_plotlyjs(jd, "update", merge(update, prep_kwargs(kwargs)), layout, ind-1)
end

function update!(
jd::JupyterDisplay, inds::AbstractVector{Int},
update::Associative=Dict(); layout::Layout=Layout(), kwargs...
)
_call_plotlyjs(jd, "update", merge(update, prep_kwargs(kwargs)), layout, inds-1)
end

function update!(
jd::JupyterDisplay, update::Associative=Dict();
layout::Layout=Layout(), kwargs...
)
_call_plotlyjs(jd, "update", merge(update, prep_kwargs(kwargs)), layout)
end

addtraces!(jd::JupyterDisplay, traces::AbstractTrace...) =
_call_plotlyjs(jd, "addTraces", traces)

Expand Down

0 comments on commit 6c8e423

Please sign in to comment.