Fixed problems with gauges in custom graphs/dashboard. Tiquet: #3025

This commit is contained in:
m-lopez-f 2015-12-01 08:59:44 +01:00
parent 91a93f7271
commit ede441cb3b
3 changed files with 7 additions and 14 deletions

View File

@ -1467,6 +1467,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
break; break;
case CUSTOM_GRAPH_GAUGE: case CUSTOM_GRAPH_GAUGE:
$datelimit = $date - $period; $datelimit = $date - $period;
$i = 0;
foreach ($module_list as $module) { foreach ($module_list as $module) {
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$temp_data = db_get_value_sql('SELECT datos $temp_data = db_get_value_sql('SELECT datos
@ -1498,9 +1499,11 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$max = reporting_get_agentmodule_data_max($module,$period,$date); $max = reporting_get_agentmodule_data_max($module,$period,$date);
else else
$max = $temp[$module]['max']; $max = $temp[$module]['max'];
$temp[$module]['min'] = ($min)== 0 ? 0 : $min; $temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
$temp[$module]['max'] = ($max)== 0 ? 100 : $max; $temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
} }
$temp[$module]['gauge'] = "gauge_" . $i;
$i++;
} }
break; break;
default: default:

View File

@ -264,9 +264,7 @@ function d3_gauges($chart_data, $width, $height, $color, $legend,
$output = include_javascript_d3(true); $output = include_javascript_d3(true);
foreach ($chart_data as $module) { foreach ($chart_data as $module) {
$module['nombre'] = io_safe_output($module['nombre']); $output .= "<div id='".$module['gauge']."' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
$module['nombre'] = str_replace(array('&#x20;','(',')',"*",' '),'_',$module['nombre']);
$output .= "<div id='".$module['nombre']."' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
} }

View File

@ -933,15 +933,7 @@ function createGauges(data, width, height, font_size, no_data_image)
mininum,maxinum,valor; mininum,maxinum,valor;
for (key in data) { for (key in data) {
nombre = data[key].nombre; nombre = data[key].gauge;
nombre = nombre.replace(/&#x20;/g,'_');
nombre = nombre.replace(/&#40;/g,'_');
nombre = nombre.replace(/&#41;/g,'_');
nombre = nombre.replace(/\*/g,'_');
nombre = nombre.replace(/\(/g,'_');
nombre = nombre.replace(/\)/g,'_');
label = undefined != data[key].label ? data[key].label : data[key].nombre; label = undefined != data[key].label ? data[key].label : data[key].nombre;