master
Matt Huntington 9 years ago
parent e2ae1e4556
commit 94cbc7ad38

31
D3.md

@ -192,35 +192,14 @@ formatTime(new Date()); //returns a string in the above format
## Axes
- Create the x axis
```javascript
var xAxis = d3.svg.axis();
```
- Associate the scale with the axis
```javascript
xAxis.scale(xScale);
```
- Set where on the graph the axis should appear
```javascript
xAxis.orient('bottom');
```
- Set the number of ticks
```javascript
xAxis.ticks(8);
var leftAxis = d3.axisLeft(yScale); //create a left axis based on the yScale
d3.select('svg')
.append('g') //append a group element
.call(leftAxis); //apply the axis to it
```
- Append a group containing the axis after data has populated the scale
```javascript
viz.append('g').call(yAxis);
```
Different types of axes: https://github.com/d3/d3-axis#axisTop
## Events

Loading…
Cancel
Save