2011-03-30 Javier Lanz <javier.lanz@artica.es>

* include/functions_reporting.php: Fixed get_agentmodule_sla_array and
	added functionality to show the table, table+graph or only graph
	* include/pchart_graph.php: Fixed function graph_sla_horizontal
	* include/pandora_graph.php: Changed function graph_sla_horizontal
	prototype
	* include/fgraph.php: Deleted function graph_sla_pie, fixed function
	graph_sla_horizontal and added two more cases for printing graphs
	* godmode/reporting/reporting_builder.php: Changed getting parameter
	of two checkboxes for two comboboxes
	* godmode/reporting/reporting_builder.item_editor.php: Added the options
	for the combo to select display table, table+graph or only graph


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4145 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
javilanz 2011-03-30 12:04:45 +00:00
parent 8da9e5ddf9
commit b008e2fba1
7 changed files with 253 additions and 116 deletions

View File

@ -1,3 +1,18 @@
2011-03-30 Javier Lanz <javier.lanz@artica.es>
* include/functions_reporting.php: Fixed get_agentmodule_sla_array and
added functionality to show the table, table+graph or only graph
* include/pchart_graph.php: Fixed function graph_sla_horizontal
* include/pandora_graph.php: Changed function graph_sla_horizontal
prototype
* include/fgraph.php: Deleted function graph_sla_pie, fixed function
graph_sla_horizontal and added two more cases for printing graphs
* godmode/reporting/reporting_builder.php: Changed getting parameter
of two checkboxes for two comboboxes
* godmode/reporting/reporting_builder.item_editor.php: Added the options
for the combo to select display table, table+graph or only graph
2011-03-29 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/stat_win.php, godmode/servers/plugin.php: cleaned source

View File

@ -22,6 +22,10 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
require ("general/noaccess.php");
exit;
}
$show_graph_options = Array();
$show_graph_options[0] = __('Only table');
$show_graph_options[1] = __('Table & Graph');
$show_graph_options[2] = __('Only graph');
enterprise_include('/godmode/reporting/reporting_builder.item_editor.php');
@ -458,7 +462,8 @@ print_input_hidden('id_item', $idItem);
</tr>
<tr id="row_show_graph" style="" class="datos">
<td><?php echo __('Show graph');?></td>
<td><?php print_checkbox('checkbox_show_graph', 1, $show_graph);?></td>
<td><?php print_select ($show_graph_options, 'combo_graph_options', $show_graph);?></td>
</tr>
<tr id="row_show_resume" style="" class="datos">
<td><?php echo __('Show resume');?></td>

View File

