forked from google/google-visualization-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_example.html
More file actions
45 lines (40 loc) · 1.95 KB
/
Copy pathstatic_example.html
File metadata and controls
45 lines (40 loc) · 1.95 KB
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
<html>
<head>
<title>Static example</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script>
google.load("visualization", "1", {packages:["table"]});
google.setOnLoadCallback(drawTable);
function drawTable() {
var jscode_data = new google.visualization.DataTable();
jscode_data.addColumn("string", "Name", "name");
jscode_data.addColumn("number", "Salary", "salary");
jscode_data.addColumn("boolean", "Full Time Employee", "full_time");
jscode_data.addRows(4);
jscode_data.setCell(0, 0, "Alice");
jscode_data.setCell(0, 1, 12500, "$12,500");
jscode_data.setCell(0, 2, true);
jscode_data.setCell(1, 0, "Mike");
jscode_data.setCell(1, 1, 10000, "$10,000");
jscode_data.setCell(1, 2, true);
jscode_data.setCell(2, 0, "Bob");
jscode_data.setCell(2, 1, 7000, "$7,000");
jscode_data.setCell(2, 2, true);
jscode_data.setCell(3, 0, "Jim");
jscode_data.setCell(3, 1, 800, "$800");
jscode_data.setCell(3, 2, false);
var jscode_table = new google.visualization.Table(document.getElementById('table_div_jscode'));
jscode_table.draw(jscode_data, {showRowNumber: true});
var json_table = new google.visualization.Table(document.getElementById('table_div_json'));
var json_data = new google.visualization.DataTable(b'{"rows":[{"c":[{"v":"Alice"},{"f":"$12,500","v":12500},{"v":true}]},{"c":[{"v":"Mike"},{"f":"$10,000","v":10000},{"v":true}]},{"c":[{"v":"Bob"},{"f":"$7,000","v":7000},{"v":true}]},{"c":[{"v":"Jim"},{"f":"$800","v":800},{"v":false}]}],"cols":[{"type":"string","label":"Name","id":"name"},{"type":"number","label":"Salary","id":"salary"},{"type":"boolean","label":"Full Time Employee","id":"full_time"}]}', 0.5);
json_table.draw(json_data, {showRowNumber: true});
}
</script>
</head>
<body>
<H1>Table created using ToJSCode</H1>
<div id="table_div_jscode"></div>
<H1>Table created using ToJSon</H1>
<div id="table_div_json"></div>
</body>
</html>