| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
| 5 | <title>gviz</title> |
| 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
| 7 | |
| 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 | |
| 12 | function createDataTable(dateType) { |
| 13 | data = new google.visualization.DataTable(); |
| 14 | data.addColumn(dateType, 'Date'); |
| 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); |
| 30 | return data; |
| 31 | } |
| 32 | |
| 33 | function drawVisualization() { |
| 34 | data = createDataTable('date'); |
| 35 | new google.visualization.LineChart( |
| 36 | document.getElementById('gviz')).draw(data, null); |
| 37 | |
| 38 | var chart1 = new Dygraph.GVizChart( |
| 39 | document.getElementById('dygraphs')).draw(data, { |
| 40 | }); |
| 41 | |
| 42 | data = createDataTable('datetime'); |
| 43 | var chart2 = new Dygraph.GVizChart( |
| 44 | document.getElementById('dygraphs_datetime')).draw(data, { |
| 45 | }); |
| 46 | |
| 47 | |
| 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> |
| 57 | date column: |
| 58 | <div id="dygraphs" style="width:600px; height:300px;"></div> |
| 59 | datetime column: |
| 60 | <div id="dygraphs_datetime" style="width:600px; height:300px;"></div> |
| 61 | </body> |
| 62 | </html> |