2012-01-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_graph.php
	 include/graphs/functions_fsgraph.php: Modified background color in
	 flash charts.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5436 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-01-26 12:51:43 +00:00
parent c96acd2fb7
commit 84b426b57a
3 changed files with 87 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2012-01-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php
include/graphs/functions_fsgraph.php: Modified background color in
flash charts.
2012-01-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2012-01-26 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_graph.php * include/functions_graph.php

View File

@ -908,7 +908,6 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1) {
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url) { function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url) {
global $config; global $config;
$data = reporting_get_agentmodule_sla_array ($id, $period, $sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to); $data = reporting_get_agentmodule_sla_array ($id, $period, $sla_min, $sla_max, $date, $daysWeek, $time_from, $time_to);
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3'); $colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
@ -1551,12 +1550,14 @@ function graphic_agentevents ($id_agent, $width, $height, $period = 0) {
global $config; global $config;
global $graphic_type; global $graphic_type;
include_flash_chart_script(); if ($config['flash_charts']) {
include_flash_chart_script();
}
$data = array (); $data = array ();
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution); $interval = (int) ($period / $resolution);
$date = get_system_time (); $date = get_system_time ();
$datelimit = $date - $period; $datelimit = $date - $period;
@ -1594,6 +1595,81 @@ function graphic_agentevents ($id_agent, $width, $height, $period = 0) {
} }
} }
/**
* Print a static graph with event data of agents
*
* @param integer id_agent Agent ID
* @param integer width pie graph width
* @param integer height pie graph height
* @param integer period time period
*/
function graph_graphic_agentevents_static($id_agent, $width, $height, $period = 0, $homeurl) {
global $config;
global $graphic_type;
$data = array ();
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
$date = get_system_time ();
$datelimit = $date - $period;
$periodtime = floor ($period / $interval);
$time = array ();
$data = array ();
$legend = array();
$cont = 0;
for ($i = 0; $i < $interval; $i++) {
$bottom = $datelimit + ($periodtime * $i);
if (! $graphic_type) {
$name = date('H\h', $bottom);
} else {
$name = $bottom;
}
// Show less values in legend
if ($cont == 0 or $cont % 2)
$legend[$name] = $name;
$top = $datelimit + ($periodtime * ($i + 1));
$event = db_get_row_filter ('tevento',
array ('id_agente' => $id_agent,
'utimestamp > '.$bottom,
'utimestamp < '.$top), 'criticity, utimestamp');
if (!empty($event['utimestamp'])){
$data[$cont]['utimestamp'] = $periodtime;
switch ($event['criticity']) {
case 3: $data[$cont]['data'] = 2;
break;
case 4: $data[$cont]['data'] = 3;
break;
default:$data[$cont]['data'] = 1;
break;
}
}
else{
$data[$cont]['utimestamp'] = $periodtime;
$data[$cont]['data'] = 1;
}
$cont++;
}
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
// Draw slicebar graph
echo slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
// Draw legend
echo "<br>";
echo "&nbsp;";
foreach ($legend as $hour){
echo "<span style='font-size: 6pt'>" . $hour . "</span>";
echo "&nbsp;";
}
}
// Clean FLASH string strips non-valid characters for flashchart // Clean FLASH string strips non-valid characters for flashchart
function clean_flash_string ($string) { function clean_flash_string ($string) {
$string = html_entity_decode ($string, ENT_QUOTES, "UTF-8"); $string = html_entity_decode ($string, ENT_QUOTES, "UTF-8");

View File

@ -482,7 +482,7 @@ function get_chart_code ($chart, $width, $height, $swf) {
} }
// Prints a 3D pie chart // Prints a 3D pie chart
function fs_3d_pie_chart ($data, $names, $width, $height, $background = "EEEEEE") { function fs_3d_pie_chart ($data, $names, $width, $height, $background = "FFFFFF") {
if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){ if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){
return; return;
} }
@ -502,7 +502,7 @@ function fs_3d_pie_chart ($data, $names, $width, $height, $background = "EEEEEE"
} }
// Prints a 2D pie chart // Prints a 2D pie chart
function fs_2d_pie_chart ($data, $names, $width, $height, $background = "EEEEEE") { function fs_2d_pie_chart ($data, $names, $width, $height, $background = "FFFFFF") {
if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){ if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){
return; return;
} }