From beda3ace8f67be934f6861c973e1121a19d67cbe Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Wed, 24 Aug 2016 10:29:49 -0400 Subject: [PATCH] make selection before ghost selection --- D3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/D3.md b/D3.md index 07a3fcd..7c904f0 100644 --- a/D3.md +++ b/D3.md @@ -65,7 +65,7 @@ d3.text('path', function(error, data){}); ## Data binding ```javascript -d3.selectAll('circle')//make a "ghost call" to all circles, even if there are none already +d3.select('svg').selectAll('circle')//make a "ghost call" to all circles, even if there are none already. Make sure to select the svg, or appended circles will attach to html element .data(dataArray) //joins each element in dataArray to an element in the selection .enter() //returns the sub section of dataArray that has not been matched with DOM elements .append('circle'); //creates a DOM element for each of the remaining dataArray elements