[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Dashboard/ -> line_graph.php (source)

   1  <?php
   2  
   3  /*********************************************************************************
   4  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   5   * ("License"); You may not use this file except in compliance with the License
   6   * The Original Code is:  vtiger CRM Open Source
   7   * The Initial Developer of the Original Code is vtiger.
   8   * Portions created by vtiger are Copyright (C) vtiger.
   9   * All Rights Reserved.
  10  *
  11   ********************************************************************************/
  12  
  13  include ("../../jpgraph/src/jpgraph.php");
  14  include ("../../jpgraph/src/jpgraph_line.php");
  15  
  16  
  17  $refer_code=(isset($_REQUEST['refer_code']))?$_REQUEST['refer_code']:"0,0";
  18  $datax=explode(",",$refer_code); //The values to the XAxis
  19  
  20  $names_value=(isset($_REQUEST['referdata']))?$_REQUEST['referdata']:"null"; //The Status Name 
  21  $name_value=explode(",",$names_value);
  22  
  23  //Giving the colors to the Line graph
  24  $color_array=array("red","blue","orange","green","darkorchid","gold1","gray3","lightpink","burlywood2","cadetblue");
  25  $datavalue=(isset($_REQUEST['datavalue']))?$_REQUEST['datavalue']:"0,K,0";
  26  
  27  //Exploding the Ticket status 
  28  $datavalue=explode("K",$datavalue); 
  29  
  30  
  31  $width=(isset($_REQUEST['width']))?$_REQUEST['width']:410;
  32  $height=(isset($_REQUEST['height']))?$_REQUEST['height']:270;
  33  $left=(isset($_REQUEST['left']))?$_REQUEST['left']:50;
  34  $right=(isset($_REQUEST['right']))?$_REQUEST['right']:130;
  35  $top=(isset($_REQUEST['top']))?$_REQUEST['top']:50;
  36  $bottom=(isset($_REQUEST['bottom']))?$_REQUEST['bottom']:60;
  37  $title=(isset($_REQUEST['title']))?$_REQUEST['title']:"Horizontal graph";
  38  $target_val=(isset($_REQUEST['target_val']))?$_REQUEST['target_val']:"";
  39  
  40  
  41  // Setup the graph
  42  
  43  $graph = new Graph($width,$height);
  44  $graph->SetMarginColor('white');
  45  $graph->SetScale("textlin");
  46  $graph->SetMargin($left,$right,$top,$bottom);
  47  $graph->tabtitle->Set($title );
  48  $graph->tabtitle->SetFont(FF_FONT2,FS_BOLD,13);
  49  $graph->yaxis->HideZeroLabel();
  50  $graph->xgrid->Show();
  51  
  52  $thick=6;
  53  // Create the lines of the Graph
  54  for($i=0;$i<count($datavalue);$i++)
  55  {
  56      $data=$datavalue[$i];
  57      $graph_data=explode(",",$data);
  58  
  59      $name=$name_value[$i];
  60      $color_val=$color_array[$i];
  61      $temp="p".$i;
  62      $$temp = new LinePlot($graph_data);
  63      $$temp->SetColor($color_val);
  64      $$temp->SetLegend($name);
  65  
  66      $x_thick=$thick-$i;    
  67      if($x_thick<=1)
  68          $x_thick=1;
  69  
  70      $$temp->SetWeight($x_thick);
  71      $graph->Add($$temp);
  72  
  73      $max=0;
  74      for($j=0;$j<count($graph_data); $j++)
  75      {
  76          $x=$graph_data[$j];
  77          if($x>=$max)
  78              $max=$x;
  79          else
  80              $max=$max;
  81      }
  82  }
  83  
  84  
  85  if($max>=5)
  86  {
  87      $graph->yaxis->SetLabelFormat('%d');
  88  }
  89  $graph->legend->Pos(0,0.4,"right","center");
  90  
  91  // Set some other color then the boring default
  92  $graph->SetColor("#CCDFCC");
  93  $graph->SetMarginColor("#98C098");
  94  $graph->xaxis->SetTickLabels($datax);
  95  $graph->xaxis->SetLabelAngle(90);
  96  
  97  // Output line
  98  $graph->Stroke();
  99  
 100  
 101  
 102  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7