fix series_annotations for bar

This commit is contained in:
Daniel Schwabeneder 2021-04-29 14:07:36 +02:00
parent 57ba6aa5a9
commit 26bf6347a0
2 changed files with 19 additions and 14 deletions

View File

@ -1,7 +1,7 @@
name = "Plots" name = "Plots"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
author = ["Tom Breloff (@tbreloff)"] author = ["Tom Breloff (@tbreloff)"]
version = "1.13.2" version = "1.13.3"
[deps] [deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

View File

@ -472,15 +472,6 @@ end
fillto = map(x -> _is_positive(x) ? typeof(baseline)(x) : baseline, fillto) fillto = map(x -> _is_positive(x) ? typeof(baseline)(x) : baseline, fillto)
end end
if !isnothing(plotattributes[:series_annotations])
if isvertical(plotattributes)
annotations := (x,y,plotattributes[:series_annotations].strs,:bottom)
else
annotations := (y,x,plotattributes[:series_annotations].strs,:left)
end
series_annotations := nothing
end
# create the bar shapes by adding x/y segments # create the bar shapes by adding x/y segments
xseg, yseg = Segments(), Segments() xseg, yseg = Segments(), Segments()
for i = 1:ny for i = 1:ny
@ -507,15 +498,29 @@ end
# switch back # switch back
if !isvertical(plotattributes) if !isvertical(plotattributes)
xseg, yseg = yseg, xseg xseg, yseg = yseg, xseg
x, y = y, x
end end
# reset orientation # reset orientation
orientation := default(:orientation) orientation := default(:orientation)
x := xseg.pts # draw the bar shapes
y := yseg.pts @series begin
seriestype := :shape seriestype := :shape
series_annotations := nothing
primary := true
x := xseg.pts
y := yseg.pts
()
end
# add empty series for series annotations (and hover in plotly)
primary := false
seriestype := :scatter
markersize := 0
markeralpha := 0
x := x
y := y
() ()
end end
@deps bar shape @deps bar shape