Adam Lee
Adam Lee

Reputation: 25748

Unexpected token error when using d3.js?

when I refer to d3.js, I am getting the error

Uncaught SyntaxError: Unexpected token ILLEGAL
bar.html:27 Uncaught ReferenceError: d3 is not defined

 var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
  function d3_sgn(x) {
    return x > 0 ? 1 : x < 0 ? -1 : 0;
  }

when I refer o d3.min.js, everything is fine. But I need to refer to d3.js for debugging purpose, please help.

Upvotes: 1

Views: 2209

Answers (1)

user1971598
user1971598

Reputation:

You need to include <meta charset="utf-8"> in your HTML. d3 uses some special math symbols that aren't available in plain ASCII so you need to tell the browser to use UTF-8.

(for examples see the definition of d3.random.normal, line 7396 in 3.5)

Upvotes: 3

Related Questions