Merge pull request #678 from danvk/dygraphs-css
[dygraphs.git] / tests / gviz.html
CommitLineData
54425b14 1<!DOCTYPE html>
79420a1e
DV
2<html>
3 <head>
93a5bb4c 4 <link rel="stylesheet" href="../css/dygraph.css">
fd2a2ee2 5 <title>gviz</title>
7e5ddc94
DV
6 <!--
7 For production (minified) code, use:
8 <script type="text/javascript" src="dygraph-combined.js"></script>
9 -->
fbd6834a 10 <script type="text/javascript" src="../dist/dygraph.js"></script>
7e5ddc94 11
79420a1e
DV
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
c21d2c2d 16 function createDataTable(dateType) {
79420a1e 17 data = new google.visualization.DataTable();
c21d2c2d 18 data.addColumn(dateType, 'Date');
79420a1e
DV
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);
c21d2c2d 34 return data;
35 }
79420a1e 36
c21d2c2d 37 function drawVisualization() {
8114048a 38 data = createDataTable('date');
79420a1e 39 new google.visualization.LineChart(
c21d2c2d 40 document.getElementById('gviz')).draw(data, null);
79420a1e 41
f6fbf9e0 42 var chart1 = new Dygraph.GVizChart(
3e3f84e4 43 document.getElementById('dygraphs')).draw(data, {
3e3f84e4 44 });
c21d2c2d 45
46 data = createDataTable('datetime');
f6fbf9e0 47 var chart2 = new Dygraph.GVizChart(
c21d2c2d 48 document.getElementById('dygraphs_datetime')).draw(data, {
49 });
50
51
79420a1e
DV
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>
c21d2c2d 61 date column:
79420a1e 62 <div id="dygraphs" style="width:600px; height:300px;"></div>
c21d2c2d 63 datetime column:
64 <div id="dygraphs_datetime" style="width:600px; height:300px;"></div>
79420a1e
DV
65 </body>
66</html>