Browse Source

Render NaN in legend for null values instead of 0

master
Johann Schmitz 5 years ago
parent
commit
2d11e2e19d
Signed by: ercpe GPG Key ID: A084064277C501ED
  1. 2
      src/djunin/settings.py
  2. 6
      src/djunin/static/jquery.flot.djunin.js
  3. 6
      src/djunin/static/site.js

2
src/djunin/settings.py

@ -108,4 +108,4 @@ COMPRESS_ENABLED = True
STATICFILES_FINDERS = ["django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", 'compressor.finders.CompressorFinder',]
OPENSEARCH_SHORT_NAME="Djunin"
OPENSEARCH_SEARCH_URL="jump"
OPENSEARCH_SEARCH_URL="jump"

6
src/djunin/static/jquery.flot.djunin.js

@ -18,8 +18,10 @@
for (var i = 0; i < data.length; i++) {
var row = $('.label_' + data[i].internal_name, legend).parents('tr');
$('.datarow-min', row).text(yaxis.tickFormatter(data[i].min_value, yaxis));
$('.datarow-max', row).text(yaxis.tickFormatter(data[i].max_value, yaxis));
var min_value = data[i].min_value ? yaxis.tickFormatter(data[i].min_value, yaxis) : 'NaN';
var max_value = data[i].max_value ? yaxis.tickFormatter(data[i].max_value, yaxis) : 'NaN';
$('.datarow-min', row).text(min_value);
$('.datarow-max', row).text(max_value);
}
});
}

6
src/djunin/static/site.js

@ -129,9 +129,9 @@ function draw_graphs() {
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
}
var formatted_value = series.yaxis.tickFormatter(y, series.yaxis);
if (formatted_value == 0) formatted_value = 0;
$('tr:nth-child(' + (i+2) + ') > .datarow-current', legend_container).text(formatted_value);
var formatted_value = y ? series.yaxis.tickFormatter(y, series.yaxis) : null;
if (formatted_value === 0) formatted_value = 0;
$('tr:nth-child(' + (i+2) + ') > .datarow-current', legend_container).text(formatted_value ? formatted_value : 'NaN');
}
}