From 2590b56dd33cb42be29afbecc9d223147bdd8a39 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Sun, 24 Jul 2011 12:25:05 +0200 Subject: [PATCH] bacula-web: Improved code in CGraph class - Changed angle for X axis with bars graph --- .../includes/graph/cgraph.class.php | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gui/bacula-web/includes/graph/cgraph.class.php b/gui/bacula-web/includes/graph/cgraph.class.php index 255931aa0e..e710306494 100644 --- a/gui/bacula-web/includes/graph/cgraph.class.php +++ b/gui/bacula-web/includes/graph/cgraph.class.php @@ -106,29 +106,28 @@ class CGraph{ // Image border $this->plot->SetImageBorderType( 'none' ); - // Plot area (calculated regarding the width and height of the graph) - if( $this->type == 'pie' ) - $this->plot->SetPlotAreaPixels( 10, 10, ($this->width / 2), $this->height-10 ); + switch( $this->type ) + { + case 'pie': + $this->plot->SetPlotAreaPixels( 10, 10, ($this->width / 2), $this->height-10 ); + $this->plot->SetLabelScalePosition( 0.2 ); + + $legends = array(); + foreach( $this->data as $key => $legend ) + $this->plot->SetLegend( implode(': ',$legend) ); + break; + case 'bars': + $this->plot->SetXLabelAngle(90); + break; + } // Legend position (calculated regarding the width and height of the graph) $this->plot->SetLegendPixels( ($this->width / 2) + 10, 25 ); - - // Labels scale position - if( $this->type == 'pie' ) - $this->plot->SetLabelScalePosition( 0.2 ); // Graph title $this->plot->SetTitle( $this->title ); $this->plot->SetYTitle( $this->ytitle ); - // Setting up legends - if( $this->type != 'bars' ) { - $legends = array(); - foreach( $this->data as $key => $legend ) { - $this->plot->SetLegend( implode(': ',$legend) ); - } - } - # Turn off X tick labels and ticks because they don't apply here: $this->plot->SetXTickLabelPos('none'); $this->plot->SetXTickPos('none'); @@ -138,5 +137,4 @@ class CGraph{ $this->plot->DrawGraph(); } // end function Render() } // end BGraph classe - ?> -- 2.39.5