-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSunburstTest.html
executable file
·98 lines (75 loc) · 2.38 KB
/
SunburstTest.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vizuly 2.0 - Sunburst</title>
<!-- We use google fonts for many of the examples, but they are not necessary -->
<link href='https://fonts.googleapis.com/css?family=Raleway:600,400,200' rel='stylesheet' type='text/css'>
<!-- vizuly2.specific style sheets -->
<link rel="stylesheet" href="lib/styles/vizuly.css">
<script src="lib/d3_v5.7.min.js"></script>
<script src="lib/vizuly2_core.min.js"></script>
<script src="src/SunBurst.js"></script>
<script src="data/sunburst_data.js"></script>
<!-- DEMO CODE:START -->
<link rel="stylesheet" href="demo/scripts/cssmenu.css">
<script type="text/javascript" src="demo/scripts/jquery-2.1.1.min.js"></script>
<script src="demo/scripts/cssmenu.js"></script>
<script src="demo/SunBurstDemo.js"></script>
<!-- DEMO CODE: END -->
<style>
span.drill-label {
filter: brightness(80%);
}
span.drill-label:last-child {
font-weight:bold;
}
</style>
</head>
<body>
<!-- Our main content container-->
<div class="container" style="width:100%; overflow:visible">
<div id="viz_container" class="z-depth-3" style="width:600px; height:600px; position:relative;">
</div>
</div>
<div style="position:absolute; bottom:10px; right:10px; font-size:10px; color:#777"><span>v.</span> 2.1.220 - @date</div>
<script id="testscript">
var d3 = vizuly2.d3;
var viz = vizuly2.viz.SunBurst("#viz_container");
var valueField = "Federal";
var valueFields = ["Federal", "State", "Local"];
viz.data(data)
.width('100%')
.height('100%')
.children(function (d) {
return d.values
})
.key(function (d) {
return d.id
})
.value(function (d) {
return Number(d["agg_" + valueField])
})
.valueLabel(function (d) {
return d3.format('$,.2f')(Number(d["agg_" + valueField])) + " Million"
})
.label(function (d) {
var ret = trimLabel(d.key || (d.Category));
return (ret) ? ret : '';
})
.on("mouseover", onMouseOver)
.on("mouseout", onMouseOut)
viz.update();
if (runDemo) runDemo();
function trimLabel(label) {
return (String(label).length > 20) ? String(label).substr(0, 17) + "..." : label;
}
function onMouseOver(e, d, i) {
console.log("onMouseOver " + d.key);
}
function onMouseOut(e, d, i) {
console.log("onMouseOver " + d.key);
}
</script>
</body>
</html>