diff -Naur pChart/pChart.class.php pChart-tnet/pChart.class.php
--- pChart/pChart.class.php	2008-10-06 16:04:23.000000000 +0200
+++ pChart-tnet/pChart.class.php	2009-10-20 18:33:03.840557000 +0200
@@ -159,6 +159,7 @@
    var $DivisionRatio   = NULL;
    var $XDivisionRatio  = NULL;
    var $DivisionWidth   = NULL;
+   var $tickMarkXPositions = null;
    var $DataCount       = NULL;
    var $Currency        = "\$";
 
@@ -194,7 +195,7 @@
    var $MapID            = NULL;
 
    /* This function create the background picture */
-   function pChart($XSize,$YSize)
+   function pChart($XSize,$YSize,$useTransparency=true)
     {
      $this->XSize   = $XSize;
      $this->YSize   = $YSize;
@@ -202,7 +203,8 @@
 
      $C_White =$this->AllocateColor($this->Picture,255,255,255);
      imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White);
-     imagecolortransparent($this->Picture,$C_White);
+     if ($useTransparency)
+     	imagecolortransparent($this->Picture,$C_White);
 
      $this->setFontProperties("tahoma.ttf",8);
     }
@@ -243,9 +245,9 @@
    /* Set Palette color */
    function setColorPalette($ID,$R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $this->Palette[$ID]["R"] = $R;
      $this->Palette[$ID]["G"] = $G;
@@ -465,14 +467,15 @@
           {
            $Scale1 = ( $this->VMax - $this->VMin ) / $Factor;
            $Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2;
-           $Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4;
+           $Scale5 = ( $this->VMax - $this->VMin ) / $Factor / 5;
 
            if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;}
            if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;}
+           if ( $Scale5 > 1 && $Scale5 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale5); $Scale = 5;}
            if (!$ScaleOk)
             {
              if ( $Scale2 > 1 ) { $Factor = $Factor * 10; }
-             if ( $Scale2 < 1 ) { $Factor = $Factor / 10; }
+             else if ( $Scale2 <= 1 ) { $Factor = $Factor / 10; }
             }
           }
 
@@ -544,13 +547,13 @@
        $Value     = round($Value * pow(10,$Decimals)) / pow(10,$Decimals);
        if ( $DataDescription["Format"]["Y"] == "number" )
         $Value = $Value.$DataDescription["Unit"]["Y"];
-       if ( $DataDescription["Format"]["Y"] == "time" )
+       else if ( $DataDescription["Format"]["Y"] == "time" )
         $Value = $this->ToTime($Value);        
-       if ( $DataDescription["Format"]["Y"] == "date" )
+       else if ( $DataDescription["Format"]["Y"] == "date" )
         $Value = $this->ToDate($Value);        
-       if ( $DataDescription["Format"]["Y"] == "metric" )
+       else if ( $DataDescription["Format"]["Y"] == "metric" )
         $Value = $this->ToMetric($Value);        
-       if ( $DataDescription["Format"]["Y"] == "currency" )
+       else if ( $DataDescription["Format"]["Y"] == "currency" )
         $Value = $this->ToCurrency($Value);        
 
        $Position  = imageftbbox($this->FontSize,0,$this->FontName,$Value);
@@ -590,17 +593,20 @@
       {
        if ( $ID % $SkipLabels == 0 )
         {
-         $this->drawLine(floor($XPos),$this->GArea_Y2,floor($XPos),$this->GArea_Y2+5,$R,$G,$B);
+        	$iXPos = (int)$XPos;
+        	$this->tickMarkXPositions[] = $iXPos;
+        $this->drawLine($iXPos, $this->GArea_Y2, $iXPos, $this->GArea_Y2 + 5, $R, $G, $B); // The little tick
+        
          $Value      = $Data[$Key][$DataDescription["Position"]];
          if ( $DataDescription["Format"]["X"] == "number" )
           $Value = $Value.$DataDescription["Unit"]["X"];
-         if ( $DataDescription["Format"]["X"] == "time" )
+         else if ( $DataDescription["Format"]["X"] == "time" )
           $Value = $this->ToTime($Value);        
-         if ( $DataDescription["Format"]["X"] == "date" )
+         else if ( $DataDescription["Format"]["X"] == "date" )
           $Value = $this->ToDate($Value);        
-         if ( $DataDescription["Format"]["X"] == "metric" )
+         else if ( $DataDescription["Format"]["X"] == "metric" )
           $Value = $this->ToMetric($Value);        
-         if ( $DataDescription["Format"]["X"] == "currency" )
+         else if ( $DataDescription["Format"]["X"] == "currency" )
           $Value = $this->ToCurrency($Value);        
 
          $Position   = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value);
@@ -947,6 +953,15 @@
      else
       { $XPos = $this->GArea_X1 + $this->GAreaXOffset; $ColCount = floor( ($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth ); }
 
+     if(!empty($this->tickMarkXPositions))
+     {
+	     foreach($this->tickMarkXPositions as $iXPos)
+	      {
+	        $this->drawDottedLine($iXPos, $this->GArea_Y1, $iXPos, $this->GArea_Y2, $LineWidth, $R, $G, $B);
+	      }
+     }
+     else
+     {
      for($i=1;$i<=$ColCount;$i++)
       {
        if ( $XPos > $this->GArea_X1 && $XPos < $this->GArea_X2 )
@@ -954,6 +969,7 @@
        $XPos = $XPos + $this->DivisionWidth;
       }
     }
+   }
 
    /* retrieve the legends size */
    function getLegendBoxSize($DataDescription)
@@ -1129,9 +1145,9 @@
    /* Compute and draw the scale */
    function drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnRight=FALSE,$TickWidth=4,$FreeText=NULL)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B);
      $Y = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio;
