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

* include/fonts/unicode.ttf: renamed form code.ttf.
	
	* include/fonts/smallfont.ttf: added new smaller font.
	
	* include/functions_config.php, godmode/setup/setup_visuals.php: now you
	can set the size of font for the graphs.
	
	* include/functions_graph.php, include/graphs/functions_pchart.php,
	include/graphs/fgraph.php: changed source code to set the size of font
	in the graphs.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4270 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-04-20 15:54:31 +00:00
parent dc92bdce3c
commit c4307abaed
8 changed files with 158 additions and 69 deletions

View File

@ -1,3 +1,16 @@
2011-04-20 Miguel de Dios <miguel.dedios@artica.es>
* include/fonts/unicode.ttf: renamed form code.ttf.
* include/fonts/smallfont.ttf: added new smaller font.
* include/functions_config.php, godmode/setup/setup_visuals.php: now you
can set the size of font for the graphs.
* include/functions_graph.php, include/graphs/functions_pchart.php,
include/graphs/fgraph.php: changed source code to set the size of font
in the graphs.
2011-04-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_pchart.php,

View File

@ -78,20 +78,20 @@ $table->data[9][1] = print_select ($iconsets, 'status_images_set', $config["stat
$table->data[10][0] = __('Font path');
$fonts = load_fonts();
$table->data[10][1] = print_select($fonts, 'fontpath', $config["fontpath"], '', '', 0, true);
//$table->data[10][1] = print_input_text ('fontpath', $config["fontpath"], '', 50, 255, true);
$table->data[11][0] = __('Flash charts');
$table->data[11][1] = __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).'&nbsp;&nbsp;';
$table->data[11][1] .= __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $config["flash_charts"], true);
$table->data[11][0] = __('Font size');
$table->data[11][1] = print_select(range(1, 15), 'font_size', $config["font_size"], '', '', 0, true);
$table->data[12][0] = __('Flash charts');
$table->data[12][1] = __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).'&nbsp;&nbsp;';
$table->data[12][1] .= __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $config["flash_charts"], true);
if (!defined ('PANDORA_ENTERPRISE')){
$table->data[12][0] = __('Custom logo') . ui_print_help_icon("custom_logo", true);
$table->data[12][1] = print_select (list_files ('images/custom_logo', "png", 1, 0), 'custom_logo', $config["custom_logo"], '', '', '', true);
$table->data[13][0] = __('Custom logo') . ui_print_help_icon("custom_logo", true);
$table->data[13][1] = print_select (list_files ('images/custom_logo', "png", 1, 0), 'custom_logo', $config["custom_logo"], '', '', '', true);
}
echo '<form id="form_setup" method="post">';

Binary file not shown.

View File

