Permalink
Browse files

Fixed mmash graph javascript

  • Loading branch information...
1 parent a1a6aeb commit 93586ddb10c76911256a43b7d21d8d3c416b9311 @spiccinini spiccinini committed Nov 27, 2012
Showing with 13 additions and 13 deletions.
  1. +13 −13 mmstats/templates/graph.html
@@ -96,8 +96,8 @@ <h3>Numeric values</h3>
});
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 @@ <h3>Numeric values</h3>
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 @@ <h3>Numeric values</h3>
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 @@ <h3>Numeric values</h3>
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 93586dd

Please sign in to comment.