-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample001.html
executable file
·240 lines (223 loc) · 8.69 KB
/
example001.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=800" />
<link type="text/css" rel="stylesheet" href="./css/jquery-ui.css" />
<link type="text/css" rel="stylesheet" href="./css/bigscatterchart.css" />
<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript" src="./js/modernizr.js"></script>
<script type="text/javascript" src="./js/underscore-min.js"></script>
<script type="text/javascript" src="./js/date.js"></script>
<script type="text/javascript" src="./js/jquery.Class.js"></script>
<script type="text/javascript" src="./js/jquery.dragToSelect.js"></script>
<script type="text/javascript" src="./js/jquery.BigScatterChart.js"></script>
</head>
<body>
<div style="padding-left:100px">
<div id="chart1"></div>
<button onclick="oScatterChart.destroy()">Destory</button>
<a id="png-down" href="" download="BigScatterChart.png">Save as PNG</a>
<a id="jpg-down" href="" download="BigScatterChart.jpg">Save as JPEG</a>
</div>
<script type="text/javascript">
$('#png-down').click(function(e){
var sImageUrl = oScatterChart.getChartAsPNG();
$(this).attr('href', sImageUrl);
});
$('#jpg-down').click(function(e){
var sImageUrl = oScatterChart.getChartAsJPEG();
$(this).attr('href', sImageUrl);
});
var date = new Date();
if(Modernizr.canvas){
doBigScatterChart();
}
var oScatterChart;
function doBigScatterChart(){
oScatterChart = new BigScatterChart({
sContainerId : 'chart1',
nWidth : 800,
nHeight : 600,
nXMin: date.getTime() - 86400000, nXMax: date.getTime(),
nYMin: 0, nYMax: 10000,
nZMin: 0, nZMax: 5,
nBubbleSize: 3,
nDefaultRadius : 3,
htTypeAndColor : {
'Success' : '#b6da54', // type name : color
'Warning' : '#fcc666',
'Failed' : '#fd7865',
'Others' : '#55c7c7'
},
sXLabel : '(time)',
sYLabel : '(ms)',
htGuideLine : {
'nLineWidth' : 1,
'aLineDash' : [2, 5],
'nGlobalAlpha' : 0.2
},
sXLabel : '',
nPaddingRight : 5,
fOnSelect : function(htPosition, htXY){
console.log('fOnSelect', htPosition, htXY);
console.time('fOnSelect');
var aData = this.getDataByXY(htXY.nXFrom, htXY.nXTo, htXY.nYFrom, htXY.nYTo);
console.timeEnd('fOnSelect');
console.log('adata length', aData.length);
//alert('Selected data count : ' + aData.length);
}
});
var data = [];
for(var i=date.getTime() - 86400000; i<date.getTime() - 69120000; i+=173){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.setBubbles(data);
oScatterChart.redrawBubbles();
setTimeout(function(){
var data = [];
for(var i=date.getTime() - 69120001; i<date.getTime() - 51840000; i+=173){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndDraw(data);
}, 1);
setTimeout(function(){
var data = [];
for(var i=date.getTime() - 51840001; i<date.getTime() - 17280000; i+=173){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndDraw(data);
}, 1);
setTimeout(function(){
var data = [];
for(var i=date.getTime() - 17280001; i<date.getTime() - 0; i+=173){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndDraw(data);
}, 1);
setTimeout(function(){
var data = [];
for(var i=date.getTime(), nLen=date.getTime() + 3600000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
r : _.random(3,5),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 3600000);
}, 5000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 3600001, nLen=date.getTime() + 7200000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 7200000);
}, 8000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 7200001, nLen=date.getTime() + 10800000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 10800000);
}, 11000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 10800001, nLen=date.getTime() + 14400000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 14400000);
}, 14000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 14400001, nLen=date.getTime() + 18000000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 18000000);
}, 17000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 18000001, nLen=date.getTime() + 21600000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
r : _.random(4,5),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 21600000);
}, 21000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 21600001, nLen=date.getTime() + 25200000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 25200000);
}, 24000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 25200001, nLen=date.getTime() + 28800000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
r : _.random(3,5),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 28800000);
}, 27000);
setTimeout(function(){
var data = [];
for(var i=date.getTime() + 28800001, nLen=date.getTime() + 32400000; i<nLen; i+=360){
data.push({
x : i,
y : Math.round(_.random(0, 10000) / _.random(1, 1000)),
type : _.random(0,100) < 80 ? 'Success' : (_.random(0,100) < 80 ? 'Failed' : (_.random(0,100) < 80 ? 'Warning' : 'Others'))
});
}
oScatterChart.addBubbleAndMoveAndDraw(data, date.getTime() + 32400000);
}, 30000);
}
</script>
</body>
</html>