[ 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/ -> GraphSplitBar.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: GraphSplitBar.class.php 29 2006-08-18 07:35:21Z matthieu_ $
  11  
  12  
  13  require_once  INCLUDE_PATH . "/libs/artichow/BarPlot.class.php";
  14  require_once  INCLUDE_PATH . "/core/include/graphs/PmvGraph.class.php";
  15  
  16  class GraphSplitBar extends PmvGraph
  17  {
  18  	function GraphSplitBar( $width = 600, $height = 250, $showLabelBar2 = true)
  19      {
  20          parent::PmvGraph($width, $height);    
  21          $this->showLabelBar2 = $showLabelBar2;
  22      }
  23      
  24  	function setData( $a_data )
  25      {
  26          $this->x = $a_data['axis'];
  27          $this->y1 = $a_data['data1']['data'];
  28          $this->y1Legend = $a_data['data1']['legend'];
  29          if(isset($a_data['data2']['data']))
  30          {
  31              $this->y2 = $a_data['data2']['data'];
  32              $this->y2Legend = $a_data['data2']['legend'];
  33          }
  34          $this->title = $a_data['title'];
  35      }
  36      
  37  	function process()
  38      {
  39                  
  40          parent::process();
  41          
  42          $this->setPmvTitle( $this->graph );
  43          $this->setPmvBackgroundGradient( $this->graph );
  44          
  45  
  46          /**
  47           * group (bar + line)
  48           */
  49          $group = new PlotGroup();
  50          
  51          $this->setPmvGroupProperties( $group );
  52          $group->axis->bottom->setLabelText($this->x);
  53          
  54          // Add a bar plot
  55          $plot = new BarPlot($this->y1, 1);
  56          
  57          $this->setPmvBarShadowProperties( $plot );
  58          
  59          $this->setPmvLabelProperties( $plot, $this->y1 );
  60          $this->setPmvBarGradient( $plot );
  61          $this->setPmvBarSize( $plot );
  62          
  63          if(!$this->showLabelBar2 && strlen($this->y1[0]) > 2)
  64          {
  65              $plot->label->setInterval(2);
  66          }
  67          $group->legend->add($plot, $this->y1Legend, LEGEND_BACKGROUND);
  68          $group->add($plot);
  69          
  70          if(isset($this->y2))
  71          {
  72              // Add a second bar plot        
  73              $plot = new BarPlot($this->y2, 1);
  74              
  75              if($this->showLabelBar2)
  76              {
  77                  $this->setPmvLabelProperties( $plot, $this->y2 );
  78                  $plot->label->move(-5, 4);
  79                  $plot->move(-5, 0);
  80              }
  81              else
  82              {
  83                  $plot->move(-2, 0);
  84              }
  85              $this->setPmvBackgroundGradient( $plot );
  86              $this->setPmvBarBorderProperties( $plot );        
  87              $plot->setBarGradient(
  88                  new LinearGradient(
  89                      new Color(126, 126, 176),
  90                      new Color(158, 158, 222),
  91                      0
  92                  )
  93              );
  94              $this->setPmvBarSize( $plot );
  95              $group->legend->add($plot, $this->y2Legend, LEGEND_BACKGROUND);
  96              $group->add($plot);
  97          }    
  98          $group->legend->setTextFont($this->font9);
  99          $this->graph->add($group);
 100          $this->graph->draw();
 101      }
 102      
 103  	function display()
 104      {
 105          $this->draw();
 106      }
 107  }
 108  ?>


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