2013-06-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_reporting.php, include/graphs/functions_utils.php, include/graphs/fgraph.php, include/graphs/functions_pchart.php: fixed the graphs in the reports. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a40f68bdaf
commit
0a2ac656a5
|
@ -1,3 +1,10 @@
|
|||
2013-06-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_html.php, include/functions_reporting.php,
|
||||
include/graphs/functions_utils.php, include/graphs/fgraph.php,
|
||||
include/graphs/functions_pchart.php: fixed the graphs in the
|
||||
reports.
|
||||
|
||||
2013-06-10 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/styles/datepicker.css
|
||||
|
|
|
@ -1639,22 +1639,22 @@ function html_print_image ($src, $return = false, $options = false, $return_src
|
|||
|
||||
}
|
||||
|
||||
if (!$relative) {
|
||||
$src_tmp = $src;
|
||||
$src = ui_get_full_url($src);
|
||||
}
|
||||
|
||||
// If metaconsole is activated and image doesn't exists try to search on normal console
|
||||
if (defined('METACONSOLE')) {
|
||||
if (!$relative) {
|
||||
if (false === @file_get_contents($src, 0, null, 0, 1)) {
|
||||
$src = ui_get_full_url('../../' . $src_tmp);
|
||||
$src = ui_get_full_url('../../' . $src);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$src = '../../' . $src;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$relative) {
|
||||
$src = ui_get_full_url($src);
|
||||
}
|
||||
}
|
||||
|
||||
// Only return src field of image
|
||||
if ($return_src) {
|
||||
|
|
|
@ -3471,7 +3471,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$dataslice[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'],
|
||||
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
|
||||
$content['time_to'], 650, 25, ui_get_full_url(false) . '/', 1, $sla_data_arrays[$k], false);
|
||||
$content['time_to'], 650, 25, ui_get_full_url(false, false, false, false), 1, $sla_data_arrays[$k], false);
|
||||
|
||||
array_push ($tableslice->data, $dataslice);
|
||||
}
|
||||
|
@ -3494,7 +3494,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$data_pie_graph = json_encode ($data_graph);
|
||||
if ($show_graphs && !empty($slas)) {
|
||||
$data[0] = pie3d_graph(false, $data_graph,
|
||||
500, 150, __("other"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
500, 150, __("other"),
|
||||
ui_get_full_url(false, false, false, false),
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
|
||||
|
||||
|
@ -3540,7 +3542,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
//RUNNING
|
||||
|
||||
// Put description at the end of the module (if exists)
|
||||
if ($content["description"] != ""){
|
||||
if ($content["description"] != "") {
|
||||
$table->colspan[1][0] = 3;
|
||||
$data_desc = array();
|
||||
$data_desc[0] = $content["description"];
|
||||
|
|
|
@ -435,7 +435,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
|
|||
}
|
||||
|
||||
function pie3d_graph($flash_chart, $chart_data, $width, $height,
|
||||
$others_str = "other", $homedir="", $water_mark = "", $font = '',
|
||||
$others_str = "other", $homedir = "", $water_mark = "", $font = '',
|
||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '') {
|
||||
|
||||
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
|
||||
|
@ -456,7 +456,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height,
|
|||
$others_str = "other", $homedir="", $water_mark = "", $font = '',
|
||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '') {
|
||||
|
||||
if(empty($chart_data)) {
|
||||
if (empty($chart_data)) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
}
|
||||
|
||||
|
|
|
@ -77,33 +77,33 @@ if (isset($graph['color'])) {
|
|||
if (isset($graph['legend'])) {
|
||||
$legend = $graph['legend'];
|
||||
}
|
||||
if(isset($graph['xaxisname'])) {
|
||||
if (isset($graph['xaxisname'])) {
|
||||
$xaxisname = $graph['xaxisname'];
|
||||
}
|
||||
if(isset($graph['yaxisname'])) {
|
||||
if (isset($graph['yaxisname'])) {
|
||||
$yaxisname = $graph['yaxisname'];
|
||||
}
|
||||
if(isset($graph['round_corner'])) {
|
||||
if (isset($graph['round_corner'])) {
|
||||
$round_corner = $graph['round_corner'];
|
||||
}
|
||||
if(isset($graph['font'])) {
|
||||
if (isset($graph['font'])) {
|
||||
if (!empty($graph['font'])) {
|
||||
$font = $graph['font'];
|
||||
}
|
||||
}
|
||||
if(isset($graph['font_size'])) {
|
||||
if (isset($graph['font_size'])) {
|
||||
if (!empty($graph['font_size'])) {
|
||||
$font_size = $graph['font_size'];
|
||||
}
|
||||
}
|
||||
if(isset($graph['antialiasing'])) {
|
||||
if (isset($graph['antialiasing'])) {
|
||||
$antialiasing = $graph['antialiasing'];
|
||||
}
|
||||
$force_height = true;
|
||||
if(isset($graph['force_height'])) {
|
||||
if (isset($graph['force_height'])) {
|
||||
$force_height = $graph['force_height'];
|
||||
}
|
||||
if(isset($graph['period'])) {
|
||||
if (isset($graph['period'])) {
|
||||
$period = $graph['period'];
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ if (!$force_height) {
|
|||
}
|
||||
|
||||
$water_mark = '';
|
||||
if(isset($graph['water_mark'])) {
|
||||
if (isset($graph['water_mark'])) {
|
||||
//"/var/www/pandora_console/images/logo_vertical_water.png";
|
||||
$water_mark = $graph['water_mark'];
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ $c = 1;
|
|||
switch($graph_type) {
|
||||
case 'hbar':
|
||||
case 'vbar':
|
||||
foreach($data as $i => $values) {
|
||||
foreach($values as $name => $val) {
|
||||
foreach ($data as $i => $values) {
|
||||
foreach ($values as $name => $val) {
|
||||
$data_values[$name][] = $val;
|
||||
}
|
||||
|
||||
|
@ -168,13 +168,13 @@ switch($graph_type) {
|
|||
$fine_colors = array();
|
||||
|
||||
// If is set fine colors we store it or set default
|
||||
if(isset($colors[reset(array_keys($data_values))]['fine'])) {
|
||||
if (isset($colors[reset(array_keys($data_values))]['fine'])) {
|
||||
$fine = $colors[reset(array_keys($data_values))]['fine'];
|
||||
if($fine === true) {
|
||||
if ($fine === true) {
|
||||
$fine = $default_fine_colors;
|
||||
}
|
||||
|
||||
foreach($fine as $i => $fine_color) {
|
||||
foreach ($fine as $i => $fine_color) {
|
||||
$rgb_fine = html_html2rgb($fine_color);
|
||||
$fine_colors[$i]['R'] = $rgb_fine[0];
|
||||
$fine_colors[$i]['G'] = $rgb_fine[1];
|
||||
|
@ -192,7 +192,7 @@ switch($graph_type) {
|
|||
case 'line':
|
||||
case 'threshold':
|
||||
case 'scatter':
|
||||
foreach($data as $i => $d) {
|
||||
foreach ($data as $i => $d) {
|
||||
$data_values[] = $d;
|
||||
|
||||
|
||||
|
@ -409,8 +409,8 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
|||
/* Create the pPie object */
|
||||
$PieChart = new pPie($myPicture,$MyData);
|
||||
|
||||
foreach($data_values as $key => $value) {
|
||||
if(isset($colors[$key])) {
|
||||
foreach ($data_values as $key => $value) {
|
||||
if (isset($colors[$key])) {
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$key]));
|
||||
}
|
||||
}
|
||||
|
@ -430,12 +430,13 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
|||
$max_chars = graph_get_max_index($legend_values);
|
||||
$legend_with_aprox = 32 + (7 * $max_chars);
|
||||
|
||||
if($legend_position != 'hidden') {
|
||||
if ($legend_position != 'hidden') {
|
||||
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
|
||||
}
|
||||
|
||||
/* Enable shadow computing */
|
||||
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
$myPicture->setShadow(TRUE,
|
||||
array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
|
|
|
@ -135,6 +135,9 @@ function graph_get_max_index($legend_values) {
|
|||
function setup_watermark($water_mark, &$water_mark_file, &$water_mark_url) {
|
||||
if (!is_array($water_mark)) {
|
||||
$water_mark_file = $water_mark;
|
||||
$water_mark_url = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($water_mark['file'])) {
|
||||
|
@ -214,19 +217,15 @@ function get_complementary_rgb ($hexcode) {
|
|||
|
||||
$l = ($var_max + $var_min) / 2;
|
||||
|
||||
if ($del_max == 0)
|
||||
{
|
||||
if ($del_max == 0) {
|
||||
$h = 0;
|
||||
$s = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($l < 0.5)
|
||||
{
|
||||
else {
|
||||
if ($l < 0.5) {
|
||||
$s = $del_max / ($var_max + $var_min);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$s = $del_max / (2 - $var_max - $var_min);
|
||||
};
|
||||
|
||||
|
@ -234,26 +233,21 @@ function get_complementary_rgb ($hexcode) {
|
|||
$del_g = ((($var_max - $var_g) / 6) + ($del_max / 2)) / $del_max;
|
||||
$del_b = ((($var_max - $var_b) / 6) + ($del_max / 2)) / $del_max;
|
||||
|
||||
if ($var_r == $var_max)
|
||||
{
|
||||
if ($var_r == $var_max) {
|
||||
$h = $del_b - $del_g;
|
||||
}
|
||||
elseif ($var_g == $var_max)
|
||||
{
|
||||
elseif ($var_g == $var_max) {
|
||||
$h = (1 / 3) + $del_r - $del_b;
|
||||
}
|
||||
elseif ($var_b == $var_max)
|
||||
{
|
||||
elseif ($var_b == $var_max) {
|
||||
$h = (2 / 3) + $del_g - $del_r;
|
||||
};
|
||||
|
||||
if ($h < 0)
|
||||
{
|
||||
if ($h < 0) {
|
||||
$h += 1;
|
||||
};
|
||||
|
||||
if ($h > 1)
|
||||
{
|
||||
if ($h > 1) {
|
||||
$h -= 1;
|
||||
};
|
||||
};
|
||||
|
@ -276,20 +270,16 @@ function get_complementary_rgb ($hexcode) {
|
|||
// Output is RGB in normal 255 255 255 format, held in $r, $g, $b
|
||||
// Hue is converted using function hue_2_rgb, shown at the end of this code
|
||||
|
||||
if ($s == 0)
|
||||
{
|
||||
if ($s == 0) {
|
||||
$r = $l * 255;
|
||||
$g = $l * 255;
|
||||
$b = $l * 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($l < 0.5)
|
||||
{
|
||||
else {
|
||||
if ($l < 0.5) {
|
||||
$var_2 = $l * (1 + $s);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$var_2 = ($l + $s) - ($s * $l);
|
||||
};
|
||||
$var_1 = 2 * $l - $var_2;
|
||||
|
|
Loading…
Reference in New Issue