[ 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/ -> GraphBarAndCurb.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: GraphBarAndCurb.class.php 80 2006-09-14 14:49:54Z matthieu_ $
  11  
  12  
  13  require_once  INCLUDE_PATH . "/libs/artichow/BarPlot.class.php";
  14  require_once  INCLUDE_PATH . "/libs/artichow/LinePlot.class.php";
  15  require_once  INCLUDE_PATH . "/core/include/graphs/PmvGraph.class.php";
  16  
  17  class GraphBarAndCurb extends PmvGraph
  18  {
  19  	function GraphBarAndCurb( $width, $height, $showAllLabels = true)
  20      {
  21          parent::PmvGraph($width, $height);
  22          $this->showLabelBar2 = $showAllLabels;
  23      }
  24  
  25  	function setData( $a_data )
  26      {
  27          $this->x = $a_data['axis'];
  28          $this->y1 = $a_data['data1']['data'];
  29          $this->y2 = $a_data['data2']['data'];
  30          $this->y1Legend = $a_data['data1']['legend'];
  31          $this->y2Legend = $a_data['data2']['legend'];
  32          $this->title = $a_data['title'];
  33          
  34          if(isset($a_data['interval']))
  35          {
  36              $this->interval = $a_data['interval'];
  37          }
  38          /*if($this->interval)
  39          {
  40              foreach($this->x as $key => $value)
  41              {
  42                  $n[$key] = substr($value, 0, 6);
  43              }
  44              $this->x = $n;
  45          }*/
  46      }
  47  
  48  	function process()
  49      {
  50          parent::process();
  51          
  52          $this->setPmvTitle( $this->graph );
  53          $this->setPmvBackgroundGradient($this->graph);
  54          
  55  
  56          /**
  57           * group (bar + line)
  58           */
  59          $group = new PlotGroup();
  60          
  61          $this->setPmvGroupProperties( $group );
  62  
  63          $group->axis->right->setColor(new Red);
  64          $group->axis->right->label->setFont(new Font2);
  65  
  66  
  67          /**
  68           * line
  69           */
  70          $plot = new LinePlot($this->y2, LINEPLOT_MIDDLE);
  71  
  72          $plot->setColor(new Red);
  73          $plot->setThickness(1);
  74          $plot->setYAxis(PLOT_RIGHT);
  75  
  76          $group->legend->add($plot, $this->y2Legend, LEGEND_MARK);
  77          $group->add($plot);
  78  
  79  
  80          /**
  81           * vertical bar
  82           */
  83          $plot = new BarPlot($this->y1);
  84  
  85          $plot->grid->setType( LINE_DASHED );
  86  
  87          $this->setPmvPadding( $plot );
  88          $this->setPmvBackgroundGradient( $plot );
  89          $this->setPmvBarBorderProperties( $plot );
  90          $this->setPmvBarShadowProperties( $plot );
  91          $this->setPmvLabelProperties( $plot, $this->y1 );
  92          $this->setPmvBarGradient( $plot );
  93          $this->setPmvBarSize( $plot );
  94          
  95          //$plot->xAxis->setColor( new Color(  50, 97, 243) );
  96          //$plot->yAxis->setColor( new Color(  50, 97, 243) );
  97          //$plot->xAxis->label->setFont($this->font20);
  98  
  99          $group->axis->bottom->setLabelText($this->x);
 100          $group->axis->bottom->setPadding(0,0,100,0);
 101      
 102          
 103          // display one axis label on two because too long for Mar 04 Apr 04 etc.
 104          if(isset($this->interval))
 105          {
 106              $group->axis->bottom->label->setInterval(2);
 107          }
 108          
 109          $group->legend->add($plot, $this->y1Legend, LEGEND_BACKGROUND);
 110          $group->add($plot);
 111          
 112  
 113          /**
 114           * add group to graph
 115           */
 116          
 117          $this->graph->add($group);
 118      }
 119  
 120  	function display()
 121      {
 122          $this->draw();
 123      }
 124  }
 125  ?>


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