It's simple, all the interactive plots are HTML canvases with a set of event handler assigned to them. I trigger init ialization functions right after the elements declarations, and they assign all the events: https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535...
And that's all. It's a bit messy since it involves keeping state outside the functions, and it also requires a little boilerplate but it's manageable. Maybe if I would have hundreds of plots per page, this would have been a problem but for a blog-post size pages this works fine.
It's simple, all the interactive plots are HTML canvases with a set of event handler assigned to them. I trigger init ialization functions right after the elements declarations, and they assign all the events: https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535...
Almost every event changes the state somewhere and triggers the redrawing function: https://github.com/akalenuk/wordsandbuttons/blob/380c97f2535...
And that's all. It's a bit messy since it involves keeping state outside the functions, and it also requires a little boilerplate but it's manageable. Maybe if I would have hundreds of plots per page, this would have been a problem but for a blog-post size pages this works fine.