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

(cherry picked from commit 00d25bc9dd)
This commit is contained in:
m-lopez-f 2015-11-25 16:03:14 +01:00
parent 806d9a55b5
commit 377cec00e7
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 .
' AND utimestamp > ' . (int) $datelimit .
' AND utimestamp < ' . (int) $date);
if (is_numeric($temp_data))
$value = $temp_data;
else
$value = count($value);
if ($temp_data) {
if (is_numeric($temp_data))
$value = $temp_data;
else
$value = count($value);
}
else {
$value = false;
}
if ($labels[$module] != '')
$temp[$module]['label'] = $labels[$module];
$temp[$module]['value'] = $value;
$temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date);
$temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date);
}
break;
case CUSTOM_GRAPH_HBARS:
case CUSTOM_GRAPH_VBARS:
@ -1421,6 +1430,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$label = $module_data['nombre'];
$temp[$label]['g'] = $temp_data;
}
break;
case CUSTOM_GRAPH_PIE:
@ -1440,7 +1450,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$value = count($value);
}
else {
$value = 0;
$value = false;
}
$total_modules += $value;
@ -1454,7 +1464,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
'unit'=>$data_module['unit']);
}
$temp['total_modules'] = $total_modules;
break;
case CUSTOM_GRAPH_GAUGE:
$datelimit = $date - $period;
@ -1465,24 +1474,25 @@ function graphic_combined_module ($module_list, $weight_list, $period,
WHERE id_agente_modulo = ' . (int) $module .
' AND utimestamp > ' . (int) $datelimit .
' AND utimestamp < ' . (int) $date);
if ( $temp_data ){
if ( $temp_data ) {
if (is_numeric($temp_data))
$value = $temp_data;
else
$value = count($value);
}
else {
$value = 0;
$value = false;
}
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
$temp[$module]['value'] = $value;
$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]['max'] = 100;
}else{
}
else {
$min = $temp[$module]['min'];
if ($temp[$module]['max'] == 0)
$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' => COL_GRAPH13, 'alpha' => 50);
switch ($stacked) {
case CUSTOM_GRAPH_AREA:
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,
min: undefined != min ? min : 0,
max: undefined != max ? max : 100,
minorTicks: 20,
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;
if (value >= min_warning){
@ -916,6 +924,7 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi
$(this).text(text);
}
});
config = false;
}
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;
}
if (!isNaN(valor)) {
createGauge(nombre, label, valor, mininum, maxinum,
minimun_warning, maximun_warning, minimun_critical,
maximun_critical, font_size, height);
}
else {
$('#'+nombre).html("<img style='vertical-align:middle;' src='"+ no_data_image +"'/>")
}
if (isNaN(valor))
valor = (-1200);
createGauge(nombre, label, valor, mininum, maxinum,
minimun_warning, maximun_warning, minimun_critical,
maximun_critical, font_size, height);
}