Commit | Line | Data |
---|---|---|
79420a1e DV |
1 | <html> |
2 | <head> | |
fd2a2ee2 | 3 | <title>gviz</title> |
79420a1e DV |
4 | <!--[if IE]> |
5 | <script type="text/javascript" src="excanvas.js"></script> | |
6 | <![endif]--> | |
7 | <script type="text/javascript" src="../dygraph-combined.js"></script> | |
285a6bda | 8 | <script type="text/javascript" src="../dygraph-canvas.js"></script> |
79420a1e DV |
9 | <script type="text/javascript" src="../dygraph.js"></script> |
10 | <script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
11 | <script type="text/javascript"> | |
12 | google.load('visualization', '1', {packages: ['linechart']}); | |
13 | ||
c21d2c2d | 14 | function createDataTable(dateType) { |
79420a1e | 15 | data = new google.visualization.DataTable(); |
c21d2c2d | 16 | data.addColumn(dateType, 'Date'); |
79420a1e DV |
17 | data.addColumn('number', 'Column A'); |
18 | data.addColumn('number', 'Column B'); | |
19 | data.addRows(4); | |
20 | data.setCell(0, 0, new Date("2009/07/01")); | |
21 | data.setCell(0, 1, 1); | |
22 | data.setCell(0, 2, 7); | |
23 | data.setCell(1, 0, new Date("2009/07/08")); | |
24 | data.setCell(1, 1, 2); | |
25 | data.setCell(1, 2, 4); | |
26 | data.setCell(2, 0, new Date("2009/07/15")); | |
27 | data.setCell(2, 1, 3); | |
28 | data.setCell(2, 2, 3); | |
29 | data.setCell(3, 0, new Date("2009/07/22")); | |
30 | data.setCell(3, 1, 4); | |
31 | data.setCell(3, 2, 0); | |
c21d2c2d | 32 | return data; |
33 | } | |
79420a1e | 34 | |
c21d2c2d | 35 | function drawVisualization() { |
36 | data = createDataTable('date'); | |
79420a1e | 37 | new google.visualization.LineChart( |
c21d2c2d | 38 | document.getElementById('gviz')).draw(data, null); |
79420a1e | 39 | |
285a6bda | 40 | new Dygraph.GVizChart( |
3e3f84e4 | 41 | document.getElementById('dygraphs')).draw(data, { |
3e3f84e4 | 42 | }); |
c21d2c2d | 43 | |
44 | data = createDataTable('datetime'); | |
45 | new Dygraph.GVizChart( | |
46 | document.getElementById('dygraphs_datetime')).draw(data, { | |
47 | }); | |
48 | ||
49 | ||
79420a1e DV |
50 | } |
51 | google.setOnLoadCallback(drawVisualization); | |
52 | </script> | |
53 | </head> | |
54 | <body> | |
55 | <p>gviz line chart:</p> | |
56 | <div id="gviz" style="width:600px; height:300px;"></div> | |
57 | ||
58 | <p>same data drawn using dygraphs:</p> | |
c21d2c2d | 59 | date column: |
79420a1e | 60 | <div id="dygraphs" style="width:600px; height:300px;"></div> |
c21d2c2d | 61 | datetime column: |
62 | <div id="dygraphs_datetime" style="width:600px; height:300px;"></div> | |
79420a1e DV |
63 | </body> |
64 | </html> |