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