Skip to content

Commit c619b63

Browse files
committed
bug fix - tooltip in Bar
1 parent 1052b33 commit c619b63

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/charts/bar.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ function _push_plots!(vspec, plt::Bar, all_args; idx=1)
197197
s_spec[:from][:facet][:groupby] = col
198198
end
199199
end
200+
201+
if opts[:tooltip]
202+
if opts[:group] === nothing
203+
s_spec_marks[:encode][:enter][:tooltip] = Dict{Symbol, Any}(:signal=>"{category : datum['$col'], height : datum['__height__bar__'] - datum['__height__bar__start__']}")
204+
else
205+
s_spec_marks[:encode][:enter][:tooltip] = Dict{Symbol, Any}(:signal=>"{category : datum['$col'], group : datum['$(opts[:group])'], height : datum['__height__bar__'] - datum['__height__bar__start__']}")
206+
end
207+
end
208+
200209
s_spec[:marks] = [s_spec_marks]
201210
push!(vspec[:marks], s_spec)
202211
if opts[:label] in (:height, :category)

0 commit comments

Comments
 (0)