Merge branch '2424-Bug_umbrales_graficas' into 'develop'

fixed minor error

See merge request artica/pandorafms!1644
This commit is contained in:
vgilc 2018-08-01 14:55:18 +02:00
commit 8af71bfc35

View File

@ -1769,6 +1769,10 @@ function pandoraFlotArea( graph_id, values, legend,
update_left_width_canvas(graph_id); update_left_width_canvas(graph_id);
}); });
var max_draw = [];
max_draw['max'] = plot.getAxes().yaxis.max;
max_draw['min'] = plot.getAxes().yaxis.min;
// Connection between plot and miniplot // Connection between plot and miniplot
$('#' + graph_id).bind('plotselected', function (event, ranges) { $('#' + graph_id).bind('plotselected', function (event, ranges) {
// do the zooming if exist menu to undo it // do the zooming if exist menu to undo it
@ -1786,12 +1790,25 @@ function pandoraFlotArea( graph_id, values, legend,
} }
} }
if(thresholded){
var y_recal = axis_thresholded(
threshold_data,
plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max,
red_threshold, extremes,
red_up
);
}
else{
var y_recal = ranges.yaxis;
}
if (thresholded) { if (thresholded) {
data_base_treshold = add_threshold ( data_base_treshold = add_threshold (
data_base, data_base,
threshold_data, threshold_data,
ranges.yaxis.from, ranges.yaxis.from,
ranges.yaxis.to, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -1822,7 +1839,7 @@ function pandoraFlotArea( graph_id, values, legend,
}], }],
yaxis:{ yaxis:{
min: ranges.yaxis.from, min: ranges.yaxis.from,
max: ranges.yaxis.to, max: y_recal.max,
font: { font: {
size: font_size + 2, size: font_size + 2,
color: legend_color, color: legend_color,
@ -1882,6 +1899,9 @@ function pandoraFlotArea( graph_id, values, legend,
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png'); $('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png');
max_draw['max'] = ranges.yaxis.to;
max_draw['min'] = ranges.yaxis.from;
// don't fire event on the overview to prevent eternal loop // don't fire event on the overview to prevent eternal loop
overview.setSelection(ranges, true); overview.setSelection(ranges, true);
}); });
@ -2174,7 +2194,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base, data_base,
threshold_data, threshold_data,
plot.getAxes().yaxis.min, plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -2254,7 +2274,6 @@ function pandoraFlotArea( graph_id, values, legend,
$('#menu_threshold_' + graph_id).click(function() { $('#menu_threshold_' + graph_id).click(function() {
datas = new Array(); datas = new Array();
if (thresholded) { if (thresholded) {
$.each(data_base, function() { $.each(data_base, function() {
datas.push(this); datas.push(this);
@ -2265,7 +2284,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), data_base, plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, { $.extend(true, {}, options, {
yaxis: { yaxis: {
max: max_draw min: max_draw['min'],
max: max_draw['max']
}, },
xaxis: { xaxis: {
min: plot.getAxes().xaxis.min, min: plot.getAxes().xaxis.min,
@ -2275,8 +2295,6 @@ function pandoraFlotArea( graph_id, values, legend,
thresholded = false; thresholded = false;
} }
else { else {
var max_draw = plot.getAxes().yaxis.datamax;
if(!thresholded){ if(!thresholded){
// Recalculate the y axis // Recalculate the y axis
var y_recal = axis_thresholded( var y_recal = axis_thresholded(
@ -2295,7 +2313,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base, data_base,
threshold_data, threshold_data,
plot.getAxes().yaxis.min, plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -2305,7 +2323,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), datas_treshold, plot = $.plot($('#' + graph_id), datas_treshold,
$.extend(true, {}, options, { $.extend(true, {}, options, {
yaxis: { yaxis: {
max: y_recal.max, min: max_draw['min'],
max: y_recal.max
}, },
xaxis: { xaxis: {
min: plot.getAxes().xaxis.min, min: plot.getAxes().xaxis.min,
@ -2330,6 +2349,7 @@ function pandoraFlotArea( graph_id, values, legend,
overview.clearSelection(); overview.clearSelection();
currentRanges = null; currentRanges = null;
thresholded = false; thresholded = false;
max_draw = [];
}); });
// Adjust the menu image on top of the plot // Adjust the menu image on top of the plot