observablehq / runtime

The reactive dataflow runtime that powers Observable Framework and Observable notebooks
https://observablehq.com/@observablehq/how-observable-runs
ISC License
1.02k stars 72 forks source link

Is there a way not to show the data? #231

Closed eyaleizenberg closed 4 years ago

eyaleizenberg commented 4 years ago

I am just starting out with Observablehq so sorry for the noob question. I started out locally modifying this example: https://observablehq.com/@d3/force-directed-graph

My question is, is there a way for me to hide the data part below the graph?

Screen Shot 2020-02-09 at 16 29 09
mbostock commented 4 years ago

Try this snippet from the README:

const runtime = new Runtime();
const main = runtime.module(define, name => {
  if (name === "chart") {
    return new Inspector(document.body);
  }
});

You can display multiple cells this way too, but you’ll need to give each of them a container element.

const runtime = new Runtime();
const main = runtime.module(define, name => {
  if (name === "chart" || name === "legend") {
    return new Inspector(document.querySelector(`#${name}`));
  }
});