1

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.

3
  • 1
    Do you have <meta charset="utf-8"> in your html? Commented Mar 29, 2015 at 4:25
  • "d3 is not defined" probably means that you're failing to load d3.v3.js. Make sure that the URL is correct, or if you're not connected to the Internet, make sure that the path to the local copy of the file is correct. Commented Mar 29, 2015 at 5:06
  • @Edgar Aroutiounian, you are right. Please make it answer. BTW, why adding this solve the issue? Commented Mar 29, 2015 at 10:40

1 Answer 1

3

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)

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.