diff --git a/Project.toml b/Project.toml index ad65d4df..812c871e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PlotlyJS" uuid = "f0f68f2c-4968-5e81-91da-67840de0976a" authors = ["Spencer Lyon "] -version = "0.18.5" +version = "0.18.6" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -22,7 +22,7 @@ WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29" Blink = "0.12" JSExpr = "0.5, 1" JSON = "0.20, 0.21" -PlotlyBase = "0.8.9" +PlotlyBase = "0.8.15" Reexport = "0.2, 1" Requires = "1.0" WebIO = "0.8" diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 541f1c6b..9d3e514e 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -21,7 +21,7 @@ using Blink using Pkg.Artifacts using Requires -export plot, dataset, list_datasets, make_subplots, savefig +export plot, dataset, list_datasets, make_subplots, savefig, mgrid # globals for this package const _pkg_root = dirname(dirname(@__FILE__)) @@ -174,7 +174,7 @@ for (k, v) in vcat(PlotlyBase._layout_obj_updaters, PlotlyBase._layout_vector_up end end -for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!] +for k in [:add_hrect!, :add_hline!, :add_vrect!, :add_vline!, :add_shape!, :add_layout_image!] @eval function PlotlyBase.$(k)(p::SyncPlot, args...;kwargs...) $(k)(p.plot, args...; kwargs...) send_command(p.scope, :react, p.plot.data, p.plot.layout) diff --git a/src/display.jl b/src/display.jl index a67c0ac8..c74e629e 100644 --- a/src/display.jl +++ b/src/display.jl @@ -16,7 +16,7 @@ end function Base.show(io::IO, mm::MIME"text/html", p::SyncPlot) # if we are rendering docs -- short circuit and display html if get_renderer() == DOCS - return show(io, mm, p.plot, full_html=false, include_plotlyjs="require-loaded") + return show(io, mm, p.plot, full_html=false, include_plotlyjs="require-loaded", include_mathjax=false) end show(io, mm, p.scope) end @@ -184,7 +184,7 @@ end function add_trace!(p::SyncPlot, trace::GenericTrace; kw...) add_trace!(p.plot, trace; kw...) - send_command(p.scope, :addTraces, trace) + send_command(p.scope, :react, p.plot.data, p.plot.layout) end diff --git a/src/util.jl b/src/util.jl index 0f7a16f8..d17a5281 100644 --- a/src/util.jl +++ b/src/util.jl @@ -14,3 +14,18 @@ function PlotlyBase.add_recession_bands!(p::SyncPlot; kwargs...) relayout!(p, shapes=new_shapes) new_shapes end + +function mgrid(arrays...) + lengths = collect(length.(arrays)) + uno = ones(Int, length(arrays)) + out = [] + for i in 1:length(arrays) + repeats = copy(lengths) + repeats[i] = 1 + + shape = copy(uno) + shape[i] = lengths[i] + push!(out, reshape(arrays[i], shape...) .* ones(repeats...)) + end + out +end