mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errrors graphs
This commit is contained in:
parent
b6798bf31c
commit
8be776e3ea
@ -1535,7 +1535,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
|
|
||||||
// The first execution, the graph data is the base data
|
// The first execution, the graph data is the base data
|
||||||
datas = data_base;
|
datas = data_base;
|
||||||
console.log(datas);
|
|
||||||
// minTickSize
|
// minTickSize
|
||||||
var count_data = datas[0].data.length;
|
var count_data = datas[0].data.length;
|
||||||
var min_tick_pixels = 80;
|
var min_tick_pixels = 80;
|
||||||
@ -1781,7 +1781,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
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();
|
||||||
// If no legend, the timestamp labels are short and with value
|
// If no legend, the timestamp labels are short and with value
|
||||||
console.log(y);
|
|
||||||
if (legend.length == 0) {
|
if (legend.length == 0) {
|
||||||
$('#timestamp_'+graph_id).text(labels[j] + ' (' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + ')');
|
$('#timestamp_'+graph_id).text(labels[j] + ' (' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + ')');
|
||||||
}
|
}
|
||||||
@ -1907,7 +1906,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#overview_'+graph_id).bind('plothover', function (event, pos, item) {
|
$('#overview_'+graph_id).bind('plothover', function (event, pos, item) {
|
||||||
console.log('entra22222');
|
|
||||||
plot.setCrosshair({ x: pos.x, y: 0 });
|
plot.setCrosshair({ x: pos.x, y: 0 });
|
||||||
currentPlot = overview;
|
currentPlot = overview;
|
||||||
latestPosition = pos;
|
latestPosition = pos;
|
||||||
@ -2402,8 +2400,8 @@ function pandoraFlotAreaNew(
|
|||||||
else{
|
else{
|
||||||
var unit = '';
|
var unit = '';
|
||||||
}
|
}
|
||||||
console.log(format_graph);
|
|
||||||
//XXXX
|
//XXXX
|
||||||
var type = 'area_simple';
|
var type = 'area_simple';
|
||||||
var xaxisname = 'xaxisname';
|
var xaxisname = 'xaxisname';
|
||||||
var labels_long = '';
|
var labels_long = '';
|
||||||
@ -2490,31 +2488,34 @@ function pandoraFlotAreaNew(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
max_x = date_array['final_date'];
|
max_x = date_array['final_date'] *1000;
|
||||||
|
console.log(max_x);
|
||||||
|
|
||||||
console.log(data_module_graph);
|
var yellow_threshold = parseFloat (data_module_graph.w_min);
|
||||||
var yellow_threshold = data_module_graph.w_min;
|
var red_threshold = parseFloat (data_module_graph.c_min);
|
||||||
var red_threshold = data_module_graph.c_min;
|
var yellow_up = parseFloat (data_module_graph.w_max);
|
||||||
var yellow_up = data_module_graph.w_max;
|
var red_up = parseFloat (data_module_graph.c_max);
|
||||||
var red_up = data_module_graph.c_max;
|
|
||||||
var yellow_inverse = data_module_graph.w_inv;
|
var yellow_inverse = data_module_graph.w_inv;
|
||||||
var red_inverse = data_module_graph.c_inv;
|
var red_inverse = data_module_graph.c_inv;
|
||||||
// If threshold and up are the same, that critical or warning is disabled
|
// If threshold and up are the same, that critical or warning is disabled
|
||||||
if (yellow_threshold == yellow_up) yellow_inverse = false;
|
if (yellow_threshold == yellow_up){
|
||||||
if (red_threshold == red_up) red_inverse = false;
|
yellow_inverse = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (red_threshold == red_up){
|
||||||
|
red_inverse = false;
|
||||||
|
}
|
||||||
|
|
||||||
//Array with points to be painted
|
//Array with points to be painted
|
||||||
var threshold_data = new Array();
|
var threshold_data = new Array();
|
||||||
//Array with some interesting points
|
//Array with some interesting points
|
||||||
var extremes = new Array ();
|
var extremes = new Array ();
|
||||||
|
|
||||||
yellow_threshold = parseFloat (yellow_threshold);
|
|
||||||
yellow_up = parseFloat (yellow_up);
|
|
||||||
red_threshold = parseFloat (red_threshold);
|
|
||||||
red_up = parseFloat (red_up);
|
|
||||||
var yellow_only_min = ((yellow_up == 0) && (yellow_threshold != 0));
|
var yellow_only_min = ((yellow_up == 0) && (yellow_threshold != 0));
|
||||||
red_only_min = ((red_up == 0) && (red_threshold != 0));
|
var red_only_min = ((red_up == 0) && (red_threshold != 0));
|
||||||
|
|
||||||
|
//color
|
||||||
var normalw = '#efe';
|
var normalw = '#efe';
|
||||||
var warningw = '#ffe';
|
var warningw = '#ffe';
|
||||||
var criticalw = '#fee';
|
var criticalw = '#fee';
|
||||||
@ -2525,6 +2526,7 @@ console.log(data_module_graph);
|
|||||||
if (threshold) {
|
if (threshold) {
|
||||||
// Warning interval. Change extremes depends on critical interval
|
// Warning interval. Change extremes depends on critical interval
|
||||||
if (yellow_inverse && red_inverse) {
|
if (yellow_inverse && red_inverse) {
|
||||||
|
console.log('entra');
|
||||||
if (red_only_min && yellow_only_min) {
|
if (red_only_min && yellow_only_min) {
|
||||||
// C: |-------- |
|
// C: |-------- |
|
||||||
// W: |········==== |
|
// W: |········==== |
|
||||||
@ -3054,14 +3056,9 @@ console.log(data_module_graph);
|
|||||||
xaxes: [{
|
xaxes: [{
|
||||||
axisLabelFontSizePixels: font_size,
|
axisLabelFontSizePixels: font_size,
|
||||||
mode: "time",
|
mode: "time",
|
||||||
//min: date_array.start_date * 1000,
|
tickFormatter: xFormatter
|
||||||
//max: date_array.final_date * 1000,
|
|
||||||
tickFormatter: xFormatter,
|
|
||||||
// timeformat: "%Y/%m/%d %H:%M:%S",
|
|
||||||
}],
|
}],
|
||||||
yaxes: [{
|
yaxes: [{
|
||||||
//min: min_check,
|
|
||||||
//max: 5000,
|
|
||||||
tickFormatter: yFormatter,
|
tickFormatter: yFormatter,
|
||||||
color: '',
|
color: '',
|
||||||
alignTicksWithAxis: 1,
|
alignTicksWithAxis: 1,
|
||||||
@ -3086,7 +3083,7 @@ console.log(data_module_graph);
|
|||||||
|
|
||||||
var stack = 0, bars = true, lines = false, steps = false;
|
var stack = 0, bars = true, lines = false, steps = false;
|
||||||
var plot = $.plot($('#' + graph_id), datas, options);
|
var plot = $.plot($('#' + graph_id), datas, options);
|
||||||
console.log(plot);
|
|
||||||
// Re-calculate the graph height with the legend height
|
// Re-calculate the graph height with the legend height
|
||||||
if (dashboard || vconsole) {
|
if (dashboard || vconsole) {
|
||||||
var hDiff = $('#'+graph_id).height() - $('#legend_'+graph_id).height();
|
var hDiff = $('#'+graph_id).height() - $('#legend_'+graph_id).height();
|
||||||
@ -3144,8 +3141,7 @@ console.log(data_module_graph);
|
|||||||
if (menu == 0) {
|
if (menu == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXX
|
|
||||||
dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||||
//time_format_y = dataInSelection;
|
//time_format_y = dataInSelection;
|
||||||
dataInPlot = plot.getData()[0].data.length;
|
dataInPlot = plot.getData()[0].data.length;
|
||||||
@ -3159,12 +3155,11 @@ console.log(data_module_graph);
|
|||||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to},
|
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to},
|
||||||
xaxes: [ {
|
xaxes: [ {
|
||||||
tickFormatter: xFormatter,
|
tickFormatter: xFormatter,
|
||||||
//XXX
|
|
||||||
//minTickSize: new_steps,
|
|
||||||
color: ''
|
color: ''
|
||||||
} ],
|
} ],
|
||||||
legend: { show: false }
|
legend: { show: true }
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (thresholded) {
|
if (thresholded) {
|
||||||
var zoom_data_threshold = new Array ();
|
var zoom_data_threshold = new Array ();
|
||||||
|
|
||||||
@ -3212,7 +3207,6 @@ console.log(data_module_graph);
|
|||||||
function updateLegend() {
|
function updateLegend() {
|
||||||
updateLegendTimeout = null;
|
updateLegendTimeout = null;
|
||||||
var pos = latestPosition;
|
var pos = latestPosition;
|
||||||
console.log(pos);
|
|
||||||
|
|
||||||
var axes = currentPlot.getAxes();
|
var axes = currentPlot.getAxes();
|
||||||
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
|
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
|
||||||
@ -3224,13 +3218,11 @@ console.log(data_module_graph);
|
|||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
console.log(dataset);
|
|
||||||
for (k = 0; k < dataset.length; k++) {
|
for (k = 0; k < dataset.length; k++) {
|
||||||
|
|
||||||
// k is the real series counter
|
// k is the real series counter
|
||||||
// i is the series counter without thresholds
|
// i is the series counter without thresholds
|
||||||
var series = dataset[k];
|
var series = dataset[k];
|
||||||
console.log(series);
|
|
||||||
if (series.label == null) {
|
if (series.label == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3411,7 +3403,6 @@ console.log(data_module_graph);
|
|||||||
|
|
||||||
// Format functions
|
// Format functions
|
||||||
function xFormatter(v, axis) {
|
function xFormatter(v, axis) {
|
||||||
//console.log('x: '+ v);
|
|
||||||
//XXX
|
//XXX
|
||||||
/*
|
/*
|
||||||
if ($period <= SECONDS_6HOURS) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
@ -3560,9 +3551,7 @@ console.log(data_module_graph);
|
|||||||
// cancel the zooming
|
// cancel the zooming
|
||||||
plot = $.plot($('#' + graph_id), data_base,
|
plot = $.plot($('#' + graph_id), data_base,
|
||||||
$.extend(true, {}, options, {
|
$.extend(true, {}, options, {
|
||||||
//XXX
|
legend: { show: true }
|
||||||
xaxis: {max: max_x },
|
|
||||||
legend: { show: false }
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$('#menu_cancelzoom_' + graph_id)
|
$('#menu_cancelzoom_' + graph_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user