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