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
$color_series['event'] = array(
'border' => '#ff0000',
'color' => '#ff66cc',
'color' => '#FF5733',
'alpha' => CHART_DEFAULT_ALPHA
);
@ -3041,11 +3041,11 @@ function series_type_graph_array($data, $show_elements_graph){
}
else{
if(strpos($key, 'baseline') !== false){
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
$data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$value['module_name'] . ' Baseline ';
}
else{
$data_return['legend'][$key] = $value['agent_name'] . ' / ' .
$data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$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']] . ' ' ;
}
else{
$data_return['legend'][$key] .= $value['agent_name'] . ' / ' .
$data_return['legend'][$key] .= $value['agent_alias'] . ' / ' .
$value['module_name'] . ': ' . ' Value: ';
}
$data_return['legend'][$key] .= remove_right_zeros(

View File

@ -262,16 +262,33 @@ function grafico_modulo_sparse_data_chart (
);
}
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(true){
$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'] . "'",
'group' => "ROUND(utimestamp / 86400)",
'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){
@ -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]['agent_name'] = $data_module_graph['agent_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']) &&
$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]['agent_name'] = $data_module_graph['agent_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{
$array_data = grafico_modulo_sparse_data_chart (
@ -880,12 +899,13 @@ function grafico_modulo_sparse ($params) {
$data_module_graph = array();
$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['module_name'] = $module_data['nombre'];
$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['uncompressed'] = is_module_uncompressed ($data_module_graph['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['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
@ -1453,12 +1473,13 @@ function graphic_combined_module (
$data_module_graph = array();
$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['module_name'] = $module_data['nombre'];
$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['uncompressed'] = is_module_uncompressed ($data_module_graph['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['w_min'] = $module_data['min_warning'];
$data_module_graph['w_max'] = $module_data['max_warning'];
$data_module_graph['w_inv'] = $module_data['warning_inverse'];

View File

@ -165,9 +165,9 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
color: ''
}
};
}
var conf_pie = {
series: {
pie: {
@ -1505,7 +1505,6 @@ function pandoraFlotArea(
i=0;
$.each(values, function (index, value) {
if (typeof value.data !== "undefined") {
if(index.search("alert") >= 0){
fill_color = '#ff7f00';
@ -1582,12 +1581,12 @@ function pandoraFlotArea(
});
// The first execution, the graph data is the base data
datas = data_base;
font_size = 8;
datas = data_base;
// minTickSize
var count_data = datas[0].data.length;
var min_tick = datas[0].data[0][0];
var max_tick = datas[0].data[count_data - 1][0];
var min_tick = datas[0].data[0][0];
var max_tick = datas[0].data[count_data - 1][0];
var number_ticks = 8;
if(vconsole){
@ -1623,8 +1622,15 @@ function pandoraFlotArea(
color: legend_color,
autoHighlight: true
},
xaxis: {
min: date_array.start_date * 1000,
max: date_array.final_date * 1000
},
xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time",
//tickFormatter: xFormatter,
tickSize: [maxticks, 'hour']
@ -1669,7 +1675,7 @@ function pandoraFlotArea(
}
}
/*
/*//XXXXXXX
if (vconsole) {
var myCanvas = plot.getCanvas();
plot.setupGrid(); // redraw plot to new size
@ -1714,13 +1720,21 @@ if (vconsole) {
borderWidth:1,
borderColor: '#C1C1C1',
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: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time",
//tickFormatter: xFormatter,
tickSize: [maxticks, 'hour'],
tickSize: [maxticks, 'hour']
}],
yaxes: [{
tickFormatter: yFormatter,
@ -1729,7 +1743,7 @@ if (vconsole) {
labelWidth: 30,
position: 'left',
font: font,
reserveSpace: true,
reserveSpace: true
}],
legend: {
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) {
// do the zooming if exist menu to undo it
if (menu == 0) {
@ -1748,9 +1767,9 @@ if (vconsole) {
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){
maxticks_zoom = dataInSelection / 60000 / 6;
maxticks_zoom = dataInSelection / 60000 / number_ticks;
if(maxticks_zoom < 0.001){
maxticks_zoom = 0;
}
@ -1780,6 +1799,10 @@ if (vconsole) {
max: ranges.xaxis.to
},
xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time",
//tickFormatter: xFormatter,
tickSize: [maxticks_zoom, 'hour']
@ -1815,6 +1838,10 @@ if (vconsole) {
max: ranges.xaxis.to
},
xaxes: [{
axisLabelUseCanvas: true,
axisLabelFontSizePixels: font_size,
axisLabelFontFamily: font+'Font',
axisLabelPadding: 0,
mode: "time",
//tickFormatter: xFormatter,
tickSize: [maxticks_zoom, 'hour']
@ -1840,7 +1867,6 @@ if (vconsole) {
$('#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
overview.setSelection(ranges, true);
});
@ -1971,7 +1997,7 @@ if (vconsole) {
// Events
$('#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;
latestPosition = pos;
if (!updateLegendTimeout) {
@ -1980,7 +2006,7 @@ if (vconsole) {
});
$('#' + 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;
latestPosition = pos;
if (!updateLegendTimeout) {
@ -2074,7 +2100,7 @@ if (vconsole) {
});
$('#'+graph_id).bind('mouseout',resetInteractivity(vconsole));
if(!vconsole){
$('#overview_'+graph_id).bind('mouseout',resetInteractivity);
}