Why it is necessary to do the following?
- var xMax = new Date(d3.max(yearsDate))
- var xMax = d3.max(yearsDate) // since yearsDate elements are dates
Note: I tried option 2) and the last bar is detached from the other bars but when doing option 1) it worked - all bars are together.
So, why it is necessary to use new Date with d.max() even though the value returned by d.max() is a date - isn’t it?
Your code so far
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62
Challenge: Visualize Data with a Bar Chart
Link to the challenge: