2011-04-20 Miguel de Dios <miguel.dedios@artica.es>

* images/logo_vertical_water.png: added water mark for the graphs.
	
	* godmode/db/db_info.php: cleaned source code style.
	
	* include/graphs/pChart/pDraw.class.php: re-added lost line for the
	rotation label value.

	* include/functions_graph.php, include/graphs/functions_pchart.php,
	include/graphs/functions_fsgraph.php, include/graphs/fgraph.php: added the
	source code to show warter mark.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4261 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-04-20 09:23:54 +00:00
parent e0b62c0733
commit 5d8ea2bfa8
8 changed files with 162 additions and 53 deletions

View File

@ -1,3 +1,16 @@
2011-04-20 Miguel de Dios <miguel.dedios@artica.es>
* images/logo_vertical_water.png: added water mark for the graphs.
* godmode/db/db_info.php: cleaned source code style.
* include/graphs/pChart/pDraw.class.php: re-added lost line for the
rotation label value.
* include/functions_graph.php, include/graphs/functions_pchart.php,
include/graphs/functions_fsgraph.php, include/graphs/fgraph.php: added the
source code to show warter mark.
2011-04-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_events.php

View File

@ -18,7 +18,7 @@
// Load global vars
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -304,7 +304,8 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
}
return area_graph($flash_chart, $chart, $width, $height, $color,$legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl);
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -639,23 +640,26 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
$color = null;
return area_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
"", "", $homeurl);
"", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png");
break;
default:
case GRAPH_STACKED_AREA:
$color = null;
return stacked_area_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
break;
case GRAPH_LINE:
$color = null;
return line_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
break;
case GRAPH_STACKED_LINE:
$color = null;
return stacked_line_graph($flash_charts, $graph_values, $width, $height,
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
break;
}
}
@ -702,7 +706,8 @@ function graphic_agentaccess2 ($id_agent, $width, $height, $period = 0) {
}
echo area_graph($config['flash_charts'], $data, $width, $height,
null, null, null, "images/image_problem.opaque.png");
null, null, null, "images/image_problem.opaque.png", "", "", "",
$config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -745,7 +750,8 @@ function graph_event_module2 ($width = 300, $height = 200, $id_agent) {
}
asort ($data);
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"));
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
'', $config['homedir'] . "/images/logo_vertical_water.png");
}
function progress_bar2($progress, $width, $height, $title = '', $mode = 1) {
@ -777,6 +783,8 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $daysWeek, $time_
function grafico_db_agentes_purge2 ($id_agent, $width, $height) {
global $config;
global $graphic_type;
include_flash_chart_script();
if ($id_agent < 1) {
$id_agent = -1;
@ -822,7 +830,8 @@ function grafico_db_agentes_purge2 ($id_agent, $width, $height) {
$data[__("Older")] = $data[__("Older")] - $data["3 ".__("Months")];
return pie3d_graph($config['flash_charts'], $data, $width, $height);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -834,6 +843,8 @@ function grafico_db_agentes_purge2 ($id_agent, $width, $height) {
function grafico_db_agentes_paquetes2($width = 380, $height = 300) {
global $config;
global $graphic_type;
include_flash_chart_script();
$data = array ();
$legend = array ();
@ -848,7 +859,8 @@ function grafico_db_agentes_paquetes2($width = 380, $height = 300) {
$data[$agents[$agent_id]]['g'] = $value;
}
return hbar_graph($config['flash_charts'], $data, $width, $height, array(), $legend);
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
$legend, "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -860,6 +872,8 @@ function grafico_db_agentes_paquetes2($width = 380, $height = 300) {
function graph_db_agentes_modulos2($width, $height) {
global $config;
global $graphic_type;
include_flash_chart_script();
$data = array ();
@ -895,7 +909,8 @@ function graph_db_agentes_modulos2($width, $height) {
}
}
return hbar_graph($config['flash_charts'], $data, $width, $height);
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -936,7 +951,8 @@ function graphic_user_activity2 ($width = 350, $height = 230) {
$data[$login['id_usuario']] = $login['n_incidents'];
}
return pie3d_graph($config['flash_charts'], $data, $width, $height);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -969,7 +985,8 @@ function grafico_incidente_prioridad2 () {
__('Very serious') => $data_tmp[4],
__('Maintenance') => $data_tmp[5]);
return pie3d_graph($config['flash_charts'], $data, 320, 200);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1002,7 +1019,8 @@ function graph_incidents_status2 () {
$data[__("Invalid")]++;
}
return pie3d_graph($config['flash_charts'], $data, 370, 180);
return pie3d_graph($config['flash_charts'], $data, 370, 180,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1028,7 +1046,8 @@ function graphic_incident_group2 () {
$data[$incident['nombre']] = $incident['n_incidents'];
}
return pie3d_graph($config['flash_charts'], $data, 320, 200);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1065,7 +1084,8 @@ function graphic_incident_user2 () {
$data[$name] = $incident['n_incidents'];
}
return pie3d_graph($config['flash_charts'], $data, 320, 200);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1107,7 +1127,8 @@ function graphic_incident_source2($width = 320, $height = 200) {
$data[$origin['origen']] = $origin['n_incident'];
}
return pie3d_graph($config['flash_charts'], $data, $width, $height);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1171,7 +1192,8 @@ function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") {
$loop++;
}
return pie3d_graph($config['flash_charts'], $data, $width, $height);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1205,7 +1227,8 @@ function grafico_eventos_total2($filter = "") {
asort ($data);
return pie3d_graph($config['flash_charts'], $data, 320, 200);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1241,7 +1264,8 @@ function grafico_eventos_usuario2 ($width, $height) {
$events = array();
}
return pie3d_graph($config['flash_charts'], $data, $width, $height);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1295,13 +1319,15 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar'
switch ($type) {
case 'sql_graph_vbar': // vertical bar
return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", false, $homeurl);
return hbar_graph($flash_charts, $data, $width, $height, array(),
array(), "", "", false, $homeurl, $config['homedir'] . "/images/logo_vertical_water.png");
break;
case 'sql_graph_hbar': // horizontal bar
return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl);
break;
case 'sql_graph_pie': // Pie
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl);
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
break;
}
}
@ -1721,7 +1747,8 @@ function grafico_modulo_boolean2 ($agent_module_id, $period, $show_events,
}
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl);
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
}
/**
@ -1947,7 +1974,8 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events,
$legend = null;
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl);
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
}
function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,

View File

@ -107,7 +107,7 @@ function slicesbar_graph($chart_data, $width, $height, $colors, $font, $round_co
}
function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array(),
$legend = array(), $xaxisname = "", $yaxisname = "", $homedir="") {
$legend = array(), $xaxisname = "", $yaxisname = "", $homedir="", $water_mark = '') {
if($flash_chart) {
echo fs_2d_column_chart ($chart_data, $width, $height);
}
@ -120,6 +120,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -129,7 +130,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
function threshold_graph($flash_chart, $chart_data, $width, $height) {
if($flash_chart) {
echo fs_area_chart ($chart_data, $width, $height);
echo fs_2d_column_chart ($chart_data, $width, $height);
}
else {
echo "<img src='include/graphs/functions_pchart.php?graph_type=threshold&data=".json_encode($chart_data)."&width=".$width."&height=".$height."'>";
@ -137,7 +138,7 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) {
}
function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="") {
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="", $water_mark = "") {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -154,6 +155,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -161,7 +163,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
}
}
function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") {
function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
@ -182,6 +185,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -189,7 +193,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
}
}
function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") {
function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -209,6 +214,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -216,7 +222,8 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
}
}
function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") {
function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "") {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -233,6 +240,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -264,7 +272,8 @@ function polar_graph($flash_chart, $chart_data, $width, $height, $no_data_image)
}
function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(),
$legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true, $homedir="") {
$legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true,
$homedir="", $water_mark = '') {$flash_chart = false;
if($flash_chart) {
echo fs_2d_hcolumn_chart ($chart_data, $width, $height);
}
@ -278,6 +287,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['force_height'] = $force_height;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);
@ -285,15 +295,15 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
}
}
function pie3d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") {
return pie_graph('3d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir);
function pie3d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") {
return pie_graph('3d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir, $water_mark);
}
function pie2d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") {
return pie_graph('2d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir);
function pie2d_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") {
return pie_graph('2d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir, $water_mark);
}
function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="") {
function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") {
// This library allows only 8 colors
$max_values = 8;
@ -330,6 +340,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $oth
$graph['data'] = $chart_data;
$graph['width'] = $width;
$graph['height'] = $height;
$graph['water_mark'] = $water_mark;
$id_graph = serialize_in_temp($graph);

View File

@ -309,7 +309,7 @@ function fs_line_graph($chart_data, $width, $height, $color, $legend, $long_inde
}
function fs_area_graph($chart_data, $width, $height, $colors, $legend, $long_index) {
function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '') {
global $config;
$graph_type = "MSArea2D"; //MSLine is possible also

View File

@ -94,6 +94,11 @@ if (!$force_height) {
}
}
$water_mark = '';
if(isset($graph['water_mark'])) {
$water_mark = $graph['water_mark']; //"/var/www/pandora_console/images/logo_vertical_water.png";
}
debugPrint($graph['water_mark'], true);
/*
$colors = array();
@ -247,7 +252,7 @@ foreach($colors as $i => $color) {
switch($graph_type) {
case 'pie3d':
case 'pie2d':
pch_pie_graph($graph_type, array_values($data), array_keys($data), $width, $height, $font);
pch_pie_graph($graph_type, array_values($data), array_keys($data), $width, $height, $font, $water_mark);
break;
case 'slicebar':
pch_slicebar_graph($graph_type, $data, $width, $height, $colors, $font, $round_corner);
@ -258,12 +263,16 @@ switch($graph_type) {
break;
case 'hbar':
case 'vbar':
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height, $font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false, $legend, $fine_colors);
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height,
$font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false,
$legend, $fine_colors, $water_mark);
break;
case 'stacked_area':
case 'area':
case 'line':
pch_vertical_graph($graph_type, $data_keys, $data_values, $width, $height, $rgb_color, $xaxisname, $yaxisname, false, $legend, $font, $antialiasing);
pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark);
break;
case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width, $height, $font, $antialiasing, $xaxisname, $yaxisname, $title);
@ -330,7 +339,7 @@ function pch_slicebar_graph ($graph_type, $data, $width, $height, $colors, $font
$myPicture->Stroke ();
}
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $height, $font) {
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $height, $font, $water_mark) {
/* CAT:Pie charts */
/* Create and populate the pData object */
@ -348,6 +357,21 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));
$water_mark_height = 0;
$water_mark_width = 0;
debugPrint($water_mark, true);
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - 50, $water_mark);
}
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
@ -357,7 +381,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
case "pie3d":
$PieChart->draw3DPie($width/4,$height/2,array("DataGapAngle"=>10,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>10,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
}
@ -381,7 +405,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Render the picture */
$myPicture->stroke();
$myPicture->stroke();
}
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $height, $font) {
@ -424,7 +448,9 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $h
$myPicture->stroke();
}
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $legend = array(), $fine_colors = array()) {
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "",
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '') {
/* CAT: Vertical Bar Chart */
if(!is_array($legend) || empty($legend)) {
unset($legend);
@ -470,7 +496,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
@ -498,24 +524,39 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant
}
}
$margin_top = 10 * $max_chars;
switch($graph_type) {
case "vbar":
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
$margin_left = 40;
$margin_top = 10;
$margin_bottom = 8 * $max_chars;
break;
case "hbar":
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "LabelValuesRotation" => 60);
$margin_left = 8 * $max_chars;
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
"LabelValuesRotation" => 60);
$margin_left = 5 * $max_chars;
$margin_top = 40;
$margin_bottom = 10;
break;
}
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
/* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width,$height-$margin_bottom);
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
$myPicture->drawScale($scaleSettings);
@ -537,7 +578,9 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $ant
$myPicture->stroke();
}
function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $legend = array(), $font, $antialiasing) {
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '') {
/* CAT:Vertical Charts */
if(!is_array($legend) || empty($legend)) {
unset($legend);
@ -647,13 +690,25 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
}
$margin_bottom = 10 * $max_chars;
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
if (isset($size['Height'])) {
/* Define the chart area */
$myPicture->setGraphArea(40,$size['Height'],$width,$height - $margin_bottom);
$myPicture->setGraphArea(40,$size['Height'],$width - $water_mark_width,$height - $margin_bottom);
}
else {
/* Define the chart area */
$myPicture->setGraphArea(40, 5,$width,$height - $margin_bottom);
$myPicture->setGraphArea(40, 5,$width - $water_mark_width,$height - $margin_bottom);
}
/* Draw the scale */
@ -686,6 +741,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
"DisplayZeros"=> FALSE,
"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
switch($graph_type) {
case "stacked_area":
case "area":

View File

@ -1745,6 +1745,7 @@
$LabelingMethod = isset($Format["LabelingMethod"]) ? $Format["LabelingMethod"] : LABELING_ALL;
$LabelSkip = isset($Format["LabelSkip"]) ? $Format["LabelSkip"] : 1;
$LabelRotation = isset($Format["LabelRotation"]) ? $Format["LabelRotation"] : 0;
$LabelValuesRotation = isset($Format["LabelValuesRotation"]) ? $Format["LabelValuesRotation"] : 0;
$SkippedAxisTicks = isset($Format["SkippedAxisTicks"]) ? $Format["SkippedAxisTicks"] : $GridTicks+2;
$SkippedAxisR = isset($Format["SkippedAxisR"]) ? $Format["SkippedAxisR"] : $GridR;
$SkippedAxisG = isset($Format["SkippedAxisG"]) ? $Format["SkippedAxisG"] : $GridG;