There will always be a single <path> element, so no need to handle enter, update
and exit cases.  WebKit seems to erroneously warn (in the error console) that it
can't parse `d=""`.  I can't see anything in the SVG spec disallowing an empty
`d` attribute so I think this is safe to ignore.
This commit is contained in:
Jason Davies 2011-04-29 10:14:15 +01:00
Родитель 3e72f75f3e
Коммит 1c2546050f
1 изменённых файлов: 4 добавлений и 9 удалений

Просмотреть файл

@ -28,18 +28,13 @@ var line = d3.svg.line()
.x(function(d) { return d[0]; }) .x(function(d) { return d[0]; })
.y(function(d) { return d[1]; }); .y(function(d) { return d[1]; });
var path = vis.append("svg:path")
.data([points])
.attr("class", "line");
function update() { function update() {
var path = vis.selectAll("path")
.data(points.length ? [points] : []);
path.enter().append("svg:path")
.attr("class", "line")
.attr("d", line);
path.attr("d", line); path.attr("d", line);
path.exit().remove();
var circle = vis.selectAll("circle") var circle = vis.selectAll("circle")
.data(points, function(d) { return d; }); .data(points, function(d) { return d; });