0

Trying to create a bar chart with Time type on x axis. I want to only display few ticks on x axis. Below is a small portion of the code. After reading many posts online, I realized I need to use tickValues and also to Time format them. However, still getting a messy x axis. what I am doing wrong?

var parseDate = d3.timeParse("%Y");
g.append("g")
         .attr("transform", "translate(0," + height + ")")
         .call(d3.axisBottom(xScale)
         .tickValues(parseDate(["1890","2000"])))
         .append("text")
         .attr("y", height - 250)
         .attr("x", width - 100)
         .attr("text-anchor", "end")
         .attr("stroke", "black")
         .text("Year");

enter image description here

baharak Al
  • 71
  • 1
  • 10

0 Answers0