2011-04-06 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_graph.php: wip in the function
	"graphic_combined_module2".
	
	* include/graphs/functions_fsgraph.php: fixed when "fs_area_graph" when
	send a graph without the colours or and legend.
	
	* include/graphs/fgraph.php: erased lost session instructions in the
	function "area_graph".



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4175 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-04-06 14:42:31 +00:00
parent a5ed5b3571
commit ee963b0ae0
4 changed files with 79 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2011-04-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php: wip in the function
"graphic_combined_module2".
* include/graphs/functions_fsgraph.php: fixed when "fs_area_graph" when
send a graph without the colours or and legend.
* include/graphs/fgraph.php: erased lost session instructions in the
function "area_graph".
2011-04-06 Javier Lanz <javier.lanz@artica.es> 2011-04-06 Javier Lanz <javier.lanz@artica.es>
* include/functions_reporting.php: Added case to display 'agent_module' * include/functions_reporting.php: Added case to display 'agent_module'

View File

@ -425,7 +425,10 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
$k = 0; $k = 0;
// Set initial conditions // Set initial conditions
$graph_values[$i] = array();
//$graph_values[$i] = array();
$temp_graph_values = array();
if ($data[0]['utimestamp'] == $datelimit) { if ($data[0]['utimestamp'] == $datelimit) {
$previous_data = $data[0]['datos']; $previous_data = $data[0]['datos'];
$j++; $j++;
@ -474,23 +477,48 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
// Data // Data
if ($count > 0) { if ($count > 0) {
$graph_values[$i][$timestamp] = $total * $weight_list[$i]; //$graph_values[$i][$timestamp] = $total * $weight_list[$i];
$temp_graph_values[$timestamp] = $total * $weight_list[$i];
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else { } else {
if ($uncompressed_module || ($timestamp > time ())) { if ($uncompressed_module || ($timestamp > time ())) {
$graph_values[$i][$timestamp] = 0; //$graph_values[$i][$timestamp] = 0;
} else { $temp_graph_values[$timestamp] = 0;
$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i]; }
else {
//$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i];
$temp_graph_values[$timestamp] = $previous_data * $weight_list[$i];
} }
} }
$graph_values[$i] = $temp_graph_values;
}
if ($weight_list[$i] != 1) {
$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
}
$graph_values[$module_name_list[$i]] = $graph_values[$i];
unset($graph_values[$i]);
}
$temp = array(); //debugPrint($graph_values);
foreach ($graph_values as $graph_group => $point) {
foreach ($point as $timestamp_point => $point_value) {
$temp[$timestamp_point][$graph_group] = $point_value;
} }
} }
$graph_values = $temp;
/*
for ($i = 0; $i < $module_number; $i++) { for ($i = 0; $i < $module_number; $i++) {
if ($weight_list[$i] != 1) if ($weight_list[$i] != 1) {
$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")"; $module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
}
} }
*/
if ($period <= 3600) { if ($period <= 3600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
@ -512,7 +540,7 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
switch ($stacked) { switch ($stacked) {
case 0: case 0:
return area_graph($config['flash_charts'], $graph_values, $width, $height, return area_graph($config['flash_charts'], $graph_values, $width, $height,
$color, $legend, $long_index); array(), $module_name_list, array());
return; return;
break; break;
default: default:

View File

@ -58,7 +58,6 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,$legend,
$graph['legend'] = $legend; $graph['legend'] = $legend;
serialize_in_temp($graph, $id_graph); serialize_in_temp($graph, $id_graph);
session_write_close();
return "<img src='http://127.0.0.1/pandora_console/include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>"; return "<img src='http://127.0.0.1/pandora_console/include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>";
} }

View File

@ -70,9 +70,11 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
$show_name = '1'; $show_name = '1';
} }
$chart->addCategory($i, //''); if (isset($long_index[$i])) {
'hoverText=' . $long_index[$i] . $chart->addCategory($i, //'');
';showName=' . $show_name); 'hoverText=' . $long_index[$i] .
';showName=' . $show_name);
}
$c = 0; $c = 0;
foreach($values as $i2 => $value) { foreach($values as $i2 => $value) {
@ -90,15 +92,38 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
$empty = 1; $empty = 1;
foreach ($data as $i => $value) { foreach ($data as $i => $value) {
$showAreaBorder = 0;
if (!is_null($color[$i]['border'])) { $legend = '';
$showAreaBorder = 1; if (isset($legend[$i])) {
$legend = $legend[$i];
} }
$chart->addDataSet($legend[$i], 'alpha=' . $color[$i]['alpha'] . ';' . $alpha = '';
$areaBorderColor = '';
$color = '';
$showAreaBorder = 0;
if (isset($color[$i])) {
if (!isset($color[$i]['border'])) {
$showAreaBorder = 1;
}
if (isset($color[$i]['alpha'])) {
$alpha = 'alpha=' . $color[$i]['alpha'] . ';';
}
if (isset($color[$i]['border'])) {
$areaBorderColor = 'areaBorderColor=' . $color[$i]['border'] . ';';
}
if (isset($color[$i]['color'])) {
$color = 'color=#' . $color[$i]['color'];
}
}
$chart->addDataSet($legend, $alpha .
'showAreaBorder=' . $showAreaBorder . ';' . 'showAreaBorder=' . $showAreaBorder . ';' .
'areaBorderColor=' . $color[$i]['border'] . ';' . $areaBorderColor .
'color=#' . $color[$i]['color']); $color);
$count = 0; $count = 0;
$step = 10; $step = 10;