forked from danvk/dygraphs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gviz.html
69 lines (61 loc) · 2.21 KB
/
gviz.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
<title>gviz</title>
<!--[if IE]>
<script type="text/javascript" src="../excanvas.js"></script>
<![endif]-->
<!--
For production (minified) code, use:
<script type="text/javascript" src="dygraph-combined.js"></script>
-->
<script type="text/javascript" src="../dygraph-dev.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['linechart']});
function createDataTable(dateType) {
data = new google.visualization.DataTable();
data.addColumn(dateType, 'Date');
data.addColumn('number', 'Column A');
data.addColumn('number', 'Column B');
data.addRows(4);
data.setCell(0, 0, new Date("2009/07/01"));
data.setCell(0, 1, 1);
data.setCell(0, 2, 7);
data.setCell(1, 0, new Date("2009/07/08"));
data.setCell(1, 1, 2);
data.setCell(1, 2, 4);
data.setCell(2, 0, new Date("2009/07/15"));
data.setCell(2, 1, 3);
data.setCell(2, 2, 3);
data.setCell(3, 0, new Date("2009/07/22"));
data.setCell(3, 1, 4);
data.setCell(3, 2, 0);
return data;
}
function drawVisualization() {
data = createDataTable('date');
new google.visualization.LineChart(
document.getElementById('gviz')).draw(data, null);
var chart1 = new Dygraph.GVizChart(
document.getElementById('dygraphs')).draw(data, {
});
data = createDataTable('datetime');
var chart2 = new Dygraph.GVizChart(
document.getElementById('dygraphs_datetime')).draw(data, {
});
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<p>gviz line chart:</p>
<div id="gviz" style="width:600px; height:300px;"></div>
<p>same data drawn using dygraphs:</p>
date column:
<div id="dygraphs" style="width:600px; height:300px;"></div>
datetime column:
<div id="dygraphs_datetime" style="width:600px; height:300px;"></div>
</body>
</html>