forked from jcarver989/raphy-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath_menu.js
43 lines (32 loc) · 1.04 KB
/
path_menu.js
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
$(document).ready(function() {
var categories = ['company_size', 'industry', 'functional_area', 'seniority'];
var category_opts = {
company_size: { fill_color: "#6a329e" },
industry: { fill_color: "#00a6dd" },
functional_area: { fill_color: "#659e32" },
seniority: { fill_color: "#b85d26" }
}
for (category in data) {
var segments = data[category];
if (categories.indexOf(category) == -1) continue;
var menu = new Charts.PathMenu(category, category_opts[category]);
for (var i = 0, len = segments.length; i < len; i++) {
var segment = segments[i];
var segment_children = segment.children;
var children = [];
for (var j = 0, jlen = segment_children.length; j < jlen; j++) {
var segment_child = segment_children[j];
children.push({
label: segment_child.name,
value: segment_child.count
});
}
menu.add({
label: segment.name,
value: segment.count,
children: children
});
}
menu.draw();
}
});