2011-04-14 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_pchart.php: added method to force height or not, changed to show all columns name in the hgraph and vgraph, fixed the colors when passed the parameter "fine" to color. And in the function "pch_bar_graph" change to calculate left margin instead to fixed value. * include/graphs/fgraph.php: added new parameter in the function "hbar_graph" to force or unforce the graph height. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4221 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
eabc072e80
commit
cca80873f5
|
@ -1,3 +1,13 @@
|
||||||
|
2011-04-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/graphs/functions_pchart.php: added method to force height or not,
|
||||||
|
changed to show all columns name in the hgraph and vgraph, fixed the colors
|
||||||
|
when passed the parameter "fine" to color. And in the function
|
||||||
|
"pch_bar_graph" change to calculate left margin instead to fixed value.
|
||||||
|
|
||||||
|
* include/graphs/fgraph.php: added new parameter in the function
|
||||||
|
"hbar_graph" to force or unforce the graph height.
|
||||||
|
|
||||||
2011-04-14 Miguel de Dios <miguel.dedios@artica.es>
|
2011-04-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/graphs/functions_pchart.php: setted the xmargin to 0.
|
* include/graphs/functions_pchart.php: setted the xmargin to 0.
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
|
||||||
// If is called from index
|
// If is called from index
|
||||||
if(file_exists('include/functions.php')) {
|
if(file_exists('include/functions.php')) {
|
||||||
include_once('include/functions.php');
|
include_once('include/functions.php');
|
||||||
|
@ -260,7 +261,7 @@ function polar_graph($flash_chart, $chart_data, $width, $height, $no_data_image)
|
||||||
return kiviat_graph('polar', $flash_chart, $chart_data, $width, $height, $no_data_image);
|
return kiviat_graph('polar', $flash_chart, $chart_data, $width, $height, $no_data_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), $legend = array(), $xaxisname = "", $yaxisname = "") {
|
function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), $legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true) {
|
||||||
if($flash_chart) {
|
if($flash_chart) {
|
||||||
echo fs_hbar_chart (array_values($chart_data), array_keys($chart_data), $width, $height);
|
echo fs_hbar_chart (array_values($chart_data), array_keys($chart_data), $width, $height);
|
||||||
}
|
}
|
||||||
|
@ -273,6 +274,7 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array()
|
||||||
$graph['legend'] = $legend;
|
$graph['legend'] = $legend;
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$graph['xaxisname'] = $xaxisname;
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$graph['yaxisname'] = $yaxisname;
|
||||||
|
$graph['force_height'] = $force_height;
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph);
|
$id_graph = serialize_in_temp($graph);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,17 @@ if(isset($graph['font'])) {
|
||||||
if(isset($graph['round_corner'])) {
|
if(isset($graph['round_corner'])) {
|
||||||
$round_corner = $graph['round_corner'];
|
$round_corner = $graph['round_corner'];
|
||||||
}
|
}
|
||||||
|
$force_height = true;
|
||||||
|
if(isset($graph['force_height'])) {
|
||||||
|
$force_height = $graph['force_height'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$force_height) {
|
||||||
|
if ($height < (count($graph['data']) * 14)) {
|
||||||
|
$height = (count($graph['data']) * 14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$colors = array();
|
$colors = array();
|
||||||
|
@ -92,6 +103,11 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
$step = round($ndata/$xdata_display);
|
$step = round($ndata/$xdata_display);
|
||||||
|
|
||||||
|
if(($graph_type == 'hbar') || ($graph_type == 'vbar')) {
|
||||||
|
$step = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$c = 0;
|
$c = 0;
|
||||||
|
|
||||||
switch($graph_type) {
|
switch($graph_type) {
|
||||||
|
@ -127,6 +143,7 @@ switch($graph_type) {
|
||||||
$fine_colors[$i]['B'] = $rgb_fine[2];
|
$fine_colors[$i]['B'] = $rgb_fine[2];
|
||||||
$fine_colors[$i]['Alpha'] = 100;
|
$fine_colors[$i]['Alpha'] = 100;
|
||||||
}
|
}
|
||||||
|
$colors = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -456,7 +473,20 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $rgb_color
|
||||||
break;
|
break;
|
||||||
case "hbar":
|
case "hbar":
|
||||||
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM);
|
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM);
|
||||||
$leftmargin = 100;
|
//$leftmargin = 100;
|
||||||
|
|
||||||
|
//Calculate the bottom margin from the size of string in each index
|
||||||
|
$max_chars = 0;
|
||||||
|
foreach ($index as $string_index) {
|
||||||
|
if (empty($string_index)) continue;
|
||||||
|
|
||||||
|
$len = strlen($string_index);
|
||||||
|
if ($len > $max_chars) {
|
||||||
|
$max_chars = $len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$leftmargin = 5 * $max_chars;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue