Skip to content

Commit

Permalink
support jsrendering of abstract vectors. e.g. in traces
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Jan 2, 2025
1 parent 6585242 commit 1ac8486
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/StipplePlotlyPlotlyBaseExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ function Stipple.stipple_parse(::Type{PlotlyBase.Layout{D}}, d::AbstractDict) wh
PlotlyBase.Layout(stipple_parse(D, PlotlyBase._symbol_dict(d)))
end

# to support array types where special jsrender methods are defined, e.g. TypedArrays
function Stipple.jsrender(t::Union{PlotlyBase.HasFields, PlotlyBase.Plot}, field::Symbol = :plot)
d = Dict(t)
Dict(keys(d) .=> [v isa AbstractVector ? Stipple.jsrender.(v) : Stipple.jsrender(v) for v in values(d)])
end

end

0 comments on commit 1ac8486

Please sign in to comment.