@ -241,6 +241,8 @@ function config_update_config () {
config_update_value ('collection_max_size', get_parameter('collection_max_size', $config['collection_max_size']));
config_update_value ('font_size', get_parameter('font_size', $config['font_size']));
$enterprise = enterprise_include_once('include/functions_policies.php');
if ($enterprise !== ENTERPRISE_NOT_HOOK) {
$locked = enterprise_hook('semaphore_policy_test_and_set');
@ -393,6 +395,10 @@ function config_process_config () {
config_update_value ('collection_max_size', 1000000);
}
if (!isset ($config["font_size"])) {
config_update_value ('font_size', 7);
}
/*
*Parse the ACL IP list for access API that it's save in chunks as
*list_ACL_IPs_for_API_<num>, because the value has a limit of 100
@ -430,7 +436,7 @@ function config_process_config () {
}
if (!isset ($config['fontpath'])) {
config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/code.ttf');
config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/unicode.ttf');
}
if (!isset ($config['style'])) {

View File

@ -305,7 +305,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,
$config['homedir'] . "/images/logo_vertical_water.png");
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -640,26 +641,30 @@ 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, $config['homedir'] . "/images/logo_vertical_water.png");
"", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
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",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
"", "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
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",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
"", "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
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",
"", "", $config['homedir'] . "/images/logo_vertical_water.png");
"", "", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
break;
}
}
@ -707,7 +712,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", "", "", "",
$config['homedir'] . "/images/logo_vertical_water.png");
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -751,7 +757,8 @@ function graph_event_module2 ($width = 300, $height = 200, $id_agent) {
asort ($data);
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
'', $config['homedir'] . "/images/logo_vertical_water.png");
'', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
function progress_bar2($progress, $width, $height, $title = '', $mode = 1) {
@ -831,7 +838,8 @@ function grafico_db_agentes_purge2 ($id_agent, $width, $height) {
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -860,7 +868,9 @@ function grafico_db_agentes_paquetes2($width = 380, $height = 300) {
}
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
$legend, "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png");
$legend, "", "", true, "",
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -910,7 +920,9 @@ function graph_db_agentes_modulos2($width, $height) {
}
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png");
array(), "", "", true, "",
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -952,7 +964,8 @@ function graphic_user_activity2 ($width = 350, $height = 230) {
}
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -986,7 +999,8 @@ function grafico_incidente_prioridad2 () {
__('Maintenance') => $data_tmp[5]);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1020,7 +1034,8 @@ function graph_incidents_status2 () {
}
return pie3d_graph($config['flash_charts'], $data, 370, 180,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1047,7 +1062,8 @@ function graphic_incident_group2 () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1085,7 +1101,8 @@ function graphic_incident_user2 () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1128,7 +1145,8 @@ function graphic_incident_source2($width = 320, $height = 200) {
}
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1193,7 +1211,8 @@ function grafico_eventos_grupo2 ($width = 300, $height = 200, $url = "") {
}
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1228,7 +1247,8 @@ function grafico_eventos_total2($filter = "") {
asort ($data);
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1265,7 +1285,8 @@ function grafico_eventos_usuario2 ($width, $height) {
}
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png");
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1320,14 +1341,19 @@ 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, $config['homedir'] . "/images/logo_vertical_water.png");
array(), "", "", false, $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
break;
case 'sql_graph_hbar': // horizontal bar
return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl);
return vbar_graph($flash_charts, $data, $width, $height, array(),
array(), "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
break;
case 'sql_graph_pie': // Pie
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
$config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath']);
break;
}
}
@ -1729,7 +1755,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,
$config['homedir'] . "/images/logo_vertical_water.png");
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
/**
@ -1956,7 +1983,8 @@ function grafico_modulo_string2 ($agent_module_id, $period, $show_events,
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, "images/image_problem.opaque.png", "", "", $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png");
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
}
function grafico_modulo_log4x_2 ($id_agente_modulo, $periodo, $show_event,

View File

@ -107,7 +107,8 @@ 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="", $water_mark = '') {
$legend = array(), $xaxisname = "", $yaxisname = "", $homedir="",
$water_mark = '', $font = '', $font_size = '') {
if($flash_chart) {
echo fs_2d_column_chart ($chart_data, $width, $height);
}
@ -121,6 +122,8 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -138,7 +141,8 @@ 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="", $water_mark = "") {
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="",
$water_mark = "", $font = '', $font_size = '') {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -156,6 +160,8 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -164,7 +170,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 = "", $water_mark = "") {
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
$water_mark = "", $font = '', $font_size = '') {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
@ -186,6 +193,8 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -194,7 +203,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 = "", $water_mark = "") {
$legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
$water_mark = "", $font = '', $font_size = '') {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -215,6 +225,8 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -223,7 +235,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 = "", $water_mark = "") {
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "",
$water_mark = "", $font = '', $font_size = '') {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
@ -241,6 +254,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -273,7 +288,7 @@ 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="", $water_mark = '') {$flash_chart = false;
$homedir="", $water_mark = '', $font = '', $font_size = '') {$flash_chart = false;
if($flash_chart) {
echo fs_2d_hcolumn_chart ($chart_data, $width, $height);
}
@ -288,6 +303,8 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
$graph['yaxisname'] = $yaxisname;
$graph['force_height'] = $force_height;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);
@ -295,15 +312,20 @@ 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 = "") {
return pie_graph('3d', $flash_chart, $chart_data, $width, $height, $others_str, $homedir, $water_mark);
function pie3d_graph($flash_chart, $chart_data, $width, $height,
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
$others_str, $homedir, $water_mark, $font);
}
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 pie2d_graph($flash_chart, $chart_data, $width, $height,
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
return pie_graph('2d', $flash_chart, $chart_data, $width, $height,
$others_str, $homedir, $water_mark, $font);
}
function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "") {
function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height,
$others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '') {
// This library allows only 8 colors
$max_values = 8;
@ -341,6 +363,8 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $oth
$graph['width'] = $width;
$graph['height'] = $height;
$graph['water_mark'] = $water_mark;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph);

View File

@ -36,11 +36,12 @@ $default_fine_colors[] = "#999999";
// Default values
$antialiasing = true;
$font = '../fonts/code.ttf';
$font = '../fonts/unicode.ttf';
$xaxisname = '';
$yaxisname = '';
$legend = null;
$colors = null;
$font_size = 8;
$graph_type = get_parameter('graph_type', '');
@ -82,6 +83,11 @@ if(isset($graph['font'])) {
$font = $graph['font'];
}
}
if(isset($graph['font_size'])) {
if (!empty($graph['font_size'])) {
$font_size = $graph['font_size'];
}
}
if(isset($graph['antialiasing'])) {
$antialiasing = $graph['antialiasing'];
}
@ -100,7 +106,6 @@ $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();
@ -254,34 +259,38 @@ 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, $water_mark);
pch_pie_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $water_mark, $font_size);
break;
case 'slicebar':
pch_slicebar_graph($graph_type, $data, $width, $height, $colors, $font, $round_corner);
pch_slicebar_graph($graph_type, $data, $width, $height, $colors, $font, $round_corner, $font_size);
break;
case 'polar':
case 'radar':
pch_kiviat_graph($graph_type, array_values($data), array_keys($data), $width, $height, $font);
pch_kiviat_graph($graph_type, array_values($data), array_keys($data),
$width, $height, $font, $font_size);
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, $water_mark);
$legend, $fine_colors, $water_mark, $font_size);
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, $water_mark);
$font, $antialiasing, $water_mark, $font_size);
break;
case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width, $height, $font, $antialiasing, $xaxisname, $yaxisname, $title);
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
$height, $font, $antialiasing, $xaxisname, $yaxisname, $title,
$font_size);
break;
}
function pch_slicebar_graph ($graph_type, $data, $width, $height, $colors, $font, $round_corner) {
function pch_slicebar_graph ($graph_type, $data, $width, $height, $colors, $font, $round_corner, $font_size) {
/* CAT:Slicebar charts */
set_time_limit (0);
@ -292,7 +301,7 @@ function pch_slicebar_graph ($graph_type, $data, $width, $height, $colors, $font
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
$myPicture->setFontProperties(array("FontName"=>"../fonts/code.ttf","FontSize"=>8,"R"=>80,"G"=>80,"B"=>80));
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
// Round corners defined in global setup
if ($round_corner != 0)
@ -341,7 +350,8 @@ 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, $water_mark) {
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $water_mark, $font_size) {
/* CAT:Pie charts */
/* Create and populate the pData object */
@ -357,7 +367,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
@ -410,7 +420,8 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width, $heig
$myPicture->stroke();
}
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $height, $font) {
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $font_size) {
/* CAT:Radar/Polar charts */
/* Create and populate the pData object */
@ -426,7 +437,7 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $h
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>8,"R"=>80,"G"=>80,"B"=>80));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Create the pRadar object */
$SplitChart = new pRadar();
@ -437,11 +448,16 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $h
/* Draw an AA pie chart */
switch($graph_type) {
case "radar":
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL, "LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), "FontName"=>$font,"FontSize"=>6);
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size / 1.8);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
case "polar":
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50), "FontName"=>$font,"FontSize"=>6);
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size / 1.8);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
}
@ -452,7 +468,7 @@ function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width, $h
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 = '') {
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) {
/* CAT: Vertical Bar Chart */
if(!is_array($legend) || empty($legend)) {
unset($legend);
@ -509,7 +525,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>10));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
/* Draw the scale */
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
@ -582,7 +598,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '') {
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size) {
/* CAT:Vertical Charts */
if(!is_array($legend) || empty($legend)) {
unset($legend);
@ -665,7 +681,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>10));
$myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size));
if(isset($legend)) {
/* Set horizontal legend if is posible */
@ -758,7 +774,9 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$myPicture->stroke();
}
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font, $antialiasing, $xaxisname = "", $yaxisname = "", $title = "", $show_values = false, $show_legend = false) {
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $xaxisname = "", $yaxisname = "", $title = "",
$show_values = false, $show_legend = false, $font_size) {
/* CAT:Threshold Chart */
/* Create and populate the pData object */
@ -777,15 +795,15 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>11));
$myPicture->drawText(60,35,$title,array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$myPicture->drawText(60,35,$title,array("FontSize"=>($font_size * 1.8),"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60,40,670,190);
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>6));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>($font_size / 1.8)));
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);