how to use Mike Bostock d3 tidy tree offline

I am using Mac book with ampss server:

I followed the instructions here:

and I can run d3.js offline.

No problem except for “Not allowed to load local resource: file:///favicon.ico” which I think can ignore.

For d3-tidy-tree.js, there are required files from the Internet:

Line81: d3.json("")

<link rel="stylesheet" type="text/css" href="">

import {Inspector, Runtime} from "";

For the three web links, I can go to the URL on Safari can copy the text, then save as the same filename.

For the third Internet link, it changes to:

Does this mean I should copy the text and save as notebook-runtime.js?

Is the above the right way to do?

My index.html is here

<!DOCTYPE html>
<meta charset="utf-8">
<title>D3 Tidy Tree</title>
<link rel="stylesheet" type="text/css" href="notebook-inspector-style.css">
<script type="text/javascript" src="d3.js"></script>
<script type="module">

import {Inspector, Runtime} from "notebook-runtime.js";
import notebook from "d3-tidy-tree.js";

Runtime.load(notebook, Inspector.into(document.body));


I just got a blank page only.

You probably got some error messages in the console saying that the module could not be found. Try changing these lines:

to this:

import {Inspector, Runtime} from "./notebook-runtime.js";
import notebook from "./d3-tidy-tree.js";

See this article for some more info

1 Like