How to attach a plot to a DOM element | Fil | Observable
•ojs
•ojs
Comments (2)
Murat Anlı
Mar 21, 2023
It looks like each time the plot is redrawn a new plot object is appended to the <div> element. Is there a way to fix that behavior where the newly generated plot object replaces the already existing one?
Fil
Mar 21, 2023
Sure! What Plot returns is a "standard" DOM node. It's possible to empty the #container before appending it, or select the previous node and use
https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith
.
Reply
Add comment
Subscribe to notifications
Observable
Sign in
Fil
2
Reply
Add comment
Subscribe to notifications
1
How to attach a plot to a DOM element | Fil | Observable