2011-04-13 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php include/functions_custom_graphs.php: Improved the vertical graph legend to use in horizontal when is possible. Fixing a Miguel modification erased by me in the last commit. Fix a combined graph bug in the size git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4202 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7fe638e70d
commit
4ce26cf019
|
@ -1,3 +1,13 @@
|
|||
2011-04-13 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/graphs/functions_pchart.php
|
||||
include/functions_custom_graphs.php: Improved the
|
||||
vertical graph legend to use in horizontal when
|
||||
is possible.
|
||||
Fixing a Miguel modification erased by me in the last
|
||||
commit.
|
||||
Fix a combined graph bug in the size
|
||||
|
||||
2011-04-13 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
|
|
|
@ -28,6 +28,8 @@ if ($config['flash_charts']) {
|
|||
require_once ('include/fgraph.php');
|
||||
}
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
/**
|
||||
* Get all the custom graphs a user can see.
|
||||
*
|
||||
|
@ -89,11 +91,10 @@ function get_user_custom_graphs ($id_user = 0, $only_names = false, $returnAllGr
|
|||
* @param $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param $date Date to start printing the graph
|
||||
*/
|
||||
|
||||
function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) {
|
||||
global $config;
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
|
||||
$sources = get_db_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph);
|
||||
$modules = array ();
|
||||
$weights = array ();
|
||||
|
|
|
@ -566,9 +566,16 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
|
|||
$myPicture->setFontProperties(array("FontName"=>"../fonts/code.ttf","FontSize"=>10));
|
||||
|
||||
if(isset($legend)) {
|
||||
/* Set horizontal legend if is posible */
|
||||
$legend_mode = LEGEND_HORIZONTAL;
|
||||
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
|
||||
if($size['Width'] > ($width - 5)) {
|
||||
$legend_mode = LEGEND_VERTICAL;
|
||||
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
|
||||
}
|
||||
|
||||
/* Write the chart legend */
|
||||
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
|
||||
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
|
||||
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
|
||||
}
|
||||
|
||||
//Calculate the bottom margin from the size of string in each index
|
||||
|
@ -742,4 +749,4 @@ function pch_horizontal_graph ($graph_type, $index, $data, $width, $height, $xax
|
|||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
?>
|
||||
?>
|
Loading…
Reference in New Issue