diff --git a/D3.md b/D3.md index 8cae0b9..6af52c4 100644 --- a/D3.md +++ b/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); - ``` - -- Append a group containing the axis after data has populated the scale +```javascript +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 +``` - ```javascript - viz.append('g').call(yAxis); - ``` +Different types of axes: https://github.com/d3/d3-axis#axisTop ## Events