fix series_annotations size

This commit is contained in:
Tom Breloff 2016-11-11 17:43:46 -05:00
parent c779dc6577
commit 376ee02041

View File

@ -398,7 +398,7 @@ end
function series_annotations(strs::AbstractVector, args...) function series_annotations(strs::AbstractVector, args...)
fnt = font() fnt = font()
shp = Nullable{Any}() shp = Nullable{Any}()
scalefactor = 1 # scalefactor = 1
for arg in args for arg in args
if isa(arg, Shape) || (isa(arg, AbstractVector) && eltype(arg) == Shape) if isa(arg, Shape) || (isa(arg, AbstractVector) && eltype(arg) == Shape)
shp = Nullable(arg) shp = Nullable(arg)
@ -406,17 +406,17 @@ function series_annotations(strs::AbstractVector, args...)
fnt = arg fnt = arg
elseif isa(arg, Symbol) && haskey(_shapes, arg) elseif isa(arg, Symbol) && haskey(_shapes, arg)
shp = _shapes[arg] shp = _shapes[arg]
elseif isa(arg, Number) # elseif isa(arg, Number)
scalefactor = arg # scalefactor = arg
else else
warn("Unused SeriesAnnotations arg: $arg ($(typeof(arg)))") warn("Unused SeriesAnnotations arg: $arg ($(typeof(arg)))")
end end
end end
if scalefactor != 1 # if scalefactor != 1
for s in get(shp) # for s in get(shp)
scale!(s, scalefactor, scalefactor, (0,0)) # scale!(s, scalefactor, scalefactor, (0,0))
end # end
end # end
SeriesAnnotations(strs, fnt, shp) SeriesAnnotations(strs, fnt, shp)
end end
series_annotations(anns::SeriesAnnotations) = anns series_annotations(anns::SeriesAnnotations) = anns
@ -424,6 +424,8 @@ series_annotations(::Void) = nothing
function series_annotations_shapes!(series::Series, scaletype::Symbol = :pixels) function series_annotations_shapes!(series::Series, scaletype::Symbol = :pixels)
anns = series[:series_annotations] anns = series[:series_annotations]
ms = series[:markersize]
msw,msh = is_2tuple(ms) ? ms : (ms,ms)
if anns != nothing && !isnull(anns.baseshape) if anns != nothing && !isnull(anns.baseshape)
# we use baseshape to overwrite the markershape attribute # we use baseshape to overwrite the markershape attribute
# with a list of custom shapes for each # with a list of custom shapes for each
@ -446,7 +448,7 @@ function series_annotations_shapes!(series::Series, scaletype::Symbol = :pixels)
maxscale = max(xscale, yscale) maxscale = max(xscale, yscale)
push!(msize, maxscale) push!(msize, maxscale)
baseshape = cycle(get(anns.baseshape),i) baseshape = cycle(get(anns.baseshape),i)
shape = scale(baseshape, xscale/maxscale, yscale/maxscale, (0,0)) shape = scale(baseshape, msw*xscale/maxscale, msh*yscale/maxscale, (0,0))
end for i=1:length(anns.strs)] end for i=1:length(anns.strs)]
series[:markershape] = shapes series[:markershape] = shapes
series[:markersize] = msize series[:markersize] = msize