There is a time to struggle and a time to ask for help. D3 has gotten the best of me. I’m sure it is something simple, but I don’t have my bearings in the language enough to figure out what the problem is. I tried a good bit of debugging and have verified everything I can think of: The dates are in the correct format The line has a width and renders with different values The data is making it all the way through the functions There are no errors blocking the script The x-axis range matches the data I decided to turn to stackoverflow for help and posted a question asking about why my lines aren’t showing up. Hopefully some kind soul will take mercy on me and point me in the right direction. In the mean time I’m going to populate the rest of my data into the
Tonight I changed my approach, at the advice of Sean Conaty, and decided to turn the CSVs into JSON using a separate python script that I would then load into D3 to visualize. I am much better at manipulating data in python, so this approach should help eliminate some of the frustration I faced last week trying to get the CSVs to load properly. Separating the way the data is stored from the format it is accessed in will let us take advantage of the best aspects of each. This is how many internal APIs work. I would consider this more of a hacked API as the script runs locally and I will only run it when I update the CSV. Overall it seemed to work pretty well. I am now looping over the correct teams and have the data in a usable format. The on thing holding me up is that
Continuing what I’ve been working on lately – tonight I’m going to try and get all of the data loaded for my NFL chart and hopefully get the javascript to automatically loop through and chart each team’s record. Refactoring As I dove in tonight I realized that the way I was doing things wasn’t going to work. D3.csv() loops over every row in the csv that is loaded and performs the described operations on it. I was looping over the season data which meant that I was doing things hundreds of times rather than 32. I decided to refactor my code so that I now loop over the team data csv and then for each team go pull the season data as part of the process. The first roadblock I hit was that javascript data types are a bit strange. It took me a lot of trial & error to
Picking up where I last left off, today I’m going to try to make progress on my NFL history chart. Specifically, I would like to implement a javascript function that parses the data and splits it by team, graphing a new line for each. If time allows I would also like to pull in the data for each team and define the colors. Two charts that I’ve drawn inspiration from as I’ve been working on this are the New York Times housing prices graphic and the Feathersquare chart of Oxford Summer Eight” bump race results. The first is beautiful and second is fairly contextually similar. Hopefully this NFL graphic can hold a candle to them when it is all done. Team Colors One idea I had was to have the color of each team’s line be one of the team’s official colors. I was hoping to be able to pull this