[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/include/graphs/ -> Graph3DPie.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: Graph3DPie.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  require_once  INCLUDE_PATH . "/libs/artichow/Pie.class.php";
  14  require_once  INCLUDE_PATH . "/core/include/graphs/PmvGraph.class.php";
  15  
  16  class Graph3DPie extends PmvGraph
  17  {
  18  	function Graph3DPie( $width, $height, $set3D = true)
  19      {
  20          parent::PmvGraph($width, $height    );    
  21          $this->set3D = $set3D;
  22      }
  23      
  24  	function setData( $a_data )
  25      {
  26          $this->x = $a_data['axis'];
  27          $this->y = $a_data['data'];
  28          $this->title = $a_data['title'];
  29          
  30          $sum = array_sum($this->y);
  31          foreach($this->x as $key => $value)
  32          {
  33              $this->x[$key] = $value . " (". round($this->y[$key] * 100 / $sum) ."%)";
  34          }
  35      }
  36      
  37  	function process()
  38      {
  39          parent::process();
  40          $this->graph->setAntiAliasing(false);
  41          $this->setPmvTitle( $this->graph );
  42          
  43          $this->plot = new Pie($this->y);
  44          $this->setPmvBackgroundGradient($this->graph);
  45          $this->plot->setCenter(0.3, 0.5);
  46          $this->plot->legend->setAlign(LEGEND_RIGHT);
  47          
  48          if($this->set3D)
  49          {    
  50              $this->plot->setSize(0.55, 0.7);
  51              $this->plot->set3D(25);
  52              $this->plot->setAbsSize(240, 155);
  53              if($this->width > 400)
  54              {
  55                  $this->plot->setCenter(0.25, 0.5);
  56                  $this->plot->legend->setPosition( 2, 0.45 );
  57              }
  58              else
  59              {
  60                  $this->plot->legend->setPosition( 1.6, 0.45 );
  61              }
  62          }
  63          else
  64          {            
  65              $this->plot->legend->setPosition(1.6, 0.15    );
  66              $this->plot->setAbsSize(220, 220);
  67              $this->plot->setCenter(0.35, 0.55);
  68          }
  69          
  70          $this->plot->setBorder(new Black);//Color(96, 115, 165));
  71          $this->plot->setLabelPosition(10);
  72          $this->plot->label->setPadding(2, 2, 2, 2);
  73          $this->plot->label->setFont($this->font9);
  74          $this->plot->setLegend( $this->x );
  75          $this->plot->legend->setTextFont($this->font10);
  76      }
  77      
  78  	function display()
  79      {
  80          $this->graph->add($this->plot);
  81          $this->draw();
  82      }
  83  }
  84  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics