Merge branch 'master' of https://github.com/kberg/dygraphs
[dygraphs.git] / tests / gviz.html
CommitLineData
54425b14 1<!DOCTYPE html>
79420a1e
DV
2<html>
3 <head>
10494b48 4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
fd2a2ee2 5 <title>gviz</title>
79420a1e 6 <!--[if IE]>
a2b2c3a1 7 <script type="text/javascript" src="../excanvas.js"></script>
79420a1e 8 <![endif]-->
d37dca40
DV
9 <script type="text/javascript" src="../strftime/strftime-min.js"></script>
10 <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script>
285a6bda 11 <script type="text/javascript" src="../dygraph-canvas.js"></script>
79420a1e
DV
12 <script type="text/javascript" src="../dygraph.js"></script>
13 <script type="text/javascript" src="http://www.google.com/jsapi"></script>
14 <script type="text/javascript">
15 google.load('visualization', '1', {packages: ['linechart']});
16
c21d2c2d 17 function createDataTable(dateType) {
79420a1e 18 data = new google.visualization.DataTable();
c21d2c2d 19 data.addColumn(dateType, 'Date');
79420a1e
DV
20 data.addColumn('number', 'Column A');
21 data.addColumn('number', 'Column B');
22 data.addRows(4);
23 data.setCell(0, 0, new Date("2009/07/01"));
24 data.setCell(0, 1, 1);
25 data.setCell(0, 2, 7);
26 data.setCell(1, 0, new Date("2009/07/08"));
27 data.setCell(1, 1, 2);
28 data.setCell(1, 2, 4);
29 data.setCell(2, 0, new Date("2009/07/15"));
30 data.setCell(2, 1, 3);
31 data.setCell(2, 2, 3);
32 data.setCell(3, 0, new Date("2009/07/22"));
33 data.setCell(3, 1, 4);
34 data.setCell(3, 2, 0);
c21d2c2d 35 return data;
36 }
79420a1e 37
c21d2c2d 38 function drawVisualization() {
39 data = createDataTable('date');
79420a1e 40 new google.visualization.LineChart(
c21d2c2d 41 document.getElementById('gviz')).draw(data, null);
79420a1e 42
285a6bda 43 new Dygraph.GVizChart(
3e3f84e4 44 document.getElementById('dygraphs')).draw(data, {
3e3f84e4 45 });
c21d2c2d 46
47 data = createDataTable('datetime');
48 new Dygraph.GVizChart(
49 document.getElementById('dygraphs_datetime')).draw(data, {
50 });
51
52
79420a1e
DV
53 }
54 google.setOnLoadCallback(drawVisualization);
55 </script>
56 </head>
57 <body>
58 <p>gviz line chart:</p>
59 <div id="gviz" style="width:600px; height:300px;"></div>
60
61 <p>same data drawn using dygraphs:</p>
c21d2c2d 62 date column:
79420a1e 63 <div id="dygraphs" style="width:600px; height:300px;"></div>
c21d2c2d 64 datetime column:
65 <div id="dygraphs_datetime" style="width:600px; height:300px;"></div>
79420a1e
DV
66 </body>
67</html>