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