Since I'm looking for flights to California and not finding anything south of $400, let's look at the data (with thanks to @mtahani). This chart shows the quarterly average price of a plane ticket in the United States since 1995.

The data for this chart is below. A couple thoughts on making a simple line chart with D3:

I followed this blog post, with a few deviations. I started off drawing axes by hand, but in the end I used d3.svg.axis. I spent far more time than I expected making minor adjustments to color and stroke width and position.

Drawing a simple line chart really drove home the title of that blog post I just linked: D3 is not a charting library. It can be used to build charts, but for this dataset, I could have gotten to a workable solution faster (and with cross-browser support) using something like HighCharts.

That said, I'm also starting to see how D3 can be really powerful. It's a tool for describing how data should fit together. There's a certain way of thinking built into it, and understanding that is key to doing anything useful. I'm not sure how to describe that thinking just yet, but the patterns make more sense than they did a week ago.

Average US Airfare, 1995 - 2011
blog comments powered by Disqus