expand data of shapes only for plotly(js)

This commit is contained in:
Daniel Schwabeneder 2019-09-09 13:17:34 +02:00
parent 150b5a1f06
commit d0c6f0d6ee
2 changed files with 6 additions and 6 deletions

View File

@ -584,7 +584,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims)
)
x, y = (plotly_data(series, letter, data)
for (letter, data) in zip((:x, :y), shape_data(series))
for (letter, data) in zip((:x, :y), shape_data(series, 100))
)
for (i,rng) in enumerate(segments)

View File

@ -1162,23 +1162,23 @@ function straightline_data(xl, yl, x, y, expansion_factor = 1)
return x_vals, y_vals
end
function shape_data(series)
function shape_data(series, expansion_factor = 1)
sp = series[:subplot]
xl, yl = isvertical(series) ? (xlims(sp), ylims(sp)) : (ylims(sp), xlims(sp))
x, y = series[:x], series[:y]
factor = 100
for i in eachindex(x)
if x[i] == -Inf
x[i] = xl[1] - factor * (xl[2] - xl[1])
x[i] = xl[1] - expansion_factor * (xl[2] - xl[1])
elseif x[i] == Inf
x[i] = xl[2] + factor * (xl[2] - xl[1])
x[i] = xl[2] + expansion_factor * (xl[2] - xl[1])
end
end
for i in eachindex(y)
if y[i] == -Inf
y[i] = yl[1] - factor * (yl[2] - yl[1])
y[i] = yl[1] - expansion_factor * (yl[2] - yl[1])
elseif y[i] == Inf
y[i] = yl[2] + factor * (yl[2] - yl[1])
y[i] = yl[2] + expansion_factor * (yl[2] - yl[1])
end
end
return x, y