From: Davide Franco Date: Mon, 27 Jun 2011 16:14:46 +0000 (+0200) Subject: bacula-web: Renamed bgraph.class.php to cgraph.class.php X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d3a0e941064af6d9354c2ef26b5627850ccceebf;p=bacula%2Fbacula bacula-web: Renamed bgraph.class.php to cgraph.class.php --- diff --git a/gui/bacula-web/includes/graph/bgraph.class.php b/gui/bacula-web/includes/graph/bgraph.class.php deleted file mode 100644 index 1c110fd491..0000000000 --- a/gui/bacula-web/includes/graph/bgraph.class.php +++ /dev/null @@ -1,142 +0,0 @@ -output_file = 'templates_c/' . $filename; - } - - public function SetData( $data_in, $type, $data_type, $shading = 5 ) - { - $this->data = $data_in; - $this->type = $type; - $this->data_type = $data_type; - $this->shadding = $shading; - } - - public function SetGraphSize( $width, $height ) - { - $this->width = $width; - $this->height = $height; - } - - public function SetTitle( $title ) - { - if( !empty($title) ) - $this->title = $title; - else - die( "Please provide a non empty title for the graph" ); - } - - public function SetYTitle( $ytitle ) - { - if( !empty($ytitle) ) - $this->ytitle = $ytitle; - else - die( "Please provide a non empty title for the Y axis" ); - } - - public function SetColors( $colors ) - { - if( is_array( $colors ) ) - $this->colors = $colors; - else - die( "Please provide a array in BGraph->SetColors()" ); - } - - public function Get_Image_file() - { - return $this->output_file; - } - - public function Render() - { - // Setting the size - $this->plot = new PHPlot( $this->width, $this->height ); - - // Render to file instead of screen - $this->plot->SetOutputFile( $this->output_file ); - $this->plot->SetFileFormat("png"); - $this->plot->SetIsInline( true ); - - - $this->plot->SetImageBorderType('plain'); - - // Data, type and data type - $this->plot->SetPlotType( $this->type ); - $this->plot->SetDataType( $this->data_type ); - $this->plot->SetDataValues( $this->data ); - - // Plot colors - $this->plot->SetDataColors( $this->colors ); - - // Plot shading - $this->plot->SetShading( $this->shading ); - - // 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 ); - - // 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'); - $this->plot->SetPlotAreaWorld(NULL, 0, NULL, NULL); - - - $this->plot->DrawGraph(); - } // end function Render() -} // end BGraph classe - -?> diff --git a/gui/bacula-web/includes/graph/cgraph.class.php b/gui/bacula-web/includes/graph/cgraph.class.php new file mode 100644 index 0000000000..1c110fd491 --- /dev/null +++ b/gui/bacula-web/includes/graph/cgraph.class.php @@ -0,0 +1,142 @@ +output_file = 'templates_c/' . $filename; + } + + public function SetData( $data_in, $type, $data_type, $shading = 5 ) + { + $this->data = $data_in; + $this->type = $type; + $this->data_type = $data_type; + $this->shadding = $shading; + } + + public function SetGraphSize( $width, $height ) + { + $this->width = $width; + $this->height = $height; + } + + public function SetTitle( $title ) + { + if( !empty($title) ) + $this->title = $title; + else + die( "Please provide a non empty title for the graph" ); + } + + public function SetYTitle( $ytitle ) + { + if( !empty($ytitle) ) + $this->ytitle = $ytitle; + else + die( "Please provide a non empty title for the Y axis" ); + } + + public function SetColors( $colors ) + { + if( is_array( $colors ) ) + $this->colors = $colors; + else + die( "Please provide a array in BGraph->SetColors()" ); + } + + public function Get_Image_file() + { + return $this->output_file; + } + + public function Render() + { + // Setting the size + $this->plot = new PHPlot( $this->width, $this->height ); + + // Render to file instead of screen + $this->plot->SetOutputFile( $this->output_file ); + $this->plot->SetFileFormat("png"); + $this->plot->SetIsInline( true ); + + + $this->plot->SetImageBorderType('plain'); + + // Data, type and data type + $this->plot->SetPlotType( $this->type ); + $this->plot->SetDataType( $this->data_type ); + $this->plot->SetDataValues( $this->data ); + + // Plot colors + $this->plot->SetDataColors( $this->colors ); + + // Plot shading + $this->plot->SetShading( $this->shading ); + + // 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 ); + + // 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'); + $this->plot->SetPlotAreaWorld(NULL, 0, NULL, NULL); + + + $this->plot->DrawGraph(); + } // end function Render() +} // end BGraph classe + +?>