In the image above, it appears as though, there are only two circles, but really, the middle one has had its `cx` set to 800 and its `cy` set to 0. It's overlapping the other circle in the same position.
In the image above, it appears as though, there are only two circles, but really, the middle one has had its `cx` set to 800 and its `cy` set to 0. It's overlapping the other circle in the same position.
@ -727,11 +727,11 @@ d3.select('#points').selectAll('circle') //add circles to #points group, not svg
.append('circle');
.append('circle');
```
```
![]()

If you try to delete all the circles and then add a new one, you'll get an error:
If you try to delete all the circles and then add a new one, you'll get an error:
![]()

Inside the `<svg>` click handler, let's put in a little code to handle when the user has deleted all runs and tries to add a new one:
Inside the `<svg>` click handler, let's put in a little code to handle when the user has deleted all runs and tries to add a new one:
@ -744,7 +744,7 @@ var newRun = {
}
}
```
```
![]()

Lastly, let's put in some css, so we know we're clicking on a circle:
Lastly, let's put in some css, so we know we're clicking on a circle:
@ -761,7 +761,7 @@ circle:hover {
}
}
```
```
![]()

## Drag an element
## Drag an element
@ -793,7 +793,7 @@ d3.selectAll('circle').call(dragBehavior); //attach the dragBehavior behavior to
You can now drag the circles around, but the data doesn't update:
You can now drag the circles around, but the data doesn't update:
![]()

## Update data after a drag
## Update data after a drag
@ -819,7 +819,7 @@ var dragBehavior = d3.drag()
.on('end', dragEnd);
.on('end', dragEnd);
```
```
![]()

Let's change the color of a circle while it's being dragged too:
Let's change the color of a circle while it's being dragged too:
@ -851,7 +851,7 @@ var zoom = d3.zoom() //create the zoom behavior
d3.select('svg').call(zoom); //attach the behavior to the svg element
d3.select('svg').call(zoom); //attach the behavior to the svg element
```
```
![]()

## Update axes when zooming/panning
## Update axes when zooming/panning
@ -884,7 +884,7 @@ var zoomCallback = function(){
- `bottomAxis.scale()` tells the axis to redraw itself
- `bottomAxis.scale()` tells the axis to redraw itself
- `d3.event.transform.rescaleX(xScale)` returns a value indicating how the bottom axis should rescale
- `d3.event.transform.rescaleX(xScale)` returns a value indicating how the bottom axis should rescale