When no data, print only label. Tiquet: #2966

This commit is contained in:
m-lopez-f 2015-11-25 16:03:14 +01:00
parent f5a270de6a
commit 00d25bc9dd
2 changed files with 37 additions and 19 deletions

View File

@ -1392,16 +1392,25 @@ function graphic_combined_module ($module_list, $weight_list, $period,
WHERE id_agente_modulo = ' . (int) $module . WHERE id_agente_modulo = ' . (int) $module .
' AND utimestamp > ' . (int) $datelimit . ' AND utimestamp > ' . (int) $datelimit .
' AND utimestamp < ' . (int) $date); ' AND utimestamp < ' . (int) $date);
if (is_numeric($temp_data))
$value = $temp_data; if ($temp_data) {
else if (is_numeric($temp_data))
$value = count($value); $value = $temp_data;
else
$value = count($value);
}
else {
$value = false;
}
if ($labels[$module] != '') if ($labels[$module] != '')
$temp[$module]['label'] = $labels[$module]; $temp[$module]['label'] = $labels[$module];
$temp[$module]['value'] = $value; $temp[$module]['value'] = $value;
$temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date); $temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date);
$temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date); $temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date);
} }
break; break;
case CUSTOM_GRAPH_HBARS: case CUSTOM_GRAPH_HBARS:
case CUSTOM_GRAPH_VBARS: case CUSTOM_GRAPH_VBARS:
@ -1421,6 +1430,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else else
$label = $module_data['nombre']; $label = $module_data['nombre'];
$temp[$label]['g'] = $temp_data; $temp[$label]['g'] = $temp_data;
} }
break; break;
case CUSTOM_GRAPH_PIE: case CUSTOM_GRAPH_PIE:
@ -1440,7 +1450,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$value = count($value); $value = count($value);
} }
else { else {
$value = 0; $value = false;
} }
$total_modules += $value; $total_modules += $value;
@ -1454,7 +1464,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
'unit'=>$data_module['unit']); 'unit'=>$data_module['unit']);
} }
$temp['total_modules'] = $total_modules; $temp['total_modules'] = $total_modules;
break; break;
case CUSTOM_GRAPH_GAUGE: case CUSTOM_GRAPH_GAUGE:
$datelimit = $date - $period; $datelimit = $date - $period;
@ -1465,24 +1474,25 @@ function graphic_combined_module ($module_list, $weight_list, $period,
WHERE id_agente_modulo = ' . (int) $module . WHERE id_agente_modulo = ' . (int) $module .
' AND utimestamp > ' . (int) $datelimit . ' AND utimestamp > ' . (int) $datelimit .
' AND utimestamp < ' . (int) $date); ' AND utimestamp < ' . (int) $date);
if ( $temp_data ){ if ( $temp_data ) {
if (is_numeric($temp_data)) if (is_numeric($temp_data))
$value = $temp_data; $value = $temp_data;
else else
$value = count($value); $value = count($value);
} }
else { else {
$value = 0; $value = false;
} }
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre']; $temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
$temp[$module]['value'] = $value; $temp[$module]['value'] = $value;
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,".."); $temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
if ($temp[$module]['unit'] == '%'){ if ($temp[$module]['unit'] == '%') {
$temp[$module]['min'] = 0; $temp[$module]['min'] = 0;
$temp[$module]['max'] = 100; $temp[$module]['max'] = 100;
}else{ }
else {
$min = $temp[$module]['min']; $min = $temp[$module]['min'];
if ($temp[$module]['max'] == 0) if ($temp[$module]['max'] == 0)
$max = reporting_get_agentmodule_data_max($module,$period,$date); $max = reporting_get_agentmodule_data_max($module,$period,$date);
@ -1561,6 +1571,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$color[15] = array('border' => '#000000', $color[15] = array('border' => '#000000',
'color' => COL_GRAPH13, 'alpha' => 50); 'color' => COL_GRAPH13, 'alpha' => 50);
switch ($stacked) { switch ($stacked) {
case CUSTOM_GRAPH_AREA: case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width, return area_graph($flash_charts, $graph_values, $width,

View File

@ -866,10 +866,18 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi
label: etiqueta, label: etiqueta,
min: undefined != min ? min : 0, min: undefined != min ? min : 0,
max: undefined != max ? max : 100, max: undefined != max ? max : 100,
minorTicks: 20,
font_size: font_size font_size: font_size
} }
if (value == -1200) {
config.majorTicks = 1;
config.minorTicks = 1;
value = false;
}
else {
config.minorTicks = 10;
}
//var range = config.max - config.min; //var range = config.max - config.min;
var range = config.max - config.min; var range = config.max - config.min;
if (value >= min_warning){ if (value >= min_warning){
@ -916,6 +924,7 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi
$(this).text(text); $(this).text(text);
} }
}); });
config = false;
} }
function createGauges(data, width, height, font_size, no_data_image) function createGauges(data, width, height, font_size, no_data_image)
@ -976,14 +985,12 @@ function createGauges(data, width, height, font_size, no_data_image)
minimun_warning = mininum; minimun_warning = mininum;
} }
if (!isNaN(valor)) { if (isNaN(valor))
createGauge(nombre, label, valor, mininum, maxinum, valor = (-1200);
minimun_warning, maximun_warning, minimun_critical, createGauge(nombre, label, valor, mininum, maxinum,
maximun_critical, font_size, height); minimun_warning, maximun_warning, minimun_critical,
} maximun_critical, font_size, height);
else {
$('#'+nombre).html("<img style='vertical-align:middle;' src='"+ no_data_image +"'/>")
}
} }