@ -194,7 +194,7 @@ switch ($action) {
$values['top_n_value'] = get_parameter('quantity');
$values['exception_condition'] = get_parameter('radiobutton_exception_condition');
$values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['show_graph'] = get_parameter('checkbox_show_graph');
$values['show_graph'] = get_parameter('combo_graph_options');
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
$values['treport_custom_sql_id'] = get_parameter('id_custom');
@ -247,7 +247,7 @@ switch ($action) {
$values['top_n_value'] = get_parameter('quantity');
$values['exception_condition'] = get_parameter('radiobutton_exception_condition');
$values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['show_graph'] = get_parameter('checkbox_show_graph');
$values['show_graph'] = get_parameter('combo_graph_options');
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {

View File

@ -2319,20 +2319,9 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 1) {
generic_pie_graph ($width, $height, $data);
break;
}
}
function graph_sla_pie ($value1, $value2, $value3, $value4, $width, $height) {
$data_graph = array ();
$data_graph[__('Inside limits')] = $value1;
$data_graph[__('Out of limits')] = $value2;
$data_graph[__('On the edge')] = $value3;
$data_graph[__('Unknown')] = $value4;
generic_pie_graph ($width, $height, $data_graph, array ('show_legend' => true));
}
function graph_sla_horizontal ($progress, $width, $height, $id) {
function graph_sla_horizontal ($id, $period, $sla_min, $sla_max, $daysWeek, $time_from, $time_to, $sla_limit, $width, $height) {
global $config;
$engine = get_graph_engine ();
@ -2340,13 +2329,9 @@ function graph_sla_horizontal ($progress, $width, $height, $id) {
$engine->width = $width;
$engine->height = $height;
$engine->fontpath = $config['fontpath'];
$engine->background_color = '#FFFFFF';
$engine->show_title = true;
$engine->title = format_numeric ($progress).' %';
$color = '#2C5196';
$engine->graph_sla_horizontal ($progress, $color);
$days = json_decode ($daysWeek, true);
$data = get_agentmodule_sla_array ($id, $period, $sla_min, $sla_max, $sla_limit, $days, $time_from, $time_to);
$engine->graph_sla_horizontal ($data);
}
@ -2418,7 +2403,8 @@ $mode = get_parameter ("mode", 1);
$url = get_parameter ("url");
$report_id = (int) get_parameter ("report_id", 0);
$baseline = (int) get_parameter ('baseline', 0);
$daysWeek = (string) get_parameter ('daysWeek', null);
$array = (string) get_parameter('array', null);
if ($graphic_type) {
switch ($graphic_type) {
case 'sparse':
@ -2544,11 +2530,18 @@ if ($graphic_type) {
graph_custom_sql_graph ($report_id, $width, $height, 3);
break;
case 'sla_pie_graph':
graph_sla_pie ($value1, $value2, $value3, $value4, $width, $height);
break;
case 'sla_horizontal_graph':
graph_sla_horizontal (20, $width, $height, $id);
graph_sla_horizontal ($id, $period, $value1, $value2, $daysWeek, $value3, $value4, $percent, $width, $height);
break;
case 'generic_pie_graph':
$data_pie_graph = array();
$data_pie_graph = json_decode(safe_output($array), true);
generic_pie_graph ($width, $height, $data_pie_graph, array ('show_legend' => true));
break;
case 'generic_horizontal_bar_graph':
$data_pie_graph = array();
$data_pie_graph = json_decode(safe_output($array), true);
generic_horizontal_bar_graph ($width, $height, $data_pie_graph);
break;
case 'graphic_error':

View File

@ -506,25 +506,47 @@ function get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $ma
// Return the percentage of SLA compliance
return (float) (100 - ($bad_period / $period) * 100);
}
function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $daysWeek = null, $timeFrom = null, $timeTo = null) {
/**
* Get several SLA data for an agentmodule within a period divided on subperiods
*
* @param int Agent module to calculate SLA
* @param int Period to check the SLA compliance.
* @param int Minimum data value the module in the right interval
* @param int Maximum data value the module in the right interval. False will
* ignore max value
* @param array $days Array of days week to extract as array('monday' => false, 'tuesday' => true....), and by default is null.
* @param string $timeFrom Time in the day to start to extract in mysql format, by default null.
* @param string $timeTo Time in the day to end to extract in mysql format, by default null.
*
* @return Array with values either 1, 2, 3 or 4 depending if the SLA percentage for this subperiod
* is within the sla limits, on the edge, outside or with an unknown value.
*/
function get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $sla_limit = 0, $days = null, $timeFrom = null, $timeTo = null) {
global $config;
// Get date
$date = (string) get_parameter ('date', date ('Y-m-j'));
$time = (string) get_parameter ('time', date ('h:iA'));
$datetime = strtotime ($date.' '.$time);
$k=10;
$k=20;
$slices = $config["graph_res"] * $k;
$sub_period = $period / ($config["graph_res"] * 10);
$sub_period = $period / $slices;
$final_time = $datetime - $period + $sub_period;
$data = array();
$i = 0;
while ($final_time <= $datetime) {
$sla_value = get_agentmodule_sla ($id_agent_module, $sub_period, $min_value, $max_value, $final_time,
$daysWeek, $timeFrom, $timeTo);
$data[$i] = $sla_value;
$days, $timeFrom, $timeTo);
if ($sla_value == false) {// 4 for the Unknown value
$data[$i] = 4;
} elseif (($sla_value >= ($sla_limit - 10)) && ($sla_value <= ($sla_limit + 10))) {//2 when value is within the edges
$data[$i] = 2;
} elseif ($sla_value > ($sla_limit + 10)) { //1 when value is OK
$data[$i] = 1;
} elseif ($sla_value < ($sla_value - 10)) { //3 when value is Wrong
$data[$i] = 3;
}
$final_time += $sub_period;
$i++;
}
@ -1909,7 +1931,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$slas = array ();
break;
}
else {
elseif ($show_graph == 0 || $show_graph == 1) {
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
@ -1939,6 +1961,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
$content['time_to']);
//Fill the array data_graph for the pie graph
if ($sla_value === false) {
$data_graph[__('Unknown')]++;
@ -1956,66 +1979,72 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
//Do not show right modules if 'only_display_wrong' is active
if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue;
$data = array ();
$data[0] = printTruncateText(get_agentmodule_agent_name ($sla['id_agent_module']));
$data[1] = printTruncateText(get_agentmodule_name ($sla['id_agent_module']));
$data[2] = $sla['sla_max'].' / ';
$data[2] .= $sla['sla_min'];
$data[3] = $sla['sla_limit'];
if ($sla_value === false) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
$data[5] = __('Unknown');
} else {
if ($sla_value >= $sla['sla_limit']) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
if ($show_graph == 0 || $show_graph == 1) {
$data = array ();
$data[0] = printTruncateText(get_agentmodule_agent_name ($sla['id_agent_module']));
$data[1] = printTruncateText(get_agentmodule_name ($sla['id_agent_module']));
$data[2] = $sla['sla_max'].' / ';
$data[2] .= $sla['sla_min'];
$data[3] = $sla['sla_limit'];
if ($sla_value === false) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
$data[5] = __('Unknown');
} else {
if ($sla_value >= $sla['sla_limit']) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
}
else {
$sla_failed = true;
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';
}
$data[4] .= format_numeric ($sla_value). " %";
}
else {
$sla_failed = true;
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';
}
$data[4] .= format_numeric ($sla_value). " %";
$data[4] .= "</span>";
array_push ($table1->data, $data);
}
$data[4] .= "</span>";
array_push ($table1->data, $data);
}
$table->colspan[2][0] = 3;
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
if ($show_graph == 0 || $show_graph == 1) {
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
}
$table->colspan[3][0] = 3;
$data = array();
if ($show_graph && !empty($slas)) {
$data_pie_graph = json_encode ($data_graph);
if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) {
if($config['flash_charts']) {
$data[0] = fs_3d_pie_chart ($data_graph, 370, 180);
}
else {
//Display pie graph
$data[0] = '<img src="include/fgraph.php?tipo=sla_pie_graph&value1='.$data_graph[__('Inside limits')].
'&value2='.$data_graph[__('Out of limits')].'&value3='.$data_graph[__('On the edge')].
'&value4='.$data_graph[__('Unknown')].'&height=150&width=500">';
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_pie_graph.
"&height=150&width=500'>";
}
array_push ($table->data, $data);
//Display horizontal bar graphs
$days = array ('monday' => $content['monday'], 'tuesday' => $content['tuesday'],
'wednesday' => $content['wednesday'], 'thursday' => $content['thursday'],
'friday' => $content['friday'], 'saturday' => $content['saturday'], 'sunday' => $content['sunday']);
$daysWeek = json_encode ($days);
$table2->width = '99%';
$table2->data = array ();
foreach ($slas as $sla) {
$data = array();
$data[0] =
$data[0] = get_agentmodule_agent_name ($sla['id_agent_module']);
$data[0] .= '/';
$data[0] .= get_agentmodule_name ($sla['id_agent_module']);
$data[1] = '<img src="include/fgraph.php?tipo=sla_horizontal_graph&id='.$sla['id_agent_module'].
'&period='.$content['period'].'&value1='.$sla['sla_min'].'&value2='.$sla['sla_max'].
'&value3='.$content['time_from'].'&value4='.$content['time_to'].'&percent='.$sla['sla_limit'].
'&height=15&width=550">';
$data[1] = "<img src='include/fgraph.php?tipo=sla_horizontal_graph&id=".$sla['id_agent_module'].
"&period=".$content['period']."&value1=".$sla['sla_min']."&value2=".$sla['sla_max'].
"&value3=".$content['time_from']."&value4=".$content['time_to']."&percent=".$sla['sla_limit'].
"&daysWeek=".$daysWeek."&height=15&width=550'>";
array_push ($table2->data, $data);
}
$table->colspan[4][0] = 3;
@ -2790,6 +2819,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$order_uptodown = $content['order_uptodown'];
$top_n = $content['top_n'];
$top_n_value = $content['top_n_value'];
$show_graph = $content['show_graph'];
$table->style[1] = 'text-align: right';
$data = array ();
@ -2819,16 +2849,17 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
break;
}
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Agent');
$table1->head[1] = __('Module');
$table1->head[2] = __('Value');
$table1->style[0] = 'text-align: center';
$table1->style[1] = 'text-align: center';
$table1->style[2] = 'text-align: center';
if ($show_graph == 0 || $show_graph == 1) {
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Agent');
$table1->head[1] = __('Module');
$table1->head[2] = __('Value');
$table1->style[0] = 'text-align: center';
$table1->style[1] = 'text-align: center';
$table1->style[2] = 'text-align: center';
}
$data_top = array();
foreach ($tops as $key => $row) {
switch ($top_n) {
@ -2900,33 +2931,65 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
if ($order_uptodown == 1 || $order_uptodown == 2) {
$i = 0;
$data_pie_graph = array();
foreach ($data_top as $dt) {
$data = array();
$data[0] = printTruncateText($agent_name[$i], 30);
$data[1] = printTruncateText($module_name[$i], 30);
$data[2] = $dt;
array_push ($table1->data, $data);
$data_pie_graph[$agent_name[$i]] = $dt;
if ($show_graph == 0 || $show_graph == 1) {
$data = array();
$data[0] = printTruncateText($agent_name[$i], 30);
$data[1] = printTruncateText($module_name[$i], 30);
$data[2] = $dt;
array_push ($table1->data, $data);
}
$i++;
if ($i >= $top_n_value) break;
}
}
else if ($order_uptodown == 0 || $order_uptodown == 3) {
$i = 0;
$data_pie_graph = array();
foreach ($agent_name as $an) {
$data = array();
$data[0] = printTruncateText($an, 30);
$data[1] = printTruncateText($module_name[$i], 30);
$data[2] = $data_top[$i];
array_push ($table1->data, $data);
$data_pie_graph[$an] = $data_top[$i];
if ($show_graph == 0 || $show_graph == 1) {
$data = array();
$data[0] = printTruncateText($an, 30);
$data[1] = printTruncateText($module_name[$i], 30);
$data[2] = $data_top[$i];
array_push ($table1->data, $data);
}
$i++;
if ($i >= $top_n_value) break;
}
}
$table->colspan[2][0] = 3;
if ($show_graph == 0 || $show_graph == 1) {
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
}
$table->colspan[3][0] = 3;
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
if ($show_graph == 1 || $show_graph == 2) {
if($config['flash_charts']) {
$data[0] = fs_3d_pie_chart ($data_pie_graph, 370, 180);
}
else {
$data_graph = json_encode ($data_pie_graph);
//Display pie graph
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_graph.
"&height=150&width=600'>";
}
array_push ($table->data, $data);
//Display bars graph
$table->colspan[4][0] = 3;
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = "<img src='include/fgraph.php?tipo=generic_horizontal_bar_graph&array=".$data_graph.
"&height=".$height."width=600'>";
array_push ($table->data, $data);
}
if ($content['show_resume'] && count($data_top_values) > 0) {
//Get the very first not null value
@ -2960,6 +3023,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$order_uptodown = $content['order_uptodown'];
$exception_condition = $content['exception_condition'];
$exception_condition_value = $content['exception_condition_value'];
$show_graph = $content['show_graph'];
$table->style[1] = 'text-align: right';
$data = array ();
@ -3007,15 +3071,17 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
break;
}
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Agent');
$table1->head[1] = __('Module');
$table1->head[2] = __('Value');
$table1->style[0] = 'text-align: center';
$table1->style[1] = 'text-align: center';
$table1->style[2] = 'text-align: center';
if ($show_graph == 0 || $show_graph == 1) {
$table1->width = '99%';
$table1->data = array ();
$table1->head = array ();
$table1->head[0] = __('Agent');
$table1->head[1] = __('Module');
$table1->head[2] = __('Value');
$table1->style[0] = 'text-align: center';
$table1->style[1] = 'text-align: center';
$table1->style[2] = 'text-align: center';
}
//Get the very first not null value
$i=0;
@ -3033,7 +3099,6 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
if ($value > $max) $max = $value;
if ($value < $min) $min = $value;
$avg += $value;
$i++;
switch ($exception_condition) {
//Display everything
case 0:
@ -3067,14 +3132,40 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
}
break;
}
$i++;
$data_exceptions[] = $value;
$id_agent_module[] = $exc['id_agent_module'];
$agent_name[] = $exc['agent_name'];
$module_name[] = $exc['module_name'];
}
}
//$i <= 0 means that there are no rows on the table, therefore no modules under the conditions defined.
if ($i<=0) {
$data = array ();
$table->colspan[2][0] = 3;
$data[0] = __('There are no');
switch ($exception_condition) {
case 1:
$data[0] .= ' '.__('Modules over or equal to').' '.$exception_condition_value;
break;
case 2:
$data[0] .= ' '.__('Modules under').' '.$exception_condition_value;
break;
case 3:
$data[0] .= ' '.__('Modules at normal status');
break;
case 4:
$data[0] .= ' '.__('Modules at critial or warning status');
break;
default:
$data[0] .= ' '.__('Modules under those conditions');
break;
}
array_push ($table->data, $data);
break;
}
//$i > 0 means that there is at least one row on the table
if ($i > 0) {
elseif ($i > 0) {
$avg = $avg / $i;
switch ($order_uptodown) {
@ -3095,7 +3186,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
if ($order_uptodown == 1 || $order_uptodown == 2) {
$j=0;
$data_pie_graph = array();
foreach ($data_exceptions as $dex) {
$data_pie_graph[$agent_name[$j]] = $dex;
$data = array();
$data[0] = printTruncateText($agent_name[$j], 30);
$data[1] = printTruncateText($module_name[$j], 30);
@ -3106,7 +3199,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
}
else if ($order_uptodown == 0 || $order_uptodown == 3) {
$j=0;
$data_pie_graph = array();
foreach ($agent_name as $an) {
$data_pie_graph[$an] = $data_exceptions[$j];
$data = array();
$data[0] = printTruncateText($an, 30);
$data[1] = printTruncateText($module_name[$j], 30);
@ -3118,9 +3213,33 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
}
$table->colspan[2][0] = 3;
if ($show_graph == 0 || $show_graph == 1) {
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
}
$table->colspan[3][0] = 3;
$data = array();
$data[0] = print_table($table1, true);
array_push ($table->data, $data);
if ($show_graph == 1 || $show_graph == 2) {
if($config['flash_charts']) {
$data[0] = fs_3d_pie_chart ($data_pie_graph, 370, 180);
}
else {
$data_graph = json_encode ($data_pie_graph);
//Display pie graph
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_graph.
"&height=150&width=600'>";
}
array_push ($table->data, $data);
//Display bars graph
$table->colspan[4][0] = 3;
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = "<img src='include/fgraph.php?tipo=generic_horizontal_bar_graph&array=".$data_graph.
"&height=".$height."&width=600'>";
array_push ($table->data, $data);
}
if ($content['show_resume'] && $i>0) {
$data_resume = array();

View File

@ -60,7 +60,7 @@ abstract class PandoraGraphAbstract {
abstract protected function single_graph ();
abstract protected function combined_graph ($values, $events, $alerts, $unit_name, $max_value, $stacked);
abstract protected function progress_bar ($value, $color);
abstract protected function graph_sla_horizontal ($data, $sla_limit);
abstract protected function graph_sla_horizontal ($data);
}
function get_graph_engine ($period = 3600) {

View File

@ -652,7 +652,7 @@ class PchartGraph extends PandoraGraphAbstract {
}
}
public function graph_sla_horizontal ($data, $sla_limit) {
public function graph_sla_horizontal ($data) {
set_time_limit (0);
// Dataset definition
$this->graph = new pChart ($this->width, $this->height);
@ -681,14 +681,19 @@ class PchartGraph extends PandoraGraphAbstract {
$i = 0;
foreach ($data as $d) {
if ($d === false) {
$color = $this->get_rgb_values ($colorUnknown);
} elseif ($d <= $sla_limit+10 && $d >= $sla_limit-10) {
$color = $this->get_rgb_values ($colorEdge);
} elseif ($d > $sla_limit+10) {
$color = $this->get_rgb_values ($colorOK);
} elseif ($d < $sla_limit-10) {
$color = $this->get_rgb_values ($colorWrong);
switch ($d) {
case 1:
$color = $this->get_rgb_values ($colorOK);
breaK;
case 2:
$color = $this->get_rgb_values ($colorEdge);
break;
case 3:
$color = $this->get_rgb_values ($colorWrong);
break;
case 4:
$color = $this->get_rgb_values ($colorUnknown);
break;
}
$this->graph->drawFilledRoundedRectangle ($i, 0, $ratio+$i,
$this->height, $radius, $color['r'], $color['g'], $color['b']);