0

[1]https://gist.github.com/anilnairxyz/754723d31dd14d50a3142e65d47c1057

I just tested it before changing the code

I copied the code and simply changed the .html-file

<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> <script src="//d3js.org/d3-queue.v3.min.js"></script> <script src="//d3js.org/topojson.v1.min.js"></script> 

to

<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> <script src="https://d3js.org/d3-queue.v3.min.js"></script> <script src="https://d3js.org/topojson.v1.min.js"></script> 

then I get the following errors:

ReferenceError: d3 is not defined

As I have almost no knowledge of d3 or javascript.

Can anyone give me a hint to what is causing the errors and how I should correct the code please?

I've already seen this post and tried d3 is not defined - ReferenceError

2
  • You are using an old version of d3. A lot of d3 functions changed between v3 and v4. Can you post some of your js? Commented Feb 2, 2021 at 19:48
  • @rguttersohn I didn't change anything except the html file. Commented Feb 2, 2021 at 21:45

1 Answer 1

2

From the error screenshot, it seems you're executing heatmap.js in a console with node.js. The issue is that the heatmap.js script, and the other scripts of the project, are designed to be executed in a browser with an HTML page, and not in isolation in a node terminal. To run a D3 project you need a local web server, and then access the localhost:{port number} on the browser. Here is a tutorial on how to do it with with node.js

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.