-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.html
61 lines (48 loc) · 1.98 KB
/
examples.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./examples.css">
<script type="text/javascript" src="./dependencies/jquery-2.1.3.js"></script>
<script type="text/javascript" src="./dependencies/underscore.js"></script>
<script type="text/javascript" src="./dependencies/d3/d3.js"></script>
<script type="text/javascript" src="./dependencies/d3/d3.chart.js"></script>
<script type="text/javascript" src="./ezChartsConfig.js"></script>
<script type="text/javascript" src="./charts/genericBars.js"></script>
<script type="text/javascript" src="./charts/genericDonut.js"></script>
<script type="text/javascript" src="./aggregToDonutPlugin.js"></script>
</head>
<body>
<div class="chart"></div>
<script type="text/javascript">
var chart = d3.select('.chart')
.append('svg')
.attr('width', 700)
.attr('height', 400)
.chart('genericBars');
var data = [
{id: 0, label: "Organic Abandonners", val: 350},
{id: 1, label: "Retargeted Abandonners", val: 20},
{id: 2, label: "Reengaged People", val: 10},
{id: 3, label: "Tiny Val", val: 5},
{id: 4, label: "Tiny Val 2", val: 3},
{id: 5, label: "Tiny Val 3", val: 2},
{id: 6, label: "Tiny Val 4", val: 1},
];
chart.draw(data);
function rdmData(){
var data = [
{id: 0, label: "Organic Abandonners", val: Math.floor(Math.random() * 500)},
{id: 1, label: "Retargeted Abandonners", val: Math.floor(Math.random() * 500)},
{id: 2, label: "Reengaged People", val: Math.floor(Math.random() * 500)},
{id: 3, label: "Tiny Val", val: Math.floor(Math.random() * 500)},
{id: 4, label: "Tiny Val 2", val: Math.floor(Math.random() * 500)},
{id: 5, label: "Tiny Val 3", val: Math.floor(Math.random() * 500)},
{id: 6, label: "Tiny Val 4", val: Math.floor(Math.random() * 500)},
];
chart.draw(data);
}
</script>
<button onclick="rdmData()">Generate Data</button>
</body>
</html>