- Stop charts with no visible plots from crashing.
[dygraphs.git] / tests / out-of-order.html
1 <html>
2 <head>
3 <title>out of order</title>
4 <!--[if IE]>
5 <script type="text/javascript" src="../excanvas.js"></script>
6 <![endif]-->
7 <script type="text/javascript" src="../strftime/strftime-min.js"></script>
8 <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script>
9 <script type="text/javascript" src="../dygraph-canvas.js"></script>
10 <script type="text/javascript" src="../dygraph.js"></script>
11 <script type="text/javascript" src="http://www.google.com/jsapi"></script>
12 <script type="text/javascript">
13 google.load('visualization', '1');
14
15 function createDataTable(dateType) {
16 data = new google.visualization.DataTable();
17 data.addColumn(dateType, 'Date');
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/15"));
22 data.setCell(0, 1, 3);
23 data.setCell(0, 2, 3);
24 data.setCell(1, 0, new Date("2009/07/22"));
25 data.setCell(1, 1, 4);
26 data.setCell(1, 2, 0);
27 data.setCell(2, 0, new Date("2009/07/08"));
28 data.setCell(2, 1, 2);
29 data.setCell(2, 2, 4);
30 data.setCell(3, 0, new Date("2009/07/01"));
31 data.setCell(3, 1, 1);
32 data.setCell(3, 2, 7);
33 return data;
34 }
35
36 var csv =
37 "Date,Column A,Column B\n" +
38 "2009/07/15,3,3\n" +
39 "2009/07/22,4,0\n" +
40 "2009/07/08,2,4\n" +
41 "2009/07/01,1,7\n";
42
43 function drawVisualization() {
44 data = createDataTable('date');
45
46 new Dygraph.GVizChart(
47 document.getElementById('dygraphs_gviz')).draw(data, {
48 });
49
50 new Dygraph(document.getElementById('dygraphs'), csv);
51
52 }
53 google.setOnLoadCallback(drawVisualization);
54 </script>
55 </head>
56 <body>
57 <p>CSV data source out of order:</p>
58 <div id="dygraphs" style="width:600px; height:300px;"></div>
59
60 <p>gviz data source out of order:</p>
61 <div id="dygraphs_gviz" style="width:600px; height:300px;"></div>
62 </body>
63 </html>