Merge branch 'master' of https://github.com/kberg/dygraphs
[dygraphs.git] / tests / gviz-infinity.html
1 <html>
2 <head>
3 <title>gviz</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', {packages: ['linechart']});
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/01"));
22 data.setCell(0, 1, 1);
23 data.setCell(0, 2, 7);
24 data.setCell(1, 0, new Date("2009/07/08"));
25 data.setCell(1, 1, 2);
26 data.setCell(1, 2, 4);
27 data.setCell(2, 0, new Date("2009/07/15"));
28 data.setCell(2, 1, 3);
29 data.setCell(2, 2, Infinity);
30 data.setCell(3, 0, new Date("2009/07/22"));
31 data.setCell(3, 1, 4);
32 data.setCell(3, 2, 0);
33 return data;
34 }
35
36 function drawVisualization() {
37 data = createDataTable('date');
38 new google.visualization.LineChart(
39 document.getElementById('gviz')).draw(data, null);
40
41 new Dygraph.GVizChart(document.getElementById('dygraphs'))
42 .draw(data, { });
43
44 data = createDataTable('datetime');
45 new Dygraph.GVizChart(
46 document.getElementById('dygraphs_datetime')).draw(data, {
47 });
48 }
49
50 google.setOnLoadCallback(drawVisualization);
51 </script>
52 </head>
53 <body>
54 <p>This tests that infinite values don't break dygraphs.</p>
55 <p>gviz line chart:</p>
56 <div id="gviz" style="width:600px; height:300px;"></div>
57
58 <p>same data drawn using dygraphs:</p>
59 date column:
60 <div id="dygraphs" style="width:600px; height:300px;"></div>
61 </body>
62 </html>