[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
Advertisement
Answer
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