From: Davide Franco Date: Sun, 24 Jul 2011 10:25:05 +0000 (+0200) Subject: bacula-web: Improved code in CGraph class X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b109874f04f07204aef1de657103ed5b5e4361f9;p=bacula%2Fbacula bacula-web: Improved code in CGraph class - Changed angle for X axis with bars graph --- 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 - ?>