@@ -2745,9 +2761,9 @@
    /* This function can be used to set the background color */
    function drawBackground($R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Background = $this->AllocateColor($this->Picture,$R,$G,$B);
      imagefilledrectangle($this->Picture,0,0,$this->XSize,$this->YSize,$C_Background);
@@ -2756,9 +2772,9 @@
    /* This function can be used to set the background color */
    function drawGraphAreaGradient($R,$G,$B,$Decay,$Target=TARGET_GRAPHAREA)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      if ( $Target == TARGET_GRAPHAREA )  { $X1 = $this->GArea_X1+1; $X2 = $this->GArea_X2-1; $Y1 = $this->GArea_Y1+1; $Y2 = $this->GArea_Y2; }
      if ( $Target == TARGET_BACKGROUND ) { $X1 = 0; $X2 = $this->XSize; $Y1 = 0; $Y2 = $this->YSize; }
@@ -2800,9 +2816,9 @@
    /* This function create a rectangle with antialias */
    function drawRectangle($X1,$Y1,$X2,$Y2,$R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
 
@@ -2820,9 +2836,9 @@
      if ( $X2 < $X1 ) { list($X1, $X2) = array($X2, $X1); }
      if ( $Y2 < $Y1 ) { list($Y1, $Y2) = array($Y2, $Y1); }
 
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      if ( $Alpha == 100 )
       {
@@ -2872,9 +2888,9 @@
    /* This function create a rectangle with rounded corners and antialias */
    function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
 
@@ -2910,9 +2926,9 @@
    /* This function create a filled rectangle with rounded corners and antialias */
    function drawFilledRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Rectangle = $this->AllocateColor($this->Picture,$R,$G,$B);
 
@@ -2958,9 +2974,9 @@
    function drawCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
     {
      if ( $Width == 0 ) { $Width = $Height; }
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Circle = $this->AllocateColor($this->Picture,$R,$G,$B);
      $Step     = 360 / (2 * 3.1418 * max($Width,$Height));
@@ -2977,9 +2993,9 @@
    function drawFilledCircle($Xc,$Yc,$Height,$R,$G,$B,$Width=0)
     {
      if ( $Width == 0 ) { $Width = $Height; }
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $C_Circle = $this->AllocateColor($this->Picture,$R,$G,$B);
      $Step     = 360 / (2 * 3.1418 * max($Width,$Height));
@@ -3011,9 +3027,9 @@
    function drawLine($X1,$Y1,$X2,$Y2,$R,$G,$B,$GraphFunction=FALSE)
     {
      if ( $this->LineDotSize > 1 ) { $this->drawDottedLine($X1,$Y1,$X2,$Y2,$this->LineDotSize,$R,$G,$B,$GraphFunction); return(0); }
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));  
      if ( $Distance == 0 )
@@ -3043,9 +3059,9 @@
    /* This function create a line with antialias */
    function drawDottedLine($X1,$Y1,$X2,$Y2,$DotSize,$R,$G,$B,$GraphFunction=FALSE)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      $Distance = sqrt(($X2-$X1)*($X2-$X1)+($Y2-$Y1)*($Y2-$Y1));  
 
@@ -3111,13 +3127,13 @@
    /* Draw an alpha pixel */
    function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B)
     {
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
-
      if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize )
       return(-1);
 
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
+
      $RGB2 = imagecolorat($this->Picture, $X, $Y);
      $R2   = ($RGB2 >> 16) & 0xFF;
      $G2   = ($RGB2 >> 8) & 0xFF;
@@ -3126,9 +3142,9 @@
      $iAlpha = (100 - $Alpha)/100;
      $Alpha  = $Alpha / 100;
 
-     $Ra   = floor($R*$Alpha+$R2*$iAlpha);
-     $Ga   = floor($G*$Alpha+$G2*$iAlpha);
-     $Ba   = floor($B*$Alpha+$B2*$iAlpha);
+     $Ra   = (int)($R*$Alpha+$R2*$iAlpha);
+     $Ga   = (int)($G*$Alpha+$G2*$iAlpha);
+     $Ba   = (int)($B*$Alpha+$B2*$iAlpha);
 
      $C_Aliased = $this->AllocateColor($this->Picture,$Ra,$Ga,$Ba);
      imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
@@ -3140,9 +3156,9 @@
      $R = $R + $Factor;
      $G = $G + $Factor;
      $B = $B + $Factor;
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
 
      return(imagecolorallocate($Picture,$R,$G,$B));
     }
@@ -3215,13 +3231,12 @@
         }
       }
 
-     if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
-     if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
-     if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }
-
-     $Plot = "";
-     $Xi   = floor($X);
-     $Yi   = floor($Y);
+     if ( $R < 0 ) { $R = 0; } else if ( $R > 255 ) { $R = 255; }
+     if ( $G < 0 ) { $G = 0; } else if ( $G > 255 ) { $G = 255; }
+     if ( $B < 0 ) { $B = 0; } else if ( $B > 255 ) { $B = 255; }
+
+     $Xi   = (int)$X;
+     $Yi   = (int)$Y;
 
      if ( $Xi == $X && $Yi == $Y)
       {
@@ -3235,16 +3250,18 @@
       }
      else
       {
-       $Alpha1 = (((1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
+      	$xdiff = ($X - $Xi);
+      	$ydiff = ($Y - $Yi);
+       $Alpha1 = (((1 - $xdiff) * (1 - $ydiff) * 100) / 100) * $Alpha;
        if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); }
 
-       $Alpha2 = ((($X - floor($X)) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha;
+       $Alpha2 = (($xdiff * (1 - $ydiff) * 100) / 100) * $Alpha;
        if ( $Alpha2 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi,$Alpha2,$R,$G,$B); }
 
-       $Alpha3 = (((1 - ($X - floor($X))) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
+       $Alpha3 = (((1 - $xdiff) * $ydiff * 100) / 100) * $Alpha;
        if ( $Alpha3 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi+1,$Alpha3,$R,$G,$B); }
 
-       $Alpha4 = ((($X - floor($X)) * ($Y - floor($Y)) * 100) / 100) * $Alpha;
+       $Alpha4 = (($xdiff * $ydiff * 100) / 100) * $Alpha;
        if ( $Alpha4 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi+1,$Alpha4,$R,$G,$B); }
       }
     }
diff -Naur pChart/pData.class.php pChart-tnet/pData.class.php
--- pChart/pData.class.php	2008-08-19 12:08:24.000000000 +0200
+++ pChart-tnet/pData.class.php	2009-10-20 16:38:16.000000000 +0200
@@ -52,8 +52,8 @@
 
    function pData()
     {
-     $this->Data                           = "";
-     $this->DataDescription                = "";
+     $this->Data                           = array();
+     $this->DataDescription                = array();
      $this->DataDescription["Position"]    = "Name";
      $this->DataDescription["Format"]["X"] = "number";
      $this->DataDescription["Format"]["Y"] = "number";
@@ -117,16 +117,27 @@
       }
     }
 
+	function addPointArray($Series, $Description="")
+	{
+		$nextId = count($this->Data);
+		$this->Data[$nextId] = $Series;
+		if($Description != '')
+			$this->Data[$nextId]['Name'] = $Description;
+		else
+			$this->Data[$nextId]['Name'] = $nextId;
+	}
+
    function AddPoint($Value,$Serie="Serie1",$Description="")
     {
      if (is_array($Value) && count($Value) == 1)
       $Value = $Value[0];
 
      $ID = 0;
-     for($i=0;$i<=count($this->Data);$i++)
+     $count = count($this->Data);
+     for($i=0;$i<=$count;$i++)
       { if(isset($this->Data[$i][$Serie])) { $ID = $i+1; } }
 
-     if ( count($Value) == 1 )
+     if (is_scalar($Value))
       {
        $this->Data[$ID][$Serie] = $Value;
        if ( $Description != "" )

