I have created a chart visualizing JSON data, which in the notebook looks great and works well. However, when I try to embed the cell the preview always returns chart = null. I looked at many example codes which all look similar to mine, yet I get this issue. Any idea what could be the reason?
Note that the
chart in your notebook doesn’t return or yield an image; rather it
d3.selects another node (by
id) and places the image there. A quick fix (that I don’t recommend) would be to name the other node and embed that.
Note, though, that the global
id is not generally recommended in Observable. I’d recommend creating an SVG and yielding that right from the same cell. Here’s a fork of your notebook that seems to embed the graphic well:
Perfect. Thanks a lot for the info and the support!