fixed minor errors

This commit is contained in:
daniel 2018-06-11 13:53:10 +02:00
parent b25332d014
commit adf9e4d1fe
3 changed files with 85 additions and 38 deletions

View File

@ -2913,7 +2913,7 @@ function color_graph_array(){
//XXX Colores fijos para eventos, alertas, desconocidos, percentil, overlapped, summatory, average, projection //XXX Colores fijos para eventos, alertas, desconocidos, percentil, overlapped, summatory, average, projection
$color_series['event'] = array( $color_series['event'] = array(
'border' => '#ff0000', 'border' => '#ff0000',
'color' => '#ff66cc', 'color' => '#FF5733',
'alpha' => CHART_DEFAULT_ALPHA 'alpha' => CHART_DEFAULT_ALPHA
); );
@ -3041,11 +3041,11 @@ function series_type_graph_array($data, $show_elements_graph){
} }
else{ else{
if(strpos($key, 'baseline') !== false){ if(strpos($key, 'baseline') !== false){
$data_return['legend'][$key] = $value['agent_name'] . ' / ' . $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$value['module_name'] . ' Baseline '; $value['module_name'] . ' Baseline ';
} }
else{ else{
$data_return['legend'][$key] = $value['agent_name'] . ' / ' . $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$value['module_name'] . ': '; $value['module_name'] . ': ';
} }
} }
@ -3114,7 +3114,7 @@ function series_type_graph_array($data, $show_elements_graph){
$data_return['legend'][$key] .= $show_elements_graph['labels'][$value['agent_module_id']] . ' ' ; $data_return['legend'][$key] .= $show_elements_graph['labels'][$value['agent_module_id']] . ' ' ;
} }
else{ else{
$data_return['legend'][$key] .= $value['agent_name'] . ' / ' . $data_return['legend'][$key] .= $value['agent_alias'] . ' / ' .
$value['module_name'] . ': ' . ' Value: '; $value['module_name'] . ': ' . ' Value: ';
} }
$data_return['legend'][$key] .= remove_right_zeros( $data_return['legend'][$key] .= remove_right_zeros(

View File

@ -262,16 +262,33 @@ function grafico_modulo_sparse_data_chart (
); );
} }
else{ else{
$data = db_get_all_rows_filter ( /*
'tagente_datos', if(true){
array ('id_agente_modulo' => (int)$agent_module_id, $data = db_get_all_rows_filter (
"utimestamp > '". $date_array['start_date']. "'", 'tagente_datos',
"utimestamp < '". $date_array['final_date'] . "'", array ('id_agente_modulo' => (int)$agent_module_id,
'order' => 'utimestamp ASC'), "utimestamp > '". $date_array['start_date']. "'",
array ('datos', 'utimestamp'), "utimestamp < '". $date_array['final_date'] . "'",
'AND', 'group' => "ROUND(utimestamp / 86400)",
$data_module_graph['history_db'] 'order' => 'utimestamp ASC'),
); array ('max(datos) as datos', 'min(utimestamp) as utimestamp'),
'AND',
$data_module_graph['history_db']
);
}
else{
*/
$data = db_get_all_rows_filter (
'tagente_datos',
array ('id_agente_modulo' => (int)$agent_module_id,
"utimestamp > '". $date_array['start_date']. "'",
"utimestamp < '". $date_array['final_date'] . "'",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'),
'AND',
$data_module_graph['history_db']
);
//}
} }
if($data === false){ if($data === false){
@ -362,6 +379,7 @@ function grafico_modulo_sparse_data_chart (
$array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type']; $array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name']; $array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name']; $array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data["sum" . $series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
if (!is_null($params['percentil']) && if (!is_null($params['percentil']) &&
$params['percentil'] && $params['percentil'] &&
@ -402,6 +420,7 @@ function grafico_modulo_sparse_data(
$array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type']; $array_data["sum" . $series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
$array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name']; $array_data["sum" . $series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name']; $array_data["sum" . $series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data["sum" . $series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
} }
else{ else{
$array_data = grafico_modulo_sparse_data_chart ( $array_data = grafico_modulo_sparse_data_chart (
@ -880,12 +899,13 @@ function grafico_modulo_sparse ($params) {
$data_module_graph = array(); $data_module_graph = array();
$data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]); $data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]);
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name ($agent_module_id); $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name($agent_module_id);
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias($agent_module_id);
$data_module_graph['agent_id'] = $module_data['id_agente']; $data_module_graph['agent_id'] = $module_data['id_agente'];
$data_module_graph['module_name'] = $module_data['nombre']; $data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo']; $data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
$data_module_graph['module_type'] = modules_get_moduletype_name ($data_module_graph['id_module_type']); $data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
$data_module_graph['uncompressed'] = is_module_uncompressed ($data_module_graph['module_type']); $data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
$data_module_graph['w_min'] = $module_data['min_warning']; $data_module_graph['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning']; $data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse']; $data_module_graph['w_inv'] = $module_data['warning_inverse'];
@ -1453,12 +1473,13 @@ function graphic_combined_module (
$data_module_graph = array(); $data_module_graph = array();
$data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]); $data_module_graph['history_db'] = db_search_in_history_db($date_array["start_date"]);
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name ($agent_module_id); $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name($agent_module_id);
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias($agent_module_id);
$data_module_graph['agent_id'] = $module_data['id_agente']; $data_module_graph['agent_id'] = $module_data['id_agente'];
$data_module_graph['module_name'] = $module_data['nombre']; $data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo']; $data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
$data_module_graph['module_type'] = modules_get_moduletype_name ($data_module_graph['id_module_type']); $data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
$data_module_graph['uncompressed'] = is_module_uncompressed ($data_module_graph['module_type']); $data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
$data_module_graph['w_min'] = $module_data['min_warning']; $data_module_graph['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning']; $data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse']; $data_module_graph['w_inv'] = $module_data['warning_inverse'];

View File

@ -165,9 +165,9 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
color: '' color: ''
} }
}; };
} }
var conf_pie = { var conf_pie = {
series: { series: {
pie: { pie: {
@ -1505,7 +1505,6 @@ function pandoraFlotArea(
i=0; i=0;
$.each(values, function (index, value) { $.each(values, function (index, value) {
if (typeof value.data !== "undefined") { if (typeof value.data !== "undefined") {
if(index.search("alert") >= 0){ if(index.search("alert") >= 0){
fill_color = '#ff7f00'; fill_color = '#ff7f00';
@ -1582,12 +1581,12 @@ function pandoraFlotArea(
}); });
// 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;
font_size = 8;
// minTickSize // minTickSize
var count_data = datas[0].data.length; var count_data = datas[0].data.length;
var min_tick = datas[0].data[0][0]; var min_tick = datas[0].data[0][0];
var max_tick = datas[0].data[count_data - 1][0]; var max_tick = datas[0].data[count_data - 1][0];
var number_ticks = 8; var number_ticks = 8;
if(vconsole){ if(vconsole){
@ -1623,8 +1622,15 @@ function pandoraFlotArea(
color: legend_color, color: legend_color,
autoHighlight: true autoHighlight: true
}, },
xaxis: {
min: date_array.start_date * 1000,
max: date_array.final_date * 1000
},
xaxes: [{ xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size, axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time", mode: "time",
//tickFormatter: xFormatter, //tickFormatter: xFormatter,
tickSize: [maxticks, 'hour'] tickSize: [maxticks, 'hour']
@ -1669,7 +1675,7 @@ function pandoraFlotArea(
} }
} }
/* /*//XXXXXXX
if (vconsole) { if (vconsole) {
var myCanvas = plot.getCanvas(); var myCanvas = plot.getCanvas();
plot.setupGrid(); // redraw plot to new size plot.setupGrid(); // redraw plot to new size
@ -1714,13 +1720,21 @@ if (vconsole) {
borderWidth:1, borderWidth:1,
borderColor: '#C1C1C1', borderColor: '#C1C1C1',
tickColor: background_color, tickColor: background_color,
color: legend_color color: legend_color,
autoHighlight: true
},
xaxis: {
min: date_array.start_date * 1000,
max: date_array.final_date * 1000
}, },
xaxes: [{ xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size, axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time", mode: "time",
//tickFormatter: xFormatter, //tickFormatter: xFormatter,
tickSize: [maxticks, 'hour'], tickSize: [maxticks, 'hour']
}], }],
yaxes: [{ yaxes: [{
tickFormatter: yFormatter, tickFormatter: yFormatter,
@ -1729,7 +1743,7 @@ if (vconsole) {
labelWidth: 30, labelWidth: 30,
position: 'left', position: 'left',
font: font, font: font,
reserveSpace: true, reserveSpace: true
}], }],
legend: { legend: {
position: 'se', position: 'se',
@ -1738,8 +1752,13 @@ if (vconsole) {
} }
}); });
} }
// Connection between plot and miniplot
// Adjust overview when main chart is resized
$('#overview_'+graph_id).resize(function(){
update_left_width_canvas(graph_id);
});
// 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
if (menu == 0) { if (menu == 0) {
@ -1748,9 +1767,9 @@ if (vconsole) {
dataInSelection = ranges.xaxis.to - ranges.xaxis.from; dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
var maxticks_zoom = dataInSelection / 3600000 / 6; var maxticks_zoom = dataInSelection / 3600000 / number_ticks;
if(maxticks_zoom < 0.001){ if(maxticks_zoom < 0.001){
maxticks_zoom = dataInSelection / 60000 / 6; maxticks_zoom = dataInSelection / 60000 / number_ticks;
if(maxticks_zoom < 0.001){ if(maxticks_zoom < 0.001){
maxticks_zoom = 0; maxticks_zoom = 0;
} }
@ -1780,6 +1799,10 @@ if (vconsole) {
max: ranges.xaxis.to max: ranges.xaxis.to
}, },
xaxes: [{ xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time", mode: "time",
//tickFormatter: xFormatter, //tickFormatter: xFormatter,
tickSize: [maxticks_zoom, 'hour'] tickSize: [maxticks_zoom, 'hour']
@ -1815,6 +1838,10 @@ if (vconsole) {
max: ranges.xaxis.to max: ranges.xaxis.to
}, },
xaxes: [{ xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time", mode: "time",
//tickFormatter: xFormatter, //tickFormatter: xFormatter,
tickSize: [maxticks_zoom, 'hour'] tickSize: [maxticks_zoom, 'hour']
@ -1840,7 +1867,6 @@ if (vconsole) {
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png'); $('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png');
// currentRanges = ranges;
// 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);
}); });
@ -1971,7 +1997,7 @@ if (vconsole) {
// Events // Events
$('#overview_' + graph_id).bind('plothover', function (event, pos, item) { $('#overview_' + graph_id).bind('plothover', function (event, pos, item) {
plot.setCrosshair({ x: pos.x, y: 0 }); plot.setCrosshair({ x: pos.x, y: pos.y });
currentPlot = plot; currentPlot = plot;
latestPosition = pos; latestPosition = pos;
if (!updateLegendTimeout) { if (!updateLegendTimeout) {
@ -1980,7 +2006,7 @@ if (vconsole) {
}); });
$('#' + graph_id).bind('plothover', function (event, pos, item) { $('#' + graph_id).bind('plothover', function (event, pos, item) {
overview.setCrosshair({ x: pos.x, y: 0 }); overview.setCrosshair({ x: pos.x, y: pos.y });
currentPlot = plot; currentPlot = plot;
latestPosition = pos; latestPosition = pos;
if (!updateLegendTimeout) { if (!updateLegendTimeout) {
@ -2074,7 +2100,7 @@ if (vconsole) {
}); });
$('#'+graph_id).bind('mouseout',resetInteractivity(vconsole)); $('#'+graph_id).bind('mouseout',resetInteractivity(vconsole));
if(!vconsole){ if(!vconsole){
$('#overview_'+graph_id).bind('mouseout',resetInteractivity); $('#overview_'+graph_id).bind('mouseout',resetInteractivity);
} }