-
Notifications
You must be signed in to change notification settings - Fork 0
/
bubbles.js
150 lines (129 loc) · 4.5 KB
/
bubbles.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
$(document).ready(function () {
var x= {
supportResponsive: true,
//container: => use @default
size: 600,
//viewBoxSize: => use @default
innerRadius: 600 / 3.5,
//outerRadius: => use @default
radiusMin: 50,
//radiusMax: use @default
//intersectDelta: use @default
//intersectInc: use @default
//circleColor: use @default
data: {
items: [
],
eval: function (item) {
return item.count;
},
classed: function (item) {
console.log(item.text);
return item.text.split(" ").join("");
}
},
plugins: [
{
name: "central-click",
options: {
text: "(See more detail)",
style: {
"font-size": "12px",
"font-style": "italic",
"font-family": "Source Sans Pro, sans-serif",
//"font-weight": "700",
"text-anchor": "middle",
"fill": "white"
},
attr: {dy: "65px"},
centralClick: function () {
alert("Here is more details!!");
}
}
},
{
name: "lines",
options: {
format: [
{// Line #0
textField: "count",
classed: {count: true},
style: {
"font-size": "28px",
"font-family": "Source Sans Pro, sans-serif",
"text-anchor": "middle",
fill: "white"
},
attr: {
dy: "0px",
x: function (d) {
return d.cx;
},
y: function (d) {
return d.cy;
}
}
},
{// Line #1
textField: "text",
classed: {text: true},
style: {
"font-size": "14px",
"font-family": "Source Sans Pro, sans-serif",
"text-anchor": "middle",
fill: "white"
},
attr: {
dy: "20px",
x: function (d) {
return d.cx;
},
y: function (d) {
return d.cy;
}
}
}
],
centralFormat: [
{// Line #0
style: {"font-size": "50px"},
attr: {}
},
{// Line #1
style: {"font-size": "30px"},
attr: {dy: "40px"}
}
]
}
}]
};
function ajaxCallBack(retString) {
var items = [];
retString = JSON.parse(retString);
for (var i = 0; i < retString.length/2; i++) {
retString[i].name;
first = retString[i].playtime;
second = first.split(" ");
third = second[0].split("hours");
items.push({
count: third[0],
text: retString[i].name
})
}
x.data.items=items;
console.log(x);
}
function ajax1() {
return $.ajax({
url: 'https://api.lootbox.eu/pc/' + "us" + "/" + "Arthas-11308" + "/quick-play/heroes",
success: function (result) {
ajaxCallBack(result);
}
});
}
console.log(x);
$.when(ajax1()).done(function () {
$('h1').html("Hours Played on Different champions");
var bubbleChart = new d3.svg.BubbleChart(x);
});
});