Added new changes of data precision to pandora 6. Part is to the ticket #4114

This commit is contained in:
Arturo Gonzalez 2016-11-15 17:04:33 +01:00
parent 11e1f5eb1f
commit abca64e007
2 changed files with 19 additions and 2 deletions

View File

@ -403,7 +403,7 @@ if (!enterprise_installed()) {
} }
$table_chars->data[$row][0] = __('Data precision for reports'); $table_chars->data[$row][0] = __('Data precision for reports');
$table_chars->data[$row][1] = html_print_input_text ('graph_precision', $config["graph_precision"], '', 5, 5, true, $disabled_graph_precision); $table_chars->data[$row][1] = html_print_input_text ('graph_precision', $config["graph_precision"], '', 5, 5, true, $disabled_graph_precision, false, "onChange=\"change_precision()\"");
$row++; $row++;
$table_chars->data[$row][0] = __('Default line thickness for the Custom Graph.'); $table_chars->data[$row][0] = __('Default line thickness for the Custom Graph.');
@ -741,6 +741,14 @@ function display_custom_report_front (show) {
} }
function change_precision() {
console.log("AAAA");
var value = $("#text-graph_precision").val();
if ((value < 0) || (value > 5)) {
$("#text-graph_precision").val(1);
}
}
function showPreview() { function showPreview() {
var img_value = $('#custom_report_front_logo').val(); var img_value = $('#custom_report_front_logo').val();

View File

@ -1697,6 +1697,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
} }
var y = series.data[j][1]; var y = series.data[j][1];
var how_bigger = "";
if (y > 1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y > 1000) {
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show(); $('#timestamp_'+graph_id).show();
@ -1736,7 +1745,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// The graphs of points type and unknown graphs will dont be updated // The graphs of points type and unknown graphs will dont be updated
if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) { if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) {
$('#legend_' + graph_id + ' .legendLabel') $('#legend_' + graph_id + ' .legendLabel')
.eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(2) + ' ' + unit); .eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(precision_graph) + how_bigger + ' ' + unit);
console.log($('#legend_' + graph_id + ' .legendLabel')); console.log($('#legend_' + graph_id + ' .legendLabel'));
} }