2011-04-07 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/fgraph.php: changed the img tag to autoclose. * include/graphs/functions_fsgraph.php: changed the border to default 1, and fixed the show legend. * include/functions_graph.php: cleaned source code style. And the function "graphic_combined_module2" added the show timestamp as human, add the min, max, avg values. * include/graphs/functions_pchart.php: changed the show leyend in the top of graph, and added some comments lines for debug. * include/functions_reporting.php, include/functions_custom_graphs.php, godmode/reporting/graph_builder.preview.php: changed the graph to show with new engine. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4177 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d0346fc2f5
commit
0daa808bb8
|
@ -1,3 +1,22 @@
|
||||||
|
2011-04-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/graphs/fgraph.php: changed the img tag to autoclose.
|
||||||
|
|
||||||
|
* include/graphs/functions_fsgraph.php: changed the border to default 1, and
|
||||||
|
fixed the show legend.
|
||||||
|
|
||||||
|
* include/functions_graph.php: cleaned source code style. And the function
|
||||||
|
"graphic_combined_module2" added the show timestamp as human, add the
|
||||||
|
min, max, avg values.
|
||||||
|
|
||||||
|
* include/graphs/functions_pchart.php: changed the show leyend in the top
|
||||||
|
of graph, and added some comments lines for debug.
|
||||||
|
|
||||||
|
|
||||||
|
* include/functions_reporting.php, include/functions_custom_graphs.php,
|
||||||
|
godmode/reporting/graph_builder.preview.php: changed the graph to show with
|
||||||
|
new engine.
|
||||||
|
|
||||||
2011-04-06 Javier Lanz <javier.lanz@artica.es>
|
2011-04-06 Javier Lanz <javier.lanz@artica.es>
|
||||||
|
|
||||||
* pandoradb.sql: Added 'id_group' & 'id_module_group' fields to
|
* pandoradb.sql: Added 'id_group' & 'id_module_group' fields to
|
||||||
|
|
|
@ -141,12 +141,21 @@ echo "<table class='databox_frame' cellpadding='0' cellspacing='0'>";
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
|
|
||||||
if(!empty($modules)) {
|
if(!empty($modules)) {
|
||||||
if ($config['flash_charts']) {
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $width, $height,
|
|
||||||
|
//if ($config['flash_charts']) {
|
||||||
|
//echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $width, $height,
|
||||||
|
// 'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate);
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
//echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=" . base64_encode ("Combined%20Sample%20Graph") . "&height=$height&width=$width&stacked=$stacked&period=$period&date=$unixdate' border=1 alt=''>";
|
||||||
|
//}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
echo graphic_combined_module2(explode (',', $modules), explode (',', $weights), $period, $width, $height,
|
||||||
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate);
|
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate);
|
||||||
} else {
|
|
||||||
echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=" . base64_encode ("Combined%20Sample%20Graph") . "&height=$height&width=$width&stacked=$stacked&period=$period&date=$unixdate' border=1 alt=''>";
|
///////////////////////////////////////////////////////
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<div class='nf'>".__('Empty graph')."</div>";
|
echo "<div class='nf'>".__('Empty graph')."</div>";
|
||||||
|
|
|
@ -92,6 +92,8 @@ function get_user_custom_graphs ($id_user = 0, $only_names = false, $returnAllGr
|
||||||
function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) {
|
function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
|
||||||
$sources = get_db_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph);
|
$sources = get_db_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph);
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
$weights = array ();
|
$weights = array ();
|
||||||
|
@ -106,6 +108,10 @@ function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $ret
|
||||||
array_push ($weights, $source['weight']);
|
array_push ($weights, $source['weight']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output = graphic_combined_module2($modules, $weights, $period, $width, $height,
|
||||||
|
'', '', 0, 0, 0, $stacked, $date);
|
||||||
|
|
||||||
|
/*
|
||||||
if ($config['flash_charts']) {
|
if ($config['flash_charts']) {
|
||||||
$output = graphic_combined_module ($modules, $weights, $period, $width, $height,
|
$output = graphic_combined_module ($modules, $weights, $period, $width, $height,
|
||||||
'', '', 0, 0, 0, $stacked, $date);
|
'', '', 0, 0, 0, $stacked, $date);
|
||||||
|
@ -114,6 +120,7 @@ function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $ret
|
||||||
$weights = implode (',', $weights);
|
$weights = implode (',', $weights);
|
||||||
$output = '<img src="include/fgraph.php?tipo=combined&height='.$height.'&width='.$width.'&id='.$modules.'&period='.$period.'&weight_l='.$weights.'&stacked='.$stacked.'&date='.$date.'">';
|
$output = '<img src="include/fgraph.php?tipo=combined&height='.$height.'&width='.$width.'&id='.$modules.'&period='.$period.'&weight_l='.$weights.'&stacked='.$stacked.'&date='.$date.'">';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
@ -310,6 +310,29 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
// Set the title and time format
|
||||||
|
|
||||||
|
if ($period <= 3600) {
|
||||||
|
$title_period = __('Last hour');
|
||||||
|
$time_format = 'G:i:s';
|
||||||
|
}
|
||||||
|
elseif ($period <= 86400) {
|
||||||
|
$title_period = __('Last day');
|
||||||
|
$time_format = 'G:i';
|
||||||
|
}
|
||||||
|
elseif ($period <= 604800) {
|
||||||
|
$title_period = __('Last week');
|
||||||
|
$time_format = 'M j';
|
||||||
|
}
|
||||||
|
elseif ($period <= 2419200) {
|
||||||
|
$title_period = __('Last month');
|
||||||
|
$time_format = 'M j';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
|
||||||
|
$time_format = 'M j';
|
||||||
|
}
|
||||||
|
|
||||||
// Set variables
|
// Set variables
|
||||||
if ($date == 0) $date = get_system_time();
|
if ($date == 0) $date = get_system_time();
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
|
@ -332,7 +355,11 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
|
|
||||||
// Set data containers
|
// Set data containers
|
||||||
for ($i = 0; $i < $resolution; $i++) {
|
for ($i = 0; $i < $resolution; $i++) {
|
||||||
$timestamp = $datelimit + ($interval * $i);
|
$timestamp = $datelimit + ($interval * $i);/*
|
||||||
|
$timestamp_short = date($time_format, $timestamp);
|
||||||
|
$long_index[$timestamp_short] = date(
|
||||||
|
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
||||||
|
$timestamp = $timestamp_short;*/
|
||||||
|
|
||||||
$graph[$timestamp]['count'] = 0;
|
$graph[$timestamp]['count'] = 0;
|
||||||
$graph[$timestamp]['timestamp_bottom'] = $timestamp;
|
$graph[$timestamp]['timestamp_bottom'] = $timestamp;
|
||||||
|
@ -343,6 +370,8 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
$graph[$timestamp]['alert'] = 0;
|
$graph[$timestamp]['alert'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$long_index = array();
|
||||||
|
|
||||||
// Calculate data for each module
|
// Calculate data for each module
|
||||||
for ($i = 0; $i < $module_number; $i++) {
|
for ($i = 0; $i < $module_number; $i++) {
|
||||||
|
|
||||||
|
@ -432,13 +461,25 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
if ($data[0]['utimestamp'] == $datelimit) {
|
if ($data[0]['utimestamp'] == $datelimit) {
|
||||||
$previous_data = $data[0]['datos'];
|
$previous_data = $data[0]['datos'];
|
||||||
$j++;
|
$j++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$max = 0;
|
||||||
|
$min = null;
|
||||||
|
$avg = 0;
|
||||||
|
$countAvg = 0;
|
||||||
|
|
||||||
// Calculate chart data
|
// Calculate chart data
|
||||||
for ($l = 0; $l < $resolution; $l++) {
|
for ($l = 0; $l < $resolution; $l++) {
|
||||||
|
$countAvg ++;
|
||||||
|
|
||||||
$timestamp = $datelimit + ($interval * $l);
|
$timestamp = $datelimit + ($interval * $l);
|
||||||
|
$timestamp_short = date($time_format, $timestamp);
|
||||||
|
$long_index[$timestamp_short] = date(
|
||||||
|
html_entity_decode($config['date_format'], ENT_QUOTES, "UTF-8"), $timestamp);
|
||||||
|
//$timestamp = $timestamp_short;
|
||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
@ -478,33 +519,56 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
// Data
|
// Data
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
//$graph_values[$i][$timestamp] = $total * $weight_list[$i];
|
//$graph_values[$i][$timestamp] = $total * $weight_list[$i];
|
||||||
$temp_graph_values[$timestamp] = $total * $weight_list[$i];
|
$temp_graph_values[$timestamp_short] = $total * $weight_list[$i];
|
||||||
|
|
||||||
$previous_data = $total;
|
$previous_data = $total;
|
||||||
// Compressed data
|
// Compressed data
|
||||||
} else {
|
} else {
|
||||||
if ($uncompressed_module || ($timestamp > time ())) {
|
if ($uncompressed_module || ($timestamp > time ())) {
|
||||||
//$graph_values[$i][$timestamp] = 0;
|
//$graph_values[$i][$timestamp] = 0;
|
||||||
$temp_graph_values[$timestamp] = 0;
|
$temp_graph_values[$timestamp_short] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i];
|
//$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i];
|
||||||
$temp_graph_values[$timestamp] = $previous_data * $weight_list[$i];
|
$temp_graph_values[$timestamp_short] = $previous_data * $weight_list[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Extract max, min, avg
|
||||||
|
if ($max < $temp_graph_values[$timestamp_short]) {
|
||||||
|
$max = $temp_graph_values[$timestamp_short];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($min)) {
|
||||||
|
if ($min > $temp_graph_values[$timestamp_short]) {
|
||||||
|
$min = $temp_graph_values[$timestamp_short];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$min = $temp_graph_values[$timestamp_short];
|
||||||
|
}
|
||||||
|
$avg += $temp_graph_values[$timestamp_short];
|
||||||
|
|
||||||
$graph_values[$i] = $temp_graph_values;
|
$graph_values[$i] = $temp_graph_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Add the max, min and avg in the legend
|
||||||
|
$avg = round($avg / $countAvg, 1);
|
||||||
|
$module_name_list[$i] .= " (".__("Max"). ":$max, ".__("Min"). ":$min, ". __("Avg"). ": $avg)";
|
||||||
|
|
||||||
if ($weight_list[$i] != 1) {
|
if ($weight_list[$i] != 1) {
|
||||||
|
//$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
|
||||||
$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
|
$module_name_list[$i] .= " (x". format_numeric ($weight_list[$i], 1).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph_values[$module_name_list[$i]] = $graph_values[$i];
|
//$graph_values[$module_name_list[$i]] = $graph_values[$i];
|
||||||
unset($graph_values[$i]);
|
//unset($graph_values[$i]);
|
||||||
|
|
||||||
|
//$graph_values[$i] = $graph_values[$i];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = array(); //debugPrint($graph_values);
|
$temp = array();
|
||||||
foreach ($graph_values as $graph_group => $point) {
|
foreach ($graph_values as $graph_group => $point) {
|
||||||
foreach ($point as $timestamp_point => $point_value) {
|
foreach ($point as $timestamp_point => $point_value) {
|
||||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
$temp[$timestamp_point][$graph_group] = $point_value;
|
||||||
|
@ -539,8 +603,14 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
switch ($stacked) {
|
switch ($stacked) {
|
||||||
case 0:
|
case 0:
|
||||||
|
/*$color = array(
|
||||||
|
0 => array('alpha' => 50),
|
||||||
|
1 => array('alpha' => 50),
|
||||||
|
2 => array('alpha' => 50)
|
||||||
|
);*/
|
||||||
|
$color = null;
|
||||||
return area_graph($config['flash_charts'], $graph_values, $width, $height,
|
return area_graph($config['flash_charts'], $graph_values, $width, $height,
|
||||||
array(), $module_name_list, array());
|
$color, $module_name_list, $long_index);
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1898,7 +1898,20 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
||||||
|
|
||||||
$table->colspan[1][0] = 3;
|
$table->colspan[1][0] = 3;
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
|
//$data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
|
||||||
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
|
$data[0] = graphic_combined_module2(
|
||||||
|
$modules,
|
||||||
|
$weights,
|
||||||
|
$content['period'],
|
||||||
|
$sizgraph_w, $sizgraph_h,
|
||||||
|
'Combined%20Sample%20Graph',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$graph["stacked"],
|
||||||
|
$report["datetime"]);
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -59,7 +59,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,$legend,
|
||||||
|
|
||||||
serialize_in_temp($graph, $id_graph);
|
serialize_in_temp($graph, $id_graph);
|
||||||
|
|
||||||
return "<img src='http://127.0.0.1/pandora_console/include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>";
|
return "<img src='http://127.0.0.1/pandora_console/include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "' />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,15 +93,15 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
|
||||||
$empty = 1;
|
$empty = 1;
|
||||||
foreach ($data as $i => $value) {
|
foreach ($data as $i => $value) {
|
||||||
|
|
||||||
$legend = '';
|
$legend_text = '';
|
||||||
if (isset($legend[$i])) {
|
if (isset($legend[$i])) {
|
||||||
$legend = $legend[$i];
|
$legend_text = $legend[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$alpha = '';
|
$alpha = '';
|
||||||
$areaBorderColor = '';
|
$areaBorderColor = '';
|
||||||
$color = '';
|
$color = '';
|
||||||
$showAreaBorder = 0;
|
$showAreaBorder = 1; //0 old default
|
||||||
if (isset($color[$i])) {
|
if (isset($color[$i])) {
|
||||||
if (!isset($color[$i]['border'])) {
|
if (!isset($color[$i]['border'])) {
|
||||||
$showAreaBorder = 1;
|
$showAreaBorder = 1;
|
||||||
|
@ -120,7 +120,7 @@ function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_inde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart->addDataSet($legend, $alpha .
|
$chart->addDataSet($legend_text, $alpha .
|
||||||
'showAreaBorder=' . $showAreaBorder . ';' .
|
'showAreaBorder=' . $showAreaBorder . ';' .
|
||||||
$areaBorderColor .
|
$areaBorderColor .
|
||||||
$color);
|
$color);
|
||||||
|
|
|
@ -45,6 +45,8 @@ if ($id_graph) {
|
||||||
$height = $graph['height'];
|
$height = $graph['height'];
|
||||||
$colors = $graph['color'];
|
$colors = $graph['color'];
|
||||||
$legend = $graph['legend'];
|
$legend = $graph['legend'];
|
||||||
|
|
||||||
|
//debugPrint($graph, true);
|
||||||
/*
|
/*
|
||||||
$colors = array();
|
$colors = array();
|
||||||
$colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50);
|
$colors['pep1'] = array('border' => '#000000', 'color' => '#000000', 'alpha' => 50);
|
||||||
|
@ -53,6 +55,10 @@ if ($id_graph) {
|
||||||
$colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50);
|
$colors['pep4'] = array('border' => '#000000', 'color' => '#0000ff', 'alpha' => 50);
|
||||||
*/
|
*/
|
||||||
$rgb_color = array();
|
$rgb_color = array();
|
||||||
|
|
||||||
|
if (!isset($colors))
|
||||||
|
$colors = array();
|
||||||
|
|
||||||
foreach($colors as $i => $color) {
|
foreach($colors as $i => $color) {
|
||||||
$rgb['border'] = html2rgb($color['border']);
|
$rgb['border'] = html2rgb($color['border']);
|
||||||
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
|
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
|
||||||
|
@ -66,6 +72,26 @@ if ($id_graph) {
|
||||||
|
|
||||||
$rgb_color[$i]['alpha'] = $color['alpha'];
|
$rgb_color[$i]['alpha'] = $color['alpha'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*foreach($colors as $i => $color) {
|
||||||
|
if (isset($color['border'])) {
|
||||||
|
$rgb['border'] = html2rgb($color['border']);
|
||||||
|
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
|
||||||
|
$rgb_color[$i]['border']['G'] = $rgb['border'][1];
|
||||||
|
$rgb_color[$i]['border']['B'] = $rgb['border'][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($color['color'])) {
|
||||||
|
$rgb['color'] = html2rgb($color['color']);
|
||||||
|
$rgb_color[$i]['color']['R'] = $rgb['color'][0];
|
||||||
|
$rgb_color[$i]['color']['G'] = $rgb['color'][1];
|
||||||
|
$rgb_color[$i]['color']['B'] = $rgb['color'][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($color['color'])) {
|
||||||
|
$rgb_color[$i]['alpha'] = $color['alpha'];
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,6 +364,23 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
|
||||||
"BorderG" => $rgb_color[$i]['border']["G"],
|
"BorderG" => $rgb_color[$i]['border']["G"],
|
||||||
"BorderB" => $rgb_color[$i]['border']["B"],
|
"BorderB" => $rgb_color[$i]['border']["B"],
|
||||||
"Alpha" => $rgb_color[$i]['alpha']));
|
"Alpha" => $rgb_color[$i]['alpha']));
|
||||||
|
|
||||||
|
/*$palette_color = array();
|
||||||
|
if (isset($rgb_color[$i]['color'])) {
|
||||||
|
$palette_color["R"] = $rgb_color[$i]['color']["R"];
|
||||||
|
$palette_color["G"] = $rgb_color[$i]['color']["G"];
|
||||||
|
$palette_color["B"] = $rgb_color[$i]['color']["B"];
|
||||||
|
}
|
||||||
|
if (isset($rgb_color[$i]['color'])) {
|
||||||
|
$palette_color["BorderR"] = $rgb_color[$i]['border']["R"];
|
||||||
|
$palette_color["BorderG"] = $rgb_color[$i]['border']["G"];
|
||||||
|
$palette_color["BorderB"] = $rgb_color[$i]['border']["B"];
|
||||||
|
}
|
||||||
|
if (isset($rgb_color[$i]['color'])) {
|
||||||
|
$palette_color["Alpha"] = $rgb_color[$i]['Alpha'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$MyData->setPalette($point_id, $palette_color);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +390,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
|
||||||
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
||||||
$MyData->setAbscissa("Xaxis");
|
$MyData->setAbscissa("Xaxis");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Create the pChart object */
|
/* Create the pChart object */
|
||||||
$myPicture = new pImage($width,$height,$MyData);
|
$myPicture = new pImage($width,$height,$MyData);
|
||||||
|
|
||||||
|
@ -357,25 +402,38 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
|
||||||
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
|
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
|
||||||
|
|
||||||
/* Set the default font */
|
/* Set the default font */
|
||||||
$myPicture->setFontProperties(array("FontName"=>"../fonts/code.ttf","FontSize"=>7));
|
$myPicture->setFontProperties(array("FontName"=>"../fonts/code.ttf","FontSize"=>10));
|
||||||
|
|
||||||
/* Define the chart area */
|
|
||||||
$myPicture->setGraphArea(30,20,$width,$height-100);
|
|
||||||
|
|
||||||
/* Draw the scale */
|
|
||||||
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "XMargin" => 40, "LabelRotation" => 90);
|
|
||||||
$myPicture->drawScale($scaleSettings);
|
|
||||||
|
|
||||||
if(isset($legend)) {
|
if(isset($legend)) {
|
||||||
/* Write the chart legend */
|
/* Write the chart legend */
|
||||||
$myPicture->drawLegend($height/2,$height-20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
|
||||||
|
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($size['Height'])) {
|
||||||
|
/* Define the chart area */
|
||||||
|
$myPicture->setGraphArea(30,$size['Height'],$width,$height - 60);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Define the chart area */
|
||||||
|
$myPicture->setGraphArea(30, 5,$width,$height - 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Draw the scale */
|
||||||
|
$scaleSettings = array("GridR"=>200,
|
||||||
|
"GridG"=>200,
|
||||||
|
"GridB"=>200,
|
||||||
|
"DrawSubTicks"=>TRUE,
|
||||||
|
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60);
|
||||||
|
$myPicture->drawScale($scaleSettings);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Turn on shadow computing */
|
/* Turn on shadow computing */
|
||||||
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||||
|
|
||||||
/* Draw the chart */
|
/* Draw the chart */
|
||||||
$settings = array("ForceTransparency"=>"-1",
|
$settings = array("ForceTransparency"=>"50", //
|
||||||
"Gradient"=>TRUE,
|
"Gradient"=>TRUE,
|
||||||
"GradientMode"=>GRADIENT_EFFECT_CAN,
|
"GradientMode"=>GRADIENT_EFFECT_CAN,
|
||||||
"DisplayValues"=>$show_values,
|
"DisplayValues"=>$show_values,
|
||||||
|
|
Loading…
Reference in New Issue