Fixed problems with threshold. Ticket: #3777

This commit is contained in:
m-lopez-f 2016-09-07 13:00:25 +02:00
parent 14a627fc33
commit c0d2cf6f8e

View File

@ -2077,25 +2077,34 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
datas.push(this); datas.push(this);
//} //}
}); });
plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, {
yaxis: {max: max_draw},
}));
thresholded = false; thresholded = false;
} else {
datas = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max,
yellow_threshold, red_threshold, extremes, red_up);
thresholded = true;
} }
else {
var max_draw = plot.getAxes().yaxis.datamax; var max_draw = plot.getAxes().yaxis.datamax;
if (max_draw < red_threshold || max_draw < yellow_threshold) { if (max_draw < red_threshold || max_draw < yellow_threshold) {
var maxim_data = (red_threshold < yellow_threshold) ? yellow_threshold : red_threshold var maxim_data = (red_threshold < yellow_threshold) ? yellow_threshold : red_threshold
plot = $.plot($('#' + graph_id), data_base, plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, { $.extend(true, {}, options, {
yaxis: {max: maxim_data}, yaxis: {max: maxim_data + (maxim_data*0.5)},
})); }));
} }
datas = add_threshold (data_base, threshold_data, plot.getAxes().yaxis.min, plot.getAxes().yaxis.max,
yellow_threshold, red_threshold, extremes, red_up);
thresholded = true;
}
plot.setData(datas); plot.setData(datas);
plot.draw(); plot.draw();
plot.setSelection(currentRanges); //~ plot.setSelection(currentRanges);
}); });
$('#menu_cancelzoom_' + graph_id).click(function() { $('#menu_cancelzoom_' + graph_id).click(function() {