From 1459f4cd1130140eadd34de9dddf86d35deaa482 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Sun, 10 Sep 2017 01:49:32 -0400 Subject: [PATCH] dynamically generate circles --- app.js | 7 ++++++- index.html | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 372ee2b..e0a9bce 100644 --- a/app.js +++ b/app.js @@ -30,7 +30,12 @@ yDomain = d3.extent(runs, function(datum, index){ }) yScale.domain(yDomain); -d3.selectAll('circle').data(runs) +d3.select('svg').selectAll('circle') + .data(runs) + .enter() + .append('circle'); + +d3.selectAll('circle') .attr('cy', function(datum, index){ return yScale(datum.distance); }); diff --git a/index.html b/index.html index 0c0058e..c756f85 100644 --- a/index.html +++ b/index.html @@ -6,11 +6,7 @@ - - - - - +