visage-app 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -1,8 +1,8 @@
1
- /*
1
+ /*
2
2
  * visageBase()
3
3
  *
4
4
  * Base class for fetching data and setting graph options.
5
- * Should be used by other classes to build specialised graphing behaviour.
5
+ * Should be used by other classes to build specialised graphing behaviour.
6
6
  *
7
7
  */
8
8
  var visageBase = new Class({
@@ -20,7 +20,7 @@ var visageBase = new Class({
20
20
  shade: false,
21
21
  secureJSON: false,
22
22
  httpMethod: 'get',
23
- axis: "0 0 1 1"
23
+ axis: "0 0 1 1"
24
24
  },
25
25
  initialize: function(element, host, plugin, options) {
26
26
  this.parentElement = element;
@@ -70,8 +70,6 @@ var visageBase = new Class({
70
70
  'class': 'graph-title',
71
71
  'html': header
72
72
  });
73
- console.log(this);
74
- console.log(this.parentElement);
75
73
  $(this.parentElement).grab(this.graphHeader);
76
74
  },
77
75
  buildGraphContainer: function() {
@@ -88,7 +86,7 @@ var visageBase = new Class({
88
86
  });
89
87
 
90
88
 
91
- /*
89
+ /*
92
90
  * visageGraph()
93
91
  *
94
92
  * General purpose graph for rendering data from a single plugin
@@ -145,7 +143,7 @@ var visageGraph = new Class({
145
143
 
146
144
  while (counter < finish) {
147
145
  x.push(counter)
148
- counter += interval
146
+ counter += interval
149
147
  }
150
148
  return x
151
149
  },
@@ -157,17 +155,17 @@ var visageGraph = new Class({
157
155
  var width = this.options.gridWidth
158
156
  var height = this.options.gridHeight
159
157
  var x = this.x // x axis
160
- var ys = this.ys // y axes
158
+ var ys = this.ys // y axes
161
159
  var xstep = x.length / 20
162
160
  var shade = this.options.shade
163
161
  var axis = this.options.axis
164
162
 
165
163
  this.canvas.g.txtattr.font = "11px 'sans-serif'";
166
164
  this.graph = this.canvas.g.linechart(left, top, width, height, x, ys, {
167
- nostroke: false,
165
+ nostroke: false,
168
166
  width: 1.5,
169
167
  axis: axis,
170
- colors: colors,
168
+ colors: colors,
171
169
  axisxstep: xstep,
172
170
  shade: shade
173
171
  });
@@ -179,7 +177,7 @@ var visageGraph = new Class({
179
177
  /* clean up graph labels */
180
178
  this.graph.axis[0].text.items.getLast().hide()
181
179
  $each(this.graph.axis[0].text.items, function (time) {
182
-
180
+
183
181
  var unixTime = time.attr('text')
184
182
  var d = new Date(time.attr('text') * 1000);
185
183
  time.attr({'text': d.strftime("%H:%M")});
@@ -238,7 +236,7 @@ var visageGraph = new Class({
238
236
  this.embedderContainer.grab(pre);
239
237
 
240
238
  var slider = new Fx.Slide(pre, {
241
- duration: 200
239
+ duration: 200
242
240
  });
243
241
 
244
242
  slider.hide();
@@ -337,7 +335,7 @@ var visageGraph = new Class({
337
335
  }
338
336
  });
339
337
  $(this.parentElement).grab(this.timescaleContainer, 'top')
340
-
338
+
341
339
  this.labelsContainer = new Element('div', {
342
340
  'class': 'labels container',
343
341
  'title': 'click to hide',
@@ -348,7 +346,7 @@ var visageGraph = new Class({
348
346
  }
349
347
  });
350
348
  $(this.parentElement).grab(this.labelsContainer)
351
-
349
+
352
350
  this.embedderContainer = new Element('div', {
353
351
  'class': 'embedder container',
354
352
  'styles': {
@@ -361,13 +359,13 @@ var visageGraph = new Class({
361
359
  $(this.parentElement).grab(this.embedderContainer)
362
360
  },
363
361
  buildDateSelector: function() {
364
- /*
362
+ /*
365
363
  * container
366
364
  * \
367
365
  * - form
368
366
  * \
369
367
  * - select
370
- * | \
368
+ * | \
371
369
  * | - option
372
370
  * | |
373
371
  * | - option
@@ -376,17 +374,17 @@ var visageGraph = new Class({
376
374
  */
377
375
  var currentDate = new Date;
378
376
  var currentUnixTime = parseInt(currentDate.getTime() / 1000);
379
-
377
+
380
378
  var container = $(this.timescaleContainer);
381
- var form = new Element('form', {
382
- 'action': this.dataURL(),
379
+ var form = new Element('form', {
380
+ 'action': this.dataURL(),
383
381
  'method': 'get',
384
382
  'events': {
385
383
  'submit': function(e, foo) {
386
384
  e.stop();
387
-
385
+
388
386
  /*
389
- * Get the selected option, turn it into a hash for
387
+ * Get the selected option, turn it into a hash for
390
388
  * getData() to use.
391
389
  */
392
390
  data = new Hash()
@@ -419,13 +417,13 @@ var visageGraph = new Class({
419
417
  });
420
418
 
421
419
  var select = new Element('select', { 'class': 'date timescale' });
422
- var timescales = new Hash({ 'hour': 1, '2 hours': 2, '6 hours': 6, '12 hours': 12,
423
- 'day': 24, '2 days': 48, '3 days': 72,
420
+ var timescales = new Hash({ 'hour': 1, '2 hours': 2, '6 hours': 6, '12 hours': 12,
421
+ 'day': 24, '2 days': 48, '3 days': 72,
424
422
  'week': 168, '2 weeks': 336, 'month': 672 });
425
423
  timescales.each(function(hour, label) {
426
424
  var current = this.currentTimePeriod == 'last {label}'.substitute({'label': label });
427
425
  var value = "start={start}".substitute({'start': currentUnixTime - (hour * 3600)});
428
- var html = 'last {label}'.substitute({'label': label });
426
+ var html = 'last {label}'.substitute({'label': label });
429
427
 
430
428
  var option = new Element('option', {
431
429
  html: html,
@@ -435,9 +433,9 @@ var visageGraph = new Class({
435
433
  });
436
434
  select.grab(option)
437
435
  });
438
-
436
+
439
437
  var submit = new Element('input', { 'type': 'submit', 'value': 'show' });
440
-
438
+
441
439
  form.grab(select);
442
440
  form.grab(submit);
443
441
  container.grab(form);
@@ -481,7 +479,7 @@ var visageGraph = new Class({
481
479
  var box = new Element('div', {
482
480
  'class': 'label plugin box ' + metric,
483
481
  'html': '&nbsp;',
484
- 'styles': {
482
+ 'styles': {
485
483
  'background-color': color,
486
484
  'width': '48px',
487
485
  'height': '18px',
@@ -489,7 +487,7 @@ var visageGraph = new Class({
489
487
  'margin-right': '0.5em'
490
488
  }
491
489
  });
492
-
490
+
493
491
  // plugin/instance/metrics names can be unmeaningful. make them pretty
494
492
  var name;
495
493
  name = instance.replace(plugin, '');
@@ -527,7 +525,7 @@ var visageSparkline = new Class({
527
525
  shade: false,
528
526
  secureJSON: false,
529
527
  httpMethod: 'get',
530
- axis: "0 0 0 0"
528
+ axis: "0 0 0 0"
531
529
  },
532
530
  graphData: function(data) {
533
531
 
@@ -551,10 +549,6 @@ var visageSparkline = new Class({
551
549
  }, this);
552
550
  }, this);
553
551
 
554
- console.log(this.metrics)
555
- console.log(this.instances)
556
- console.log(this.ys)
557
-
558
552
  this.drawGraph();
559
553
  }
560
554
  });
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
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: 2010-06-27 00:00:00 +10:00
17
+ date: 2010-07-06 00:00:00 +10:00
18
18
  default_executable: visage
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency