I am using d3's built in .csv
method to get the data.
I save the data file url directly as a constant for right now. Later, I'm planning to provide an array or object with data urls (or use Github API to get them) so we can loop through each data file and generate the graph for each.
I update some of the fields in the JS (not the original file) to make them easier to work with:
- make the number fields number type
- Change 'seasonally adjusted' to true and 'unadjusted' to false for easy conditionals
- Format the dates using the month column and some math from my formatDates.js util
Data gets added to the graph SVG four times as 4 different line elements: Unadjusted/Final ('unprojected'), Seasonally adjusted/Final, Unadjusted & Projected, Seasonally adjusted & Projected.
Calculate which months are projected data (=6 months of the data starting with the last month provided).