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