-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
No matter how carefully you develop your code, as it grows, bugs will eventually find a way to silently creep into it. They are easy to fix when the browser complains with an error message, but can be quite challenging when you have a blank screen and a blank console. In this section, we will discuss some common bugs, how to avoid them, and how to catch and fix them when they occur.
Although they have different causes, the bugs described in this section may produce the same visual result. In both, the join process works as expected; the selection objects are populated correctly, no error messages are displayed, but the elements aren’t rendered.
The first bug is shown here (see Debugging/1-data-join-bug-1.html):
d3.select("svg")
.selectAll(".dot")
.data([18,15,9,3,15,18])
.join("circle"); Can you spot the problem? This code will run when the page currently contains and displays...