score:0

Accepted answer

You will have to add the axis using d3.scale function. See this plnkr for working example.

  //add x and y axis
  var x = d3.scale.linear()
    .range([0, 950]);

  var y = d3.scale.linear()
    .range([200, 0]);

  var xAxis = d3.svg.axis()
    .scale(x)
    .orient("bottom");

  var yAxis = d3.svg.axis()
    .scale(y)
    .orient("left");

  x.domain([0, 950]);

  y.domain([0, 7]);

  svg.append("g")
    .attr("class", "x axis")
    .attr("transform", "translate(20,250)")
    .call(xAxis);

  svg.append("g")
    .attr("class", "y axis")
    .attr("transform", "translate(20,30)")
    .call(yAxis);

Related Query

More Query from same tag