The Runtime.load(notebook, Inspector.into(document.body)) line is loading every cell in the notebook — including the “code” cells — into the body of the webpage.
If you only want to display the chart, and nothing else, try:
Runtime.load(notebook, (cell) => {
if (cell.name === "chart") {
const element = document.body.appendChild(document.createElement("div"));
return new Inspector(element);
}
});
The document.body.appendChild bit is telling the script to just stick the chart at the bottom of the page. If you want to put it somewhere more specific, like in a particular existing <div>, you’ll have to change the element reference to point to it.