I’m losing my mind over finishing my first D3 project to visualize the US GDP bar chart (https://codepen.io/spreeni/pen/bQwoGN). I can’t get my x-axis to display just ticks for every 5 years or so. Right now it just takes the automatically chosen ticks and they’re not very pretty. Two of the test cases also keep failing, apparently
- The bar elements’ “data-date” properties don’t match the order of the provided data
- The data-date attribute and its corresponding bar element don’t align with the corresponding value on the x-axis.
Which implies that my scaling for my xAxis is off I guess, but I can’t find a mistake.
And for the tick problem, I have tried multiple things to costumize the ticks, including
xAxis.ticks(d3.timeYear,5) xAxis.ticks(d3.timeYear.every(5)) xAxis.ticks(d3.timeYear.every(5).range(new Date(1950, 0, 1), new Date(2015, 0, 1)))
but nothing seems to work.
Would be extremely grateful for any help!