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

(cherry picked from commit ede441cb3b)
This commit is contained in:
m-lopez-f 2015-12-01 08:59:44 +01:00
parent 6bc0928c32
commit 25aa41ae7a
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;
case CUSTOM_GRAPH_GAUGE:
$datelimit = $date - $period;
$i = 0;
foreach ($module_list as $module) {
$temp[$module] = modules_get_agentmodule($module);
$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);
else
$max = $temp[$module]['max'];
$temp[$module]['min'] = ($min)== 0 ? 0 : $min;
$temp[$module]['max'] = ($max)== 0 ? 100 : $max;
$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
}
$temp[$module]['gauge'] = "gauge_" . $i;
$i++;
}
break;
default:

View File

@ -264,9 +264,7 @@ function d3_gauges($chart_data, $width, $height, $color, $legend,
$output = include_javascript_d3(true);
foreach ($chart_data as $module) {
$module['nombre'] = io_safe_output($module['nombre']);
$module['nombre'] = str_replace(array(' ','(',')',"*",' '),'_',$module['nombre']);
$output .= "<div id='".$module['nombre']."' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
$output .= "<div id='".$module['gauge']."' 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;
for (key in data) {
nombre = data[key].nombre;
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,'_');
nombre = data[key].gauge;
label = undefined != data[key].label ? data[key].label : data[key].nombre;