diff --git a/Project.toml b/Project.toml index c12e6577..d7b196df 100644 --- a/Project.toml +++ b/Project.toml @@ -22,7 +22,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" Blink = "0.12" JSExpr = "0.5, 1" JSON = "0.20, 0.21" -PlotlyBase = "0.6, ^0.7, 0.8" +PlotlyBase = "0.8.9" Reexport = "0.2, 1" Requires = "1.0" WebIO = "0.8" diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 43a553f0..541f1c6b 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -165,4 +165,20 @@ function __init__() end end +# for methods that update the layout, first apply to the plot, then let plotly.js +# deal with the rest via the react function +for (k, v) in vcat(PlotlyBase._layout_obj_updaters, PlotlyBase._layout_vector_updaters) + @eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...) + $(k)(p.plot, args...; kwargs...) + send_command(p.scope, :react, p.plot.data, p.plot.layout) + end +end + +for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!] + @eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...) + $(k)(p.plot, args...; kwargs...) + send_command(p.scope, :react, p.plot.data, p.plot.layout) + end +end + end # module