Debian Codegraph @

tutorial/example_05.html

raw
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 font-family: Arial, Helvetica, sans-serif;
11 }
12 #chart {
13 position: relative;
14 left: 40px;
15 }
16 .rickshaw_graph .y_ticks {
17 left: 0;
18 }
19 #y_axis {
20 position: absolute;
21 top: 0;
22 bottom: 0;
23 width: 40px;
24 }
25 </style>
26
27 <div id="chart_container">
28 <div id="y_axis"></div>
29 <div id="chart"></div>
30 </div>
31
32 <script>
33 var palette = new Rickshaw.Color.Palette();
34
35 var graph = new Rickshaw.Graph( {
36 element: document.querySelector("#chart"),
37 width: 540,
38 height: 250,
39 series: [
40 {
41 name: "Northeast",
42 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 } ],
43 color: palette.color()
44 },
45 {
46 name: "Midwest",
47 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 } ],
48 color: palette.color()
49 },
50 {
51 name: "South",
52 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 } ],
53 color: palette.color()
54 },
55 {
56 name: "West",
57 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 } ],
58 color: palette.color()
59 }
60 ]
61 } );
62
63 var x_axis = new Rickshaw.Graph.Axis.Time( { graph: graph } );
64
65 var y_axis = new Rickshaw.Graph.Axis.Y( {
66 graph: graph,
67 orientation: 'left',
68 tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
69 element: document.getElementById('y_axis'),
70 } );
71
72 graph.render();
73
74 </script>