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