displaying a chart imported from observable twice in the same document #1864
Replies: 2 comments 1 reply
-
Thanks, we are tracking this in the following GH issue: #1865 |
Beta Was this translation helpful? Give feedback.
-
Right, the issue here is that Observable detects DOM sharing. In general, if you want to generate more than one copy of the same visualization on a web page, you will need to create copies of the DOM elements. There's really no way around this, since DOM elements need to handle things like "parent nodes", and the DOM fundamentally expects a tree structure. As a result, you need to change your API to be a function call that returns new elements on demand, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
In one of the source files for a quarto website I'm building, I'd like to display a chart I'm importing from an Observable notebook in two different places.
So, the source file first has an import statement:
then a cell showing the chart:
and then, later in the document, a cell showing the chart again:
(The notebook the chart is being imported from is public, so you can try all the above yourself.)
This bonks when I render the sourcefile. The chart displays as it should at the second of the two code blocks. But the first codeblock outputs the raw javascript object containing the chart like this:
Is this a bug? Or is there a gotcha I missed in Quarto's or Observable's documentation about how to display the same chart twice in a single file?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions