Skip to content

Commit

Permalink
Fix plots recipes (#493)
Browse files Browse the repository at this point in the history
fix #492
  • Loading branch information
iblislin authored Apr 23, 2021
1 parent 3211ad5 commit 8af812d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
throw(ArgumentError(":seriescolor should be a Vector{Symbol} of two elements."))
end

xseg, yseg = Float64[], Float64[]
xseg, yseg = Vector{Float64}[], Vector{Float64}[]
xcenter, ycenter = Float64[], Float64[]

idx = 1:length(cs.time)
Expand All @@ -95,7 +95,7 @@ end
for (i, o, h, l, c) zip(idx, cs.open, cs.high, cs.low, cs.close)
x₁, x₂ = i - tick + margin, i - margin
= i - tick / 2
append!(xseg, [
push!(xseg, [
x̄,
x̄,
x₁,
Expand All @@ -106,11 +106,10 @@ end
x₂,
x₂,
x̄,
NaN
])

y₁, y₂ = min(o, c), max(o, c)
append!(yseg, [
push!(yseg, [
l,
y₁,
y₁,
Expand All @@ -121,7 +120,6 @@ end
y₂,
y₁,
y₁,
NaN
])

push!(colors, ifelse(o c, cols[1], cols[2]))
Expand All @@ -145,10 +143,12 @@ end
get!(extract_plot_kwargs, :hovermode, :x)
get!(extract_plot_kwargs, :hoverdistance, 5)

colors′ = reshape(colors, 1, :)

@series begin
seriestype := :shape
seriescolor := colors
linecolor --> colors
seriescolor := colors
linecolor --> colors
xseg, yseg
end

Expand Down

0 comments on commit 8af812d

Please sign in to comment.