Permalink
Browse files

Merge pull request #27 from spiccinini/master

Fixed some problems on mmash graph javascript
  • Loading branch information...
2 parents 1f97954 + 93586dd commit e3103b6a47d16c41ed0280485fb44d3352d3f6d4 @schmichael committed Dec 21, 2012
Showing with 13 additions and 13 deletions.
  1. +13 −13 mmstats/templates/graph.html
@@ -96,8 +96,8 @@
});
function toggle_update(label) {
- var _div = $("#plot_" + label.replace('.', '_'));
-
+ var _div = $("#plot_" + label.replace(/\./g, '_'));
+
var idx = updates.indexOf(label);
if(idx != -1) {
//There is probably a better way to do 'del updates[idx]'
@@ -107,12 +107,12 @@
updates.push(label);
}
function update() {
- $.get('/stats/' + label, function(new_data) {
+ $.getJSON('/stats/' + label, function(new_data) {
if(updates.indexOf(label) == -1) {
- return;
- }
- var value = JSON.parse(new_data)[label][0];
- $("#box_" + label.replace('.', '-')).val(value);
+ return;
+ }
+ var value = new_data[label][0];
+ $("#box_" + label.replace(/\./g, '_')).val(value);
setTimeout(update, sample_rate);
});
}
@@ -121,7 +121,7 @@
function toggle_plot(label) {
- var plot_div = $("#plot_" + label.replace('.', '_'));
+ var plot_div = $("#plot_" + label.replace(/\./g, '_'));
plot_div.toggleClass("hidden");
var idx = plots.indexOf(label);
if(idx != -1) {
@@ -143,12 +143,12 @@
function fetch() {
- $.get('/stats/' + label, function(new_data) {
+ $.getJSON('/stats/' + label, function(new_data) {
if(plots.indexOf(label) == -1) {
- return;
- }
-
- var value = JSON.parse(new_data)[label][0];
+ return;
+ }
+
+ var value = new_data[label][0];
data.push(value);
tail.push(value);

0 comments on commit e3103b6

Please sign in to comment.