| 1 |
<!doctype> |
| 2 |
<link type="text/css" rel="stylesheet" href="../rickshaw.min.css"> |
| 3 |
<script src="../vendor/d3.min.js"></script> |
| 4 |
<script src="../vendor/d3.layout.min.js"></script> |
| 5 |
<script src="../rickshaw.min.js"></script> |
| 6 |
|
| 7 |
<style> |
| 8 |
#chart_container { |
| 9 |
position: relative; |
| 10 |
display: inline-block; |
| 11 |
font-family: Arial, Helvetica, sans-serif; |
| 12 |
} |
| 13 |
#chart { |
| 14 |
display: inline-block; |
| 15 |
margin-left: 40px; |
| 16 |
} |
| 17 |
#y_axis { |
| 18 |
position: absolute; |
| 19 |
top: 0; |
| 20 |
bottom: 0; |
| 21 |
width: 40px; |
| 22 |
} |
| 23 |
#legend { |
| 24 |
display: inline-block; |
| 25 |
vertical-align: top; |
| 26 |
margin: 0 0 0 10px; |
| 27 |
} |
| 28 |
</style> |
| 29 |
|
| 30 |
<div id="chart_container"> |
| 31 |
<div id="y_axis"></div> |
| 32 |
<div id="chart"></div> |
| 33 |
</div> |
| 34 |
<div id="legend"></div> |
| 35 |
|
| 36 |
<script> |
| 37 |
var palette = new Rickshaw.Color.Palette(); |
| 38 |
|
| 39 |
var graph = new Rickshaw.Graph( { |
| 40 |
element: document.querySelector("#chart"), |
| 41 |
width: 550, |
| 42 |
height: 250, |
| 43 |
series: [ |
| 44 |
{ |
| 45 |
name: "Northeast", |
| 46 |
data: [ { x: -1893456000, y: 25868573 }, { x: -1577923200, y: 29662053 }, { x: -1262304000, y: 34427091 }, { x: -946771200, y: 35976777 }, { x: -631152000, y: 39477986 }, { x: -315619200, y: 44677819 }, { x: 0, y: 49040703 }, { x: 315532800, y: 49135283 }, { x: 631152000, y: 50809229 }, { x: 946684800, y: 53594378 }, { x: 1262304000, y: 55317240 } ], |
| 47 |
color: palette.color() |
| 48 |
}, |
| 49 |
{ |
| 50 |
name: "Midwest", |
| 51 |
data: [ { x: -1893456000, y: 29888542 }, { x: -1577923200, y: 34019792 }, { x: -1262304000, y: 38594100 }, { x: -946771200, y: 40143332 }, { x: -631152000, y: 44460762 }, { x: -315619200, y: 51619139 }, { x: 0, y: 56571663 }, { x: 315532800, y: 58865670 }, { x: 631152000, y: 59668632 }, { x: 946684800, y: 64392776 }, { x: 1262304000, y: 66927001 } ], |
| 52 |
color: palette.color() |
| 53 |
}, |
| 54 |
{ |
| 55 |
name: "South", |
| 56 |
data: [ { x: -1893456000, y: 29389330 }, { x: -1577923200, y: 33125803 }, { x: -1262304000, y: 37857633 }, { x: -946771200, y: 41665901 }, { x: -631152000, y: 47197088 }, { x: -315619200, y: 54973113 }, { x: 0, y: 62795367 }, { x: 315532800, y: 75372362 }, { x: 631152000, y: 85445930 }, { x: 946684800, y: 100236820 }, { x: 1262304000, y: 114555744 } ], |
| 57 |
color: palette.color() |
| 58 |
}, |
| 59 |
{ |
| 60 |
name: "West", |
| 61 |
data: [ { x: -1893456000, y: 7082086 }, { x: -1577923200, y: 9213920 }, { x: -1262304000, y: 12323836 }, { x: -946771200, y: 14379119 }, { x: -631152000, y: 20189962 }, { x: -315619200, y: 28053104 }, { x: 0, y: 34804193 }, { x: 315532800, y: 43172490 }, { x: 631152000, y: 52786082 }, { x: 946684800, y: 63197932 }, { x: 1262304000, y: 71945553 } ], |
| 62 |
color: palette.color() |
| 63 |
} |
| 64 |
] |
| 65 |
} ); |
| 66 |
|
| 67 |
var x_axis = new Rickshaw.Graph.Axis.Time( { graph: graph } ); |
| 68 |
|
| 69 |
var y_axis = new Rickshaw.Graph.Axis.Y( { |
| 70 |
graph: graph, |
| 71 |
orientation: 'left', |
| 72 |
tickFormat: Rickshaw.Fixtures.Number.formatKMBT, |
| 73 |
element: document.getElementById('y_axis'), |
| 74 |
} ); |
| 75 |
|
| 76 |
var legend = new Rickshaw.Graph.Legend( { |
| 77 |
element: document.querySelector('#legend'), |
| 78 |
graph: graph |
| 79 |
} ); |
| 80 |
|
| 81 |
graph.render(); |
| 82 |
|
| 83 |
</script> |