Hello everyone,
consider the following MWE code
using Observables, JSServe, WGLMakie, Markdown
App() do session::Session
n = Slider(5:10)
xs = 1:10
ys = rand(length(xs))
fig = Figure()
axis = Axis(fig[1,1])
xshort = @lift view(xs, ($n) : length(xs))
yshort = @lift view(ys, ($n) : length(ys))
lines!(axis, xs, ys)
lines!(axis, xshort, yshort)
slider = DOM.div("Slider: ", n, n.value)
return JSServe.record_states(session, DOM.div(slider, fig))
end
This code crashes on the error ERROR: DimensionMismatch: arrays could not be broadcast to a common size; got a dimension with lengths 5 and 6
(I can include the full stacktrace if necessary)
I should also note that if you just write
n = Slider(5:10)
xs = 1:10
ys = rand(length(xs))
fig = Figure()
axis = Axis(fig[1,1])
xshort = @lift view(xs, ($n) : length(xs))
yshort = @lift view(ys, ($n) : length(ys))
lines!(axis, xs, ys)
lines!(axis, xshort, yshort)
display(fig)
then all works nice and well. Any idea why this happens?
Thanks a lot