2011-03-31 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_graph.php, include/graphs/functions_fsgraph.php: add
	to support and wip with new graph engine.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4153 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-31 08:46:04 +00:00
parent 2e2090d322
commit 89ffa67740
3 changed files with 51 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2011-03-31 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_fsgraph.php: add
to support and wip with new graph engine.
2011-03-31 Sergio Martin <sergio.martin@artica.es> 2011-03-31 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php: Improved * include/graphs/functions_pchart.php: Improved

View File

@ -257,8 +257,16 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
$color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50);
$color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 100); $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 100);
$color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 100); $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 100);
$color['min'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); $color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10);
area_graph(0, $chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline, $color); $legend = array();
$legend['sum'] = __('Avg') . ' (' . $avg_value . ')';
$legend['event'] = __('Events');
$legend['alert'] = __('Alerts');
$legend['max'] = __('Max') . ' (' . $max_value . ')';
$legend['min'] = __('Min') . ' (' . $min_value . ')';
$legend['baseline'] = __('Baseline');
area_graph(0, $chart, $width, $height, $avg_only, $resolution / 10, $time_format, $show_events, $show_alerts, $caption, $baseline, $color, $legend);
} }
?> ?>

View File

@ -49,7 +49,7 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
$total_min = 0; $total_min = 0;
// Create categories // Create categories
foreach ($data as $value) { foreach ($data as $i => $value) {
$total_avg +=$value["sum"]; $total_avg +=$value["sum"];
@ -66,7 +66,8 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
} else { } else {
$show_name = '0'; $show_name = '0';
} }
$chart->addCategory(date($time_format, $value['timestamp_bottom']), 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $value['timestamp_bottom']) . ';showName=' . $show_name); $chart->addCategory(date($time_format, $i),
'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $i) . ';showName=' . $show_name);
} }
if ($count > 0) if ($count > 0)
@ -74,12 +75,20 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
else else
$total_avg = 0; $total_avg = 0;
$total_min = format_for_graph ($total_min); //$total_min = format_for_graph ($total_min);
$total_max = format_for_graph ($total_max); //$total_max = format_for_graph ($total_max);
// Event chart // Event chart
if ($show_events == 1) { if ($show_events == 1) {
$chart->addDataSet(__('Events'), 'alpha=50;showAreaBorder=1;areaBorderColor=#ff7f00;color=#ff7f00'); $showAreaBorder = 0;
if (!is_null($color['event']['border'])) {
$showAreaBorder = 1;
}
$chart->addDataSet($caption['event'], 'alpha=' . $color['event']['alpha'] . ';' .
'showAreaBorder=' . $showAreaBorder . ';' .
'areaBorderColor=' . $color['event']['border'] . ';' .
'color=#' . $color['event']['color']);
foreach ($data as $value) { foreach ($data as $value) {
$chart->addChartData($value['event']); $chart->addChartData($value['event']);
} }
@ -87,7 +96,15 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
// Alert chart // Alert chart
if ($show_alerts == 1) { if ($show_alerts == 1) {
$chart->addDataSet(__('Alerts'), 'alpha=50;showAreaBorder=1;areaBorderColor=#ff0000;color=#ff0000'); $showAreaBorder = 0;
if (!is_null($color['alert']['border'])) {
$showAreaBorder = 1;
}
$chart->addDataSet($caption['alert'], 'alpha=' . $color['alert']['alpha'] . ';' .
'showAreaBorder=' . $showAreaBorder . ';' .
'areaBorderColor=' . $color['alert']['border'] . ';' .
'color=' . $color['alert']['color']);
foreach ($data as $value) { foreach ($data as $value) {
$chart->addChartData($value['alert']); $chart->addChartData($value['alert']);
} }
@ -95,7 +112,7 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
// Max chart // Max chart
if ($avg_only == 0) { if ($avg_only == 0) {
$chart->addDataSet(__('Max')." ($total_max)", 'color=' . $config['graph_color3']); $chart->addDataSet($caption['max'], 'color=' . $color['max']['color']);
foreach ($data as $value) { foreach ($data as $value) {
$chart->addChartData($value['max']); $chart->addChartData($value['max']);
} }
@ -103,7 +120,7 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
// Avg chart // Avg chart
$empty = 1; $empty = 1;
$chart->addDataSet(__('Avg'). " ($total_avg)", 'color=' . $config['graph_color2']); $chart->addDataSet($caption['sum'], 'color=' . $color['sum']['color']);
foreach ($data as $value) { foreach ($data as $value) {
if ($value['sum'] > 0) { if ($value['sum'] > 0) {
$empty = 0; $empty = 0;
@ -113,7 +130,7 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
// Min chart // Min chart
if ($avg_only == 0) { if ($avg_only == 0) {
$chart->addDataSet(__('Min'). " ($total_min)", 'color=' . $config['graph_color1']); $chart->addDataSet($caption['min'], 'color=' . $color['min']['color']);
foreach ($data as $value) { foreach ($data as $value) {
$chart->addChartData($value['min']); $chart->addChartData($value['min']);
} }
@ -121,7 +138,14 @@ function fs_module_chart ($data, $width, $height, $avg_only = 1, $step = 10, $ti
// Baseline chart // Baseline chart
if ($baseline == 1) { if ($baseline == 1) {
$chart->addDataSet(__('Baseline'), 'color=0097BD;alpha=10;showAreaBorder=0;'); $showAreaBorder = 0;
if (!is_null($color['baseline']['border'])) {
$showAreaBorder = 1;
}
$chart->addDataSet($caption['baseline'], 'color=' . $color['baseline']['color'] . ';' .
'alpha=' . $color['baseline']['alpha'] . ';' .
'showAreaBorder=' . $showAreaBorder . ';');
foreach ($data as $value) { foreach ($data as $value) {
$chart->addChartData($value['baseline']); $chart->addChartData($value['baseline']);
} }