oesmith/morris.js — Issue #1: Issues with Periods for Graph
Author: talkingwithsean
Created: 2012-02-22 15:16:40+00:00
State: open

I'm trying to make a line graph of two variables, a truancy rate and the number of absences for that month. Right now, it's being displayed as this:

~~~~~~~~~~~~~~~~
tax_data = [
{"period": "2011-09", "trate": 46, "absent": 11},
{"period": "2011-12", "trate": 50, "absent": 1},
{"period": "2012-01", "trate": 20, "absent": 1},
{"period": "2012-02", "trate": 33, "absent": 1},

];
~~~~~~~~~~~~~~~~

The way you have the period being parsed is with `parse_year()`. I tried to modify the parse year to return almost the same as what you did for the "2011 Q3" periods:

~~~~~~~~~~~~~~~~
function parse_year(year)
{
var e = year.split('-');
return parseInt(e[0], 10) + (parseInt(e[1], 19) * 11 - 1) / 12;
}
~~~~~~~~~~~~~~~~~~

But it doesn't come out so well:
![as you can see](http://f.cl.ly/items/3h1N2C2x0Y2s1E3S1w2E/Screen%20Shot%202012-02-22%20at%2010.15.02%20AM.png)

How would you approach this one? This is the way I have my old graph:

![old graph](http://f.cl.ly/items/0Z3k3A2L2E3R0V0T163j/Screen%20Shot%202012-02-22%20at%2010.15.57%20AM.png)

But it doesn't look or feel as nice as the one from morris.js.