| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9"> |
| 5 | <title>out of order</title> |
| 6 | <!--[if IE]> |
| 7 | <script type="text/javascript" src="../excanvas.js"></script> |
| 8 | <![endif]--> |
| 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 | |
| 15 | <script type="text/javascript" src="http://www.google.com/jsapi"></script> |
| 16 | <script type="text/javascript"> |
| 17 | // Capture warnings, since these are what we want in this test. |
| 18 | Dygraph.prototype.warn = function(msg) { |
| 19 | console.log(msg); |
| 20 | }; |
| 21 | |
| 22 | google.load('visualization', '1'); |
| 23 | |
| 24 | function createDataTable(dateType) { |
| 25 | data = new google.visualization.DataTable(); |
| 26 | data.addColumn(dateType, 'Date'); |
| 27 | data.addColumn('number', 'Column A'); |
| 28 | data.addColumn('number', 'Column B'); |
| 29 | data.addRows(4); |
| 30 | data.setCell(0, 0, new Date("2009/07/15")); |
| 31 | data.setCell(0, 1, 3); |
| 32 | data.setCell(0, 2, 3); |
| 33 | data.setCell(1, 0, new Date("2009/07/22")); |
| 34 | data.setCell(1, 1, 4); |
| 35 | data.setCell(1, 2, 0); |
| 36 | data.setCell(2, 0, new Date("2009/07/08")); |
| 37 | data.setCell(2, 1, 2); |
| 38 | data.setCell(2, 2, 4); |
| 39 | data.setCell(3, 0, new Date("2009/07/01")); |
| 40 | data.setCell(3, 1, 1); |
| 41 | data.setCell(3, 2, 7); |
| 42 | return data; |
| 43 | } |
| 44 | |
| 45 | var csv = |
| 46 | "Date,Column A,Column B\n" + |
| 47 | "2009/07/15,3,3\n" + |
| 48 | "2009/07/22,4,0\n" + |
| 49 | "2009/07/08,2,4\n" + |
| 50 | "2009/07/01,1,7\n"; |
| 51 | |
| 52 | function drawVisualization() { |
| 53 | data = createDataTable('date'); |
| 54 | |
| 55 | var chart = new Dygraph.GVizChart( |
| 56 | document.getElementById('dygraphs_gviz')).draw(data, { |
| 57 | }); |
| 58 | |
| 59 | var graph = new Dygraph(document.getElementById('dygraphs'), csv); |
| 60 | |
| 61 | } |
| 62 | google.setOnLoadCallback(drawVisualization); |
| 63 | </script> |
| 64 | </head> |
| 65 | <body> |
| 66 | <p>CSV data source out of order:</p> |
| 67 | <div id="dygraphs" style="width:600px; height:300px;"></div> |
| 68 | |
| 69 | <p>gviz data source out of order:</p> |
| 70 | <div id="dygraphs_gviz" style="width:600px; height:300px;"></div> |
| 71 | </body> |
| 72 | </html> |