Skip to content

Commit 3f2b80c

Browse files
authored
Merge pull request #414 from JuliaPlots/new-methods
enh: added new PlotlyBase methods for SyncPlot
2 parents 0224ca7 + 015884e commit 3f2b80c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
2222
Blink = "0.12"
2323
JSExpr = "0.5, 1"
2424
JSON = "0.20, 0.21"
25-
PlotlyBase = "0.6, ^0.7, 0.8"
25+
PlotlyBase = "0.8.9"
2626
Reexport = "0.2, 1"
2727
Requires = "1.0"
2828
WebIO = "0.8"

src/PlotlyJS.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,20 @@ function __init__()
165165
end
166166
end
167167

168+
# for methods that update the layout, first apply to the plot, then let plotly.js
169+
# deal with the rest via the react function
170+
for (k, v) in vcat(PlotlyBase._layout_obj_updaters, PlotlyBase._layout_vector_updaters)
171+
@eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...)
172+
$(k)(p.plot, args...; kwargs...)
173+
send_command(p.scope, :react, p.plot.data, p.plot.layout)
174+
end
175+
end
176+
177+
for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!]
178+
@eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...)
179+
$(k)(p.plot, args...; kwargs...)
180+
send_command(p.scope, :react, p.plot.data, p.plot.layout)
181+
end
182+
end
183+
168184
end # module

0 commit comments

Comments
 (0)