SimonDanisch / Bonito.jl

Serving JS to the browser
MIT License
204 stars 29 forks source link

Interactive plot title #228

Open tuncbkose opened 3 months ago

tuncbkose commented 3 months ago

Hi, I'm trying to use Bonito.record_states to plot the evolution of some algorithm, and I cannot get the plot title to change with an Observable (on Firefox, if that matters). I'd appreciate if someone could let me know if I'm doing something wrong or if there indeed is some bug etc.

As a simplified example, consider

using WGLMakie, Bonito

App() do session::Session
    n=10
    slider = Slider(1:n)
    lab = @lift(string("t=", $(slider.value)))
    fig, ax, splot = scatter(1:n, 1:n, axis=(title=lab, ))
    return Bonito.record_states(session, DOM.div(slider, slider.value, fig))
end

When I ran the above, the plot title is stuck at t=1, even though I can add the rest of my code and change the content of the plot as expected. I imagine this may be more WGLMakie related rather than Bonito, but in trying to do a similar thing to create a gif, I had no problems.