Skip to content Skip to sidebar Skip to footer

I Unable Show The X-axis Year And Month Using D3.js

I had developed for the d3.js line graph,but unable to show the x-axis in years and months continuously. The Json object is given below: var data=[{'key':[2000,0],'value':100},{{'k

Solution 1:

You have to create an svg element and append the axis then.

  var svg = d3.select("body").append("svg")
     .attr("width", width + margin.left + margin.right)
     .attr("height", height + margin.top + margin.bottom)
     .append("g")
     .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

  svg.append("g")
    .attr("class", "x axis")
    .attr("transform", "translate(0," + height + ")")
    .attr("fill","steelblue")
    .call(xAxis);

Post a Comment for "I Unable Show The X-axis Year And Month Using D3.js"