2012-08-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php operation/agentes/stat_win.php: Added double mode to time compare graphs modes. Separated and overlapped. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6927 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4a6653a89d
commit
600182a3a6
|
@ -1,3 +1,9 @@
|
|||
2012-08-31 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
operation/agentes/stat_win.php: Added double mode to
|
||||
time compare graphs modes. Separated and overlapped.
|
||||
|
||||
2012-06-31 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* include/functions_api.php: Added functions to api.
|
||||
|
|
|
@ -435,7 +435,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
global $warning_min;
|
||||
global $critical_min;
|
||||
|
||||
if($compare) {
|
||||
if($compare !== false) {
|
||||
$series_suffix = '2';
|
||||
$series_suffix_str = ' ('.__('Previous').')';
|
||||
// Build the data of the previous period
|
||||
|
@ -445,9 +445,19 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$show_title, $projection, $adapt_key, $compare,
|
||||
$series_suffix, $series_suffix_str);
|
||||
|
||||
// Store the chart calculated deleting index, because will be over the current period
|
||||
$chart_prev = array_values($chart);
|
||||
$legend_prev = $legend;
|
||||
switch($compare) {
|
||||
case 'separated':
|
||||
// Store the chart calculated
|
||||
$chart_prev = $chart;
|
||||
$legend_prev = $legend;
|
||||
$long_index_prev = $long_index;
|
||||
break;
|
||||
case 'overlapped':
|
||||
// Store the chart calculated deleting index, because will be over the current period
|
||||
$chart_prev = array_values($chart);
|
||||
$legend_prev = $legend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Build the data of the current period
|
||||
|
@ -460,7 +470,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
return $data_returned;
|
||||
}
|
||||
|
||||
if($compare) {
|
||||
if($compare === 'overlapped') {
|
||||
$i = 0;
|
||||
foreach($chart as $k=>$v) {
|
||||
$chart[$k] = array_merge($v,$chart_prev[$i]);
|
||||
|
@ -477,11 +487,24 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
|
|||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
|
||||
|
||||
// Color commented not to restrict serie colors
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
|
||||
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
|
||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
|
||||
if($compare === 'separated') {
|
||||
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
|
||||
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
|
||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key).
|
||||
'<br>'.
|
||||
area_graph($flash_chart, $chart_prev, $width, $height/2, $color, $legend_prev,
|
||||
$long_index_prev, "images/image_problem.opaque.png", "", $unit, $homeurl,
|
||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
|
||||
}
|
||||
else {
|
||||
// Color commented not to restrict serie colors
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
|
||||
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
|
||||
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
|
||||
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key);
|
||||
}
|
||||
}
|
||||
|
||||
function graph_get_formatted_date($timestamp, $format1, $format2) {
|
||||
|
@ -2182,22 +2205,41 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||
global $legend;
|
||||
global $long_index;
|
||||
|
||||
if($compare) {
|
||||
if($compare !== false) {
|
||||
$series_suffix = '2';
|
||||
$series_suffix_str = ' ('.__('Previous').')';
|
||||
// Build the data of the previous period
|
||||
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
$unit_name, $show_alerts, $avg_only, $date-$period, $series_suffix, $series_suffix_str);
|
||||
|
||||
// Store the chart calculated as previous
|
||||
$chart_prev = $chart;
|
||||
$legend_prev = $legend;
|
||||
$long_index_prev = $long_index;
|
||||
switch($compare) {
|
||||
case 'separated':
|
||||
// Store the chart calculated
|
||||
$chart_prev = $chart;
|
||||
$legend_prev = $legend;
|
||||
$long_index_prev = $long_index;
|
||||
break;
|
||||
case 'overlapped':
|
||||
// Store the chart calculated deleting index, because will be over the current period
|
||||
$chart_prev = array_values($chart);
|
||||
$legend_prev = $legend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
$unit_name, $show_alerts, $avg_only, $date);
|
||||
|
||||
if($compare === 'overlapped') {
|
||||
$i = 0;
|
||||
foreach($chart as $k=>$v) {
|
||||
$chart[$k] = array_merge($v,$chart_prev[$i]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$legend = array_merge($legend, $legend_prev);
|
||||
}
|
||||
|
||||
if ($only_image) {
|
||||
$flash_chart = false;
|
||||
}
|
||||
|
@ -2205,7 +2247,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => $config['homeurl'] . "/images/logo_vertical_water.png");
|
||||
|
||||
if($compare) {
|
||||
if($compare === 'separated') {
|
||||
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
|
||||
$long_index, "images/image_problem.opaque.png", "", $unit, $homeurl,
|
||||
$water_mark,
|
||||
|
|
|
@ -198,7 +198,18 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
$zoom = get_parameter ("zoom", 1);
|
||||
$baseline = get_parameter ("baseline", 0);
|
||||
$show_events_graph = get_parameter ("show_events_graph", 0);
|
||||
$time_compare = get_parameter ("time_compare", 0);
|
||||
$time_compare_separated = get_parameter ("time_compare_separated", 0);
|
||||
$time_compare_overlapped = get_parameter ("time_compare_overlapped", 0);
|
||||
|
||||
|
||||
$time_compare = false;
|
||||
|
||||
if($time_compare_separated) {
|
||||
$time_compare = 'separated';
|
||||
}
|
||||
else if($time_compare_overlapped) {
|
||||
$time_compare = 'overlapped';
|
||||
}
|
||||
|
||||
if ($zoom > 1) {
|
||||
$height = $height * ($zoom / 2.1);
|
||||
|
@ -386,11 +397,20 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
case 'sparse':
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo __('Time compare');?></td>
|
||||
<td><?php echo __('Time compare').' ('.__('Overlapped').')';?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("time_compare",
|
||||
1, (bool) $time_compare);
|
||||
html_print_checkbox ("time_compare_overlapped",
|
||||
1, (bool) $time_compare_overlapped);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Time compare').' ('.__('Separated').')';?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("time_compare_separated",
|
||||
1, (bool) $time_compare_separated);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -417,3 +437,11 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
$('#checkbox-time_compare_separated').click(function() {
|
||||
$('#checkbox-time_compare_overlapped').removeAttr('checked');
|
||||
});
|
||||
$('#checkbox-time_compare_overlapped').click(function() {
|
||||
$('#checkbox-time_compare_separated').removeAttr('checked');
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue