Added idx parameter to option-reference
[dygraphs.git] / tests / gviz.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
5 <title>gviz</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 google.load('visualization', '1', {packages: ['linechart']});
18
19 function createDataTable(dateType) {
20 data = new google.visualization.DataTable();
21 data.addColumn(dateType, 'Date');
22 data.addColumn('number', 'Column A');
23 data.addColumn('number', 'Column B');
24 data.addRows(4);
25 data.setCell(0, 0, new Date("2009/07/01"));
26 data.setCell(0, 1, 1);
27 data.setCell(0, 2, 7);
28 data.setCell(1, 0, new Date("2009/07/08"));
29 data.setCell(1, 1, 2);
30 data.setCell(1, 2, 4);
31 data.setCell(2, 0, new Date("2009/07/15"));
32 data.setCell(2, 1, 3);
33 data.setCell(2, 2, 3);
34 data.setCell(3, 0, new Date("2009/07/22"));
35 data.setCell(3, 1, 4);
36 data.setCell(3, 2, 0);
37 return data;
38 }
39
40 function drawVisualization() {
41 data = createDataTable('date');
42 new google.visualization.LineChart(
43 document.getElementById('gviz')).draw(data, null);
44
45 var chart1 = new Dygraph.GVizChart(
46 document.getElementById('dygraphs')).draw(data, {
47 });
48
49 data = createDataTable('datetime');
50 var chart2 = new Dygraph.GVizChart(
51 document.getElementById('dygraphs_datetime')).draw(data, {
52 });
53
54
55 }
56 google.setOnLoadCallback(drawVisualization);
57 </script>
58 </head>
59 <body>
60 <p>gviz line chart:</p>
61 <div id="gviz" style="width:600px; height:300px;"></div>
62
63 <p>same data drawn using dygraphs:</p>
64 date column:
65 <div id="dygraphs" style="width:600px; height:300px;"></div>
66 datetime column:
67 <div id="dygraphs_datetime" style="width:600px; height:300px;"></div>
68 </body>
69 </html>