[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [atlas/master] Correctly handle null values in bandwidth graphs.
commit 4b6a5f833e4c1ad6a93dab76396ccd35af044273
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon Mar 19 09:42:58 2012 +0100
Correctly handle null values in bandwidth graphs.
Before 9816969, null values were handled as 0. With 9816969, null values
were removed, but non-null values were connected with a line even with
null values in between them. Now, null values are removed and lines are
not connected.
Fixes #1.
---
js/models/graph.js | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/js/models/graph.js b/js/models/graph.js
index a36bf9b..4d1f8ce 100644
--- a/js/models/graph.js
+++ b/js/models/graph.js
@@ -54,19 +54,20 @@ define([
_.each(history[period].values, function(value, i) {
y += history[period].interval*1000;
+ var x = null
if (value != null) {
- var x = value*history[period].factor;
-
- // This is quite a hack to conform to backbone.js
- // funky way of setting and getting attributes in
- // models.
- // XXX probably want to refactor.
- var mperiod = period.split("_")[1]
- var newar = model.get(mperiod).write;
- newar.push([y,x]);
- var toset = {mperiod: {write: newar}};
- model.set(toset);
+ x = value*history[period].factor;
}
+
+ // This is quite a hack to conform to backbone.js
+ // funky way of setting and getting attributes in
+ // models.
+ // XXX probably want to refactor.
+ var mperiod = period.split("_")[1]
+ var newar = model.get(mperiod).write;
+ newar.push([y,x]);
+ var toset = {mperiod: {write: newar}};
+ model.set(toset);
});
});
@@ -80,14 +81,15 @@ define([
var y = first.getTime();
_.each(history[period].values, function(value, i) {
y += history[period].interval*1000;
+ var x = null
if (value != null) {
- var x = value*history[period].factor;
- var mperiod = period.split("_")[1]
- var newar = model.get(mperiod).read;
- newar.push([y,x]);
- var toset = {mperiod: {read: newar}};
- model.set(toset);
+ x = value*history[period].factor;
}
+ var mperiod = period.split("_")[1]
+ var newar = model.get(mperiod).read;
+ newar.push([y,x]);
+ var toset = {mperiod: {read: newar}};
+ model.set(toset);
});
});
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits