visage-app 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/visage-app/public/javascripts/graph.js +94 -50
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.6
|
@@ -89,38 +89,41 @@ function formatSeriesLabel(labels) {
|
|
89
89
|
return name.trim()
|
90
90
|
}
|
91
91
|
|
92
|
-
function formatValue(value,
|
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
|
-
|
92
|
+
function formatValue(value, options) {
|
93
|
+
var precision = options.precision,
|
94
|
+
min = options.min,
|
95
|
+
max = options.max;
|
96
|
+
|
97
|
+
switch(true) {
|
98
|
+
case (Math.abs(max) > 1125899906842624):
|
99
|
+
var label = value / 1125899906842624,
|
100
|
+
unit = 'P';
|
101
|
+
break
|
102
|
+
case (Math.abs(max) > 1099511627776):
|
103
|
+
var label = value / 1099511627776,
|
104
|
+
unit = 'T';
|
105
|
+
break
|
106
|
+
case (Math.abs(max) > 1073741824):
|
107
|
+
var label = value / 1073741824,
|
108
|
+
unit = 'G';
|
109
|
+
break
|
110
|
+
case (Math.abs(max) > 1048576):
|
111
|
+
var label = value / 1048576,
|
112
|
+
unit = 'M';
|
113
|
+
break
|
114
|
+
case (Math.abs(max) > 1024):
|
115
|
+
var label = value / 1024,
|
116
|
+
unit = 'K';
|
117
|
+
break
|
118
|
+
default:
|
119
|
+
var label = value,
|
120
|
+
unit = '';
|
121
|
+
break
|
122
|
+
}
|
123
|
+
|
124
|
+
var rounded = label.round(precision)
|
125
|
+
|
126
|
+
return rounded + unit
|
124
127
|
}
|
125
128
|
|
126
129
|
function formatDate(d) {
|
@@ -245,7 +248,7 @@ var visageGraph = new Class({
|
|
245
248
|
}, this);
|
246
249
|
|
247
250
|
/* Reset the zoom */
|
248
|
-
this.chart.toolbar.remove('zoom');
|
251
|
+
//this.chart.toolbar.remove('zoom');
|
249
252
|
this.chart.xAxis.concat(this.chart.yAxis).each(function(axis) {
|
250
253
|
axis.setExtremes(null,null,false);
|
251
254
|
});
|
@@ -286,21 +289,46 @@ var visageGraph = new Class({
|
|
286
289
|
|
287
290
|
return series
|
288
291
|
},
|
292
|
+
getSeriesMinMax: function(series) {
|
293
|
+
var min, max;
|
294
|
+
|
295
|
+
series.each(function(set) {
|
296
|
+
values = set.data.map(function(point) {
|
297
|
+
var value = point[1];
|
298
|
+
return value
|
299
|
+
});
|
300
|
+
|
301
|
+
var setMin = values.min()
|
302
|
+
var setMax = values.max()
|
303
|
+
|
304
|
+
if ($chk(min)) {
|
305
|
+
min = min > setMin ? setMin : min
|
306
|
+
} else {
|
307
|
+
min = setMin
|
308
|
+
}
|
309
|
+
|
310
|
+
if ($chk(max)) {
|
311
|
+
max = max < setMax ? setMax : max
|
312
|
+
} else {
|
313
|
+
max = setMax
|
314
|
+
}
|
315
|
+
});
|
316
|
+
|
317
|
+
return {'min': min, 'max': max};
|
318
|
+
},
|
289
319
|
drawChart: function() {
|
290
320
|
var series = this.series,
|
291
321
|
title = this.graphName(),
|
292
322
|
element = this.parentElement,
|
293
323
|
ytitle = formatPluginName(this.options.plugin),
|
294
|
-
|
324
|
+
min,
|
325
|
+
max;
|
295
326
|
|
296
327
|
/* Get the maximum value across all sets.
|
297
328
|
* Used later on to determine the decimal place in the label. */
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
max = setMax
|
302
|
-
}
|
303
|
-
});
|
329
|
+
meta = this.getSeriesMinMax(series);
|
330
|
+
var min = meta.min,
|
331
|
+
max = meta.max;
|
304
332
|
|
305
333
|
this.chart = new Highcharts.Chart({
|
306
334
|
chart: {
|
@@ -349,19 +377,25 @@ var visageGraph = new Class({
|
|
349
377
|
title: {
|
350
378
|
text: ytitle
|
351
379
|
},
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
380
|
+
startOnTick: false,
|
381
|
+
minPadding: 0.065,
|
382
|
+
max: max,
|
383
|
+
endOnTick: true,
|
356
384
|
labels: {
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
385
|
+
formatter: function() {
|
386
|
+
var precision = min - max < 1000 ? 2 : 0,
|
387
|
+
value = formatValue(this.value, {
|
388
|
+
'precision': precision,
|
389
|
+
'min': min,
|
390
|
+
'max': max
|
391
|
+
});
|
392
|
+
return value
|
393
|
+
}
|
361
394
|
}
|
362
395
|
},
|
363
396
|
plotOptions: {
|
364
397
|
series: {
|
398
|
+
shadow: false,
|
365
399
|
marker: {
|
366
400
|
enabled: false,
|
367
401
|
stacking: 'normal',
|
@@ -376,9 +410,19 @@ var visageGraph = new Class({
|
|
376
410
|
tooltip: {
|
377
411
|
formatter: function() {
|
378
412
|
var tip;
|
379
|
-
tip =
|
380
|
-
tip +=
|
413
|
+
tip = '<strong>'
|
414
|
+
tip += formatSeriesLabel(this.series.name).trim()
|
415
|
+
tip += '</strong>' + ' -> '
|
416
|
+
tip += '<span style="font-family: monospace; font-size: 14px;">'
|
417
|
+
tip += formatValue(this.y, { 'precision': 2, 'min': min, 'max': max })
|
418
|
+
tip += '<span style="font-size: 9px; color: #777">'
|
419
|
+
tip += ' (' + this.y + ')'
|
420
|
+
tip += '</span>'
|
421
|
+
tip += '</span>'
|
422
|
+
tip += '<br/>'
|
423
|
+
tip += '<span style="font-family: monospace">'
|
381
424
|
tip += formatDate(this.x)
|
425
|
+
tip += '</span>'
|
382
426
|
|
383
427
|
return tip
|
384
428
|
}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 6
|
9
|
+
version: 0.9.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Lindsay Holmwood
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-11 00:00:00 +10:00
|
18
18
|
default_executable: visage-app
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|