From: Christian Bayle <bayle@debian.org>
Date: Wed, 26 Feb 2025 00:49:18 +0100
Subject: Fix code for new php

Forwarded: not-needed
---
 src/Examples/spiderex3.php |  4 +--
 src/jpgraph.php            | 89 +++++++++++++++++++++++-----------------------
 src/jpgraph_bar.php        | 12 +++----
 src/jpgraph_canvas.php     |  6 ++--
 src/jpgraph_error.php      | 10 +++---
 src/jpgraph_gantt.php      | 33 +++++++++--------
 src/jpgraph_line.php       |  6 ++--
 src/jpgraph_log.php        | 10 +++---
 src/jpgraph_pie.php        | 10 +++---
 src/jpgraph_pie3d.php      | 15 ++++----
 src/jpgraph_scatter.php    | 10 +++---
 src/jpgraph_spider.php     | 52 +++++++++++++++++----------
 12 files changed, 138 insertions(+), 119 deletions(-)

diff --git a/src/Examples/spiderex3.php b/src/Examples/spiderex3.php
index 7d5ca6c..cbf1014 100755
--- a/src/Examples/spiderex3.php
+++ b/src/Examples/spiderex3.php
@@ -19,11 +19,11 @@
 	$graph->axis->title->SetColor("navy");
 	$graph->axis->title->SetFont(FF_ARIAL,FS_BOLD,10);
 	$graph->title->Set("Result 2000");
-	$graph->title->SetFont(FF_COURIER,FS_BOLD,11);
+	$graph->title->SetFont(FF_ARIAL,FS_BOLD,11);
 
 	// Add the plot and display the graph
 	$graph->Add($plot);
 	$graph->Stroke();
 ?>
 
-	
\ No newline at end of file
+	
diff --git a/src/jpgraph.php b/src/jpgraph.php
index 56b08f7..2abec51 100644
--- a/src/jpgraph.php
+++ b/src/jpgraph.php
@@ -206,7 +206,7 @@ DEFINE("BAND_DIAGCROSS",8); // Diagonal crosses
 // containing the text of the error. 
 //=============================================================
 class JpGraphErrObject {
-    function JpGraphErrObject() {
+    function __construct() {
 	// Empty. Reserved for future use
     }
 
@@ -326,7 +326,7 @@ class JpgTimer {
     var $idx;	
 //---------------
 // CONSTRUCTOR
-    function JpgTimer() {
+    function __construct() {
 	$this->idx=0;
     }
 
@@ -394,7 +394,7 @@ class Graph {
     //  aTimeOut	Timeout in minutes for image in cache
     // aInline		If true the image is streamed back in the call to Stroke()
     //             If false the image is just created in the cache
-    function Graph($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) {
+    function __construct($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) {
 		
 	// If timing is used create a new timing object
 	if( BRAND_TIMING ) {
@@ -1092,7 +1092,7 @@ class TTF {
     var $font_fam;
 //---------------
 // CONSTRUCTOR
-    function TTF() {
+    function __construct() {
 	// Base file names for available fonts
 	$this->font_fam=array(
 	    FF_COURIER => TTF_DIR."Courier_New",
@@ -1185,7 +1185,7 @@ class Text {
 // CONSTRUCTOR
 
     // Create new text at absolute pixel coordinates
-    function Text($aTxt="",$aXAbsPos=0,$aYAbsPos=0) {
+    function __construct($aTxt="",$aXAbsPos=0,$aYAbsPos=0) {
 	$this->t = $aTxt;
 	$this->x = $aXAbsPos;
 	$this->y = $aYAbsPos;
@@ -1328,7 +1328,7 @@ class Grid {
     var $show=false, $showMinor=false,$weight=1;
 //---------------
 // CONSTRUCTOR
-    function Grid(&$aAxis) {
+    function __construct(&$aAxis) {
 	$this->scale = &$aAxis->scale;
 	$this->img = &$aAxis->img;
     }
@@ -1438,7 +1438,7 @@ class Axis {
     var $tick_label_margin=6;
 //---------------
 // CONSTRUCTOR
-    function Axis(&$img,&$aScale,$color=array(0,0,0)) {
+    function __construct(&$img,&$aScale,$color=array(0,0,0)) {
 	$this->img = &$img;
 	$this->scale = &$aScale;
 	$this->color = $color;
@@ -1715,7 +1715,7 @@ class Ticks {
 
 //---------------
 // CONSTRUCTOR
-    function Ticks(&$aScale) {
+    function __construct(&$aScale) {
 	$this->scale=&$aScale;
     }
 
@@ -1817,7 +1817,7 @@ class LinearTicks extends Ticks {
     var $text_label_start=0;
 //---------------
 // CONSTRUCTOR
-    function LinearTicks() {
+    function __construct() {
 	// Empty
     }
 
@@ -1900,7 +1900,7 @@ class LinearTicks extends Ticks {
 		elseif( $this->label_formatstr != "" ) 
 		    $l = sprintf($this->label_formatstr,$label);
 		else
-		    $l = sprintf("%01.".$precision."f",round($label,$precision));
+		    $l = sprintf("%01.".abs($precision)."f",round($label,$precision));
 					
 		if( ($this->supress_zerolabel && ($l + 0)==0) ||
 		    ($this->supress_first && $i==0) ||
@@ -1959,7 +1959,7 @@ class LinearTicks extends Ticks {
 		elseif( $this->label_formatstr != "" ) 
 		    $l = sprintf($this->label_formatstr,$label);
 		else
-		    $l = sprintf("%01.".$precision."f",round($label,$precision));
+		    $l = sprintf("%01.".abs($precision)."f",round($label,$precision));
 						
 		if( ($this->supress_zerolabel && ($l + 0)==0) ||
 		    ($this->supress_first && $i==0) ||
@@ -2033,7 +2033,7 @@ class LinearScale {
     var $intscale=false; // Restrict autoscale to integers
 //---------------
 // CONSTRUCTOR
-    function LinearScale($aMin=0,$aMax=0,$aType="y") {
+    function __construct($aMin=0,$aMax=0,$aType="y") {
 	assert($aType=="x" || $aType=="y" );
 	assert($aMin<=$aMax);
 		
@@ -2101,13 +2101,13 @@ class LinearScale {
 	
     // Translate between world and screen
     function Translate($aCoord) {
-	return $this->off+round(($aCoord*1.0 - $this->GetMinVal()) * $this->scale_factor,0); 
+	return $this->off+round((floatval($aCoord)*1.0 - $this->GetMinVal()) * $this->scale_factor,0); 
     }
 	
     // Relative translate (don't include offset) usefull when we just want
     // to know the relative position (in pixels) on the axis
     function RelTranslate($aCoord) {
-	return round(($aCoord*1.0 - $this->GetMinVal()) * $this->scale_factor,0); 
+	return round((floatval($aCoord)*1.0 - $this->GetMinVal()) * $this->scale_factor,0); 
     }
 	
     // Restrict autoscaling to only use integers
@@ -2414,7 +2414,7 @@ class LinearScale {
 class RGB {
     var $rgb_table;
     var $img;
-    function RGB(&$aImg) {
+    function __construct(&$aImg) {
 	$this->img = $aImg;
 		
 	// Conversion array between color names and RGB
@@ -2945,7 +2945,7 @@ class Image {
     var $colorstack=array(),$colorstackidx=0;
     //---------------
     // CONSTRUCTOR
-    function Image($aWidth,$aHeight,$aFormat=DEFAULT_GFORMAT) {
+    function __construct($aWidth,$aHeight,$aFormat=DEFAULT_GFORMAT) {
 	$this->CreateImgCanvas($aWidth,$aHeight);
 	if( !$this->SetImgFormat($aFormat) ) {
 	    (new JpGraphError())->Raise("JpGraph: Selected graphic format is either not supported or unknown [$aFormat]");
@@ -3845,8 +3845,8 @@ class RotImage extends Image {
     var $a=0;
     var $dx=0,$dy=0,$transx=0,$transy=0; 
 	
-    function RotImage($aWidth,$aHeight,$a=0,$aFormat=DEFAULT_GFORMAT) {
-	$this->Image($aWidth,$aHeight,$aFormat);
+    function __construct($aWidth,$aHeight,$a=0,$aFormat=DEFAULT_GFORMAT) {
+	parent::__construct($aWidth,$aHeight,$aFormat);
 	$this->dx=$this->left_margin+$this->plotwidth/2;
 	$this->dy=$this->top_margin+$this->plotheight/2;
 	$this->SetAngle($a);	
@@ -3974,7 +3974,7 @@ class ImgStreamCache {
     var $timeout=0; 	// Infinite timeout
     //---------------
     // CONSTRUCTOR
-    function ImgStreamCache(&$aImg, $aCacheDir=CACHE_DIR) {
+    function __construct(&$aImg, $aCacheDir=CACHE_DIR) {
 	$this->img = &$aImg;
 	$this->cache_dir = $aCacheDir;
     }
@@ -4022,7 +4022,8 @@ class ImgStreamCache {
 	    return;
 	}
 
-	if( $acachefilename != "" && USE_CACHE ) {
+	//if( $aCachefilename != "" && USE_CACHE ) {
+	if( !empty($aCachefilename) && USE_CACHE ) {
 
 	    $aCacheFileName = $this->cache_dir . $aCacheFileName;
 	    if( file_exists($aCacheFileName) ) {
@@ -4142,7 +4143,7 @@ class Legend {
     var $weight=1;
 //---------------
 // CONSTRUCTOR
-    function Legend() {
+    function __construct() {
 	// Empty
     }
 //---------------
@@ -4285,7 +4286,7 @@ class Plot {
     var $weight=1;	
 //---------------
 // CONSTRUCTOR
-    function Plot(&$aDatay,$aDatax=false) {
+    function __construct(&$aDatay,$aDatax=false) {
 	$this->numpoints = count($aDatay);
 	if( $this->numpoints==0 )
 	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Empty data array specified for plot. Must have at least one data point.");
@@ -4425,7 +4426,7 @@ class PlotMark {
     var $color="black", $width=5, $fill_color="blue";
 //	--------------
 // CONSTRUCTOR
-    function PlotMark() {
+    function __construct() {
 	$this->title = new Text();
 	$this->title->Hide();
     }
@@ -4552,7 +4553,7 @@ class PlotMark {
 class Rectangle {
     var $x,$y,$w,$h;
     var $xe, $ye;
-    function Rectangle($aX,$aY,$aWidth,$aHeight) {
+    function __construct($aX,$aY,$aWidth,$aHeight) {
 	$this->x=$aX;
 	$this->y=$aY;
 	$this->w=$aWidth;
@@ -4577,7 +4578,7 @@ class RectPattern {
     var $linespacing;	// Line spacing in pixels
     var $iBackgroundColor=-1;  // Default is no background fill
 	
-    function RectPattern($aColor,$aWeight=1) {
+    function __construct($aColor,$aWeight=1) {
 	$this->color = $aColor;
 	$this->weight = $aWeight;		
     }
@@ -4632,8 +4633,8 @@ class RectPattern {
 //=====================================================================
 class RectPatternSolid extends RectPattern {
 
-    function RectPatternSolid($aColor="black",$aWeight=1) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1) {
+	parent::__construct($aColor,$aWeight);
     }
 
     function Stroke(&$aImg) {
@@ -4649,8 +4650,8 @@ class RectPatternSolid extends RectPattern {
 //=====================================================================
 class RectPatternHor extends RectPattern {
 		
-    function RectPatternHor($aColor="black",$aWeight=1,$aLineSpacing=7) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1,$aLineSpacing=7) {
+	parent::__construct($aColor,$aWeight);
 	$this->linespacing = $aLineSpacing;
     }
 		
@@ -4672,8 +4673,8 @@ class RectPatternHor extends RectPattern {
 class RectPatternVert extends RectPattern {
     var $linespacing=10;	// Line spacing in pixels
 		
-    function RectPatternVert($aColor="black",$aWeight=1,$aLineSpacing=7) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1,$aLineSpacing=7) {
+	parent::__construct($aColor,$aWeight);
 	$this->linespacing = $aLineSpacing;
     }
 
@@ -4699,8 +4700,8 @@ class RectPatternVert extends RectPattern {
 class RectPatternRDiag extends RectPattern {
     var $linespacing;	// Line spacing in pixels
 		
-    function RectPatternRDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1,$aLineSpacing=12) {
+	parent::__construct($aColor,$aWeight);
 	$this->linespacing = $aLineSpacing;
     }
 
@@ -4750,9 +4751,9 @@ class RectPatternRDiag extends RectPattern {
 class RectPatternLDiag extends RectPattern {
     var $linespacing;	// Line spacing in pixels
 		
-    function RectPatternLDiag($aColor="black",$aWeight=1,$aLineSpacing=12) {
+    function __construct($aColor="black",$aWeight=1,$aLineSpacing=12) {
 	$this->linespacing = $aLineSpacing;
-	parent::RectPattern($aColor,$aWeight);
+	parent::__construct($aColor,$aWeight);
     }
 
     function DoPattern(&$aImg) {
@@ -4802,8 +4803,8 @@ class RectPattern3DPlane extends RectPattern {
     // top of the band. Specifies how fast the lines
     // converge.
 
-    function RectPattern3DPlane($aColor="black",$aWeight=1) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1) {
+	parent::__construct($aColor,$aWeight);
 	$this->SetDensity(10);  // Slightly larger default
     }
 
@@ -4916,8 +4917,8 @@ class RectPattern3DPlane extends RectPattern {
 class RectPatternCross extends RectPattern {
     var $vert=null;
     var $hor=null;
-    function RectPatternCross($aColor="black",$aWeight=1) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1) {
+	parent::__construct($aColor,$aWeight);
 	$this->vert = new RectPatternVert($aColor,$aWeight);
 	$this->hor  = new RectPatternHor($aColor,$aWeight);
     }
@@ -4952,8 +4953,8 @@ class RectPatternCross extends RectPattern {
 class RectPatternDiagCross extends RectPattern {
     var $left=null;
     var $right=null;
-    function RectPatternDiagCross($aColor="black",$aWeight=1) {
-	parent::RectPattern($aColor,$aWeight);
+    function __construct($aColor="black",$aWeight=1) {
+	parent::__construct($aColor,$aWeight);
 	$this->right = new RectPatternRDiag($aColor,$aWeight);
 	$this->left  = new RectPatternLDiag($aColor,$aWeight);
     }
@@ -4986,7 +4987,7 @@ class RectPatternDiagCross extends RectPattern {
 // Factory class for rectangular pattern 
 //=====================================================================
 class RectPatternFactory {
-    function RectPatternFactory() {
+    function __construct() {
 	// Empty
     }
     function Create($aPattern,$aColor,$aWeight=1) {
@@ -5033,7 +5034,7 @@ class PlotBand {
     var $prect=null;
     var $depth;
 
-    function PlotBand($aDir,$aPattern,$aMin,$aMax,$aColor="black",$aWeight=1,$aDepth=DEPTH_BACK) {
+    function __construct($aDir,$aPattern,$aMin,$aMax,$aColor="black",$aWeight=1,$aDepth=DEPTH_BACK) {
 	$f =  new RectPatternFactory();
 	$this->prect = $f->Create($aPattern,$aColor,$aWeight);
 	$this->dir = $aDir;
@@ -5114,7 +5115,7 @@ class PlotLine {
 
 //---------------
 // CONSTRUCTOR
-    function PlotLine($aDir=HORIZONTAL,$aPos=0,$aColor="black",$aWeight=1) {
+    function __construct($aDir=HORIZONTAL,$aPos=0,$aColor="black",$aWeight=1) {
 	$this->direction = $aDir;
 	$this->color=$aColor;
 	$this->weight=$aWeight;
diff --git a/src/jpgraph_bar.php b/src/jpgraph_bar.php
index 776f657..46361d5 100644
--- a/src/jpgraph_bar.php
+++ b/src/jpgraph_bar.php
@@ -22,7 +22,7 @@ class Gradient {
     var $img=null;
 //---------------
 // CONSTRUCTOR
-    function Gradient(&$img) {
+    function __construct(&$img) {
 	$this->img = $img;
     }
 
@@ -213,8 +213,8 @@ class BarPlot extends Plot {
 	
 //---------------
 // CONSTRUCTOR
-    function BarPlot(&$datay,$datax=false) {
-	$this->Plot($datay,$datax);		
+    function __construct(&$datay,$datax=false) {
+	parent::__construct($datay,$datax);		
 	++$this->numpoints;
     }
 
@@ -502,7 +502,7 @@ class GroupBarPlot extends BarPlot {
     var $numpoints;
 //---------------
 // CONSTRUCTOR
-    function GroupBarPlot($plots) {
+    function __construct($plots) {
 	$this->plots = $plots;
 	$this->nbrplots = count($plots);
 	$this->numpoints = $plots[0]->numpoints;
@@ -568,7 +568,7 @@ class AccBarPlot extends BarPlot {
     var $plots=null,$nbrplots=0,$numpoints=0;
 //---------------
 // CONSTRUCTOR
-    function AccBarPlot($plots) {
+    function __construct($plots) {
 	$this->plots = $plots;
 	$this->nbrplots = count($plots);
 	$this->numpoints = $plots[0]->numpoints;		
@@ -709,7 +709,7 @@ class AccBarPlot extends BarPlot {
 		    }
 		    $this->csimareas.= " href=\"".$this->plots[$j]->csimtargets[$i]."\"";
 		    if( !empty($this->plots[$j]->csimalts[$i]) ) {
-			$sval=sprintf($this->plots[$j]->csimalts[$i],$this->plots[$j]->coords[0][$i]);										
+			$sval=sprintf($this->plots[$j]->csimalts[$i][0],$this->plots[$j]->coords[0][$i]);										
 			$this->csimareas .= " alt=\"$sval\" title=\"$sval\" ";
 		    }
 		    $this->csimareas .= ">\r\n";				
diff --git a/src/jpgraph_canvas.php b/src/jpgraph_canvas.php
index 660dee5..65c731d 100644
--- a/src/jpgraph_canvas.php
+++ b/src/jpgraph_canvas.php
@@ -22,8 +22,8 @@
 class CanvasGraph extends Graph {
 //---------------
 // CONSTRUCTOR
-    function CanvasGraph($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
-	$this->Graph($aWidth,$aHeight,$aCachedName,$timeout,$inline);
+    function __construct($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
+	parent::__construct($aWidth,$aHeight,$aCachedName,$timeout,$inline);
     }
 
 //---------------
@@ -41,4 +41,4 @@ class CanvasGraph extends Graph {
     }
 } // Class
 /* EOF */
-?>
\ No newline at end of file
+?>
diff --git a/src/jpgraph_error.php b/src/jpgraph_error.php
index 6c7e645..245cfd8 100644
--- a/src/jpgraph_error.php
+++ b/src/jpgraph_error.php
@@ -21,8 +21,8 @@ class ErrorPlot extends Plot {
     var $center=false;
 //---------------
 // CONSTRUCTOR
-    function ErrorPlot(&$datay,$datax=false) {
-	$this->Plot($datay,$datax);
+    function __construct(&$datay,$datax=false) {
+	parent::__construct($datay,$datax);
 	$this->numpoints /= 2;
     }
 //---------------
@@ -71,8 +71,8 @@ class ErrorLinePlot extends ErrorPlot {
     var $line=null;
 //---------------
 // CONSTRUCTOR
-    function ErrorLinePlot(&$datay,$datax=false) {
-	$this->ErrorPlot($datay);
+    function __construct(&$datay,$datax=false) {
+	parent::__construct($datay);
 	// Calculate line coordinates as the average of the error limits
 	for($i=0; $i<count($datay); $i+=2 ) {
 	    $ly[]=($datay[$i]+$datay[$i+1])/2;
@@ -95,4 +95,4 @@ class ErrorLinePlot extends ErrorPlot {
 } // Class
 
 /* EOF */
-?>
\ No newline at end of file
+?>
diff --git a/src/jpgraph_gantt.php b/src/jpgraph_gantt.php
index f251e12..9b9fe73 100644
--- a/src/jpgraph_gantt.php
+++ b/src/jpgraph_gantt.php
@@ -74,7 +74,7 @@ class DateLocale {
 	
 //---------------
 // CONSTRUCTOR	
-    function DateLocale() {
+    function __construct() {
 	// Empty
     }
 
@@ -125,8 +125,8 @@ class GanttGraph extends Graph {
 //---------------
 // CONSTRUCTOR	
     // Create a new gantt graph
-    function GanttGraph($aWidth=-1,$aHeight=-1,$aCachedName="",$aTimeOut=0,$aInline=true) {
-	Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);		
+    function __construct($aWidth=-1,$aHeight=-1,$aCachedName="",$aTimeOut=0,$aInline=true) {
+	parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);		
 	$this->scale = new GanttScale($this->img);
 	$this->img->SetMargin($aWidth/17,$aWidth/17,$aHeight/7,$aHeight/10);
 		
@@ -158,7 +158,7 @@ class GanttGraph extends Graph {
     }
 
     // Override inherit method from Graph and give a warning message
-    function SetScale() {
+    function SetScale($aAxisType,$aYMin=1,$aYMax=1,$aXMin=1,$aXMax=1) {
 	(new JpGraphError())->Raise("<b>JpGraph Error:</b> SetScale() is not meaningfull with Gantt charts.");
 	// Empty
     }
@@ -344,7 +344,7 @@ class TextProperty {
 	
 //---------------
 // CONSTRUCTOR	
-    function TextProperty($aTxt="") {
+    function __construct($aTxt="") {
 	$this->iText = $aTxt;
     }		
 	
@@ -452,7 +452,7 @@ class HeaderProperty {
 
 //---------------
 // CONSTRUCTOR	
-    function HeaderProperty() {
+    function __construct() {
 	$this->grid = new LineProperty();
     }
 
@@ -546,7 +546,7 @@ class GanttScale {
 	
 //---------------
 // CONSTRUCTOR	
-    function GanttScale(&$aImg) {
+    function __construct(&$aImg) {
 	$this->iImg = &$aImg;		
 	$this->iDateLocale = new DateLocale();
 	$this->day = new HeaderProperty();
@@ -1139,7 +1139,7 @@ class GanttPlotObject {
     var $title,$caption;
     var $iCaptionMargin=5;
 		
-    function GanttPlotObject() {
+    function __construct() {
 	$this->title = new TextProperty();
 	$this->title->Align("left","center");
 	$this->caption = new TextProperty();
@@ -1215,8 +1215,8 @@ class GanttBar extends GanttPlotObject {
 	
 //---------------
 // CONSTRUCTOR	
-    function GanttBar($aPos,$aLabel,$aStart,$aEnd,$aCaption="",$aHeightFactor=0.6) {
-	parent::GanttPlotObject();	
+    function __construct($aPos,$aLabel,$aStart,$aEnd,$aCaption="",$aHeightFactor=0.6) {
+	parent::__construct();	
 	$this->iStart = $aStart;	
 	// Is the end date given as a date or as number of days added to start date?
 	if( is_string($aEnd) )
@@ -1308,7 +1308,10 @@ class GanttBar extends GanttPlotObject {
 	    $prect->Stroke($aImg);
 	}
 	else {	
-	    $prect->SetPos(new Rectangle($xt,$yt,$xb-$xt+1,$yb-$yt+1));				
+	    //$prect->SetPos(new Rectangle($xt,$yt,$xb-$xt+1,$yb-$yt+1));				
+	    //$rect=new Rectangle($xt,$yt,$w,$h);
+	    $rect=new Rectangle($xt,$yt,$xb-$xt+1,$yb-$yt+1);
+	    $prect->SetPos($rect);				
 	    $prect->Stroke($aImg);
 	    $aImg->SetColor($this->iFrameColor);
 	    $aImg->Rectangle($xt,$yt,$xb,$yb);
@@ -1350,8 +1353,8 @@ class MileStone extends GanttPlotObject {
 	
 //---------------
 // CONSTRUCTOR	
-    function MileStone($aVPos,$aLabel,$aDate,$aCaption="") {
-	GanttPlotObject::GanttPlotObject();
+    function __construct($aVPos,$aLabel,$aDate,$aCaption="") {
+	parent::__construct();
 	$this->caption->Set($aCaption);
 	$this->caption->Align("left","center");
 	$this->caption->SetFont(FF_FONT1,FS_BOLD);
@@ -1398,8 +1401,8 @@ class GanttVLine extends GanttPlotObject {
 	
 //---------------
 // CONSTRUCTOR	
-    function GanttVLine($aDate,$aTitle="",$aColor="black",$aWeight=3,$aStyle="dashed") {
-	GanttPlotObject::GanttPlotObject();
+    function __construct($aDate,$aTitle="",$aColor="black",$aWeight=3,$aStyle="dashed") {
+	parent::__construct();
 	$this->iLine = new LineProperty();
 	$this->iLine->SetColor($aColor);
 	$this->iLine->SetWeight($aWeight);
diff --git a/src/jpgraph_line.php b/src/jpgraph_line.php
index 9a21dcd..e50be27 100644
--- a/src/jpgraph_line.php
+++ b/src/jpgraph_line.php
@@ -59,8 +59,8 @@ class LinePlot extends Plot{
 
 //---------------
 // CONSTRUCTOR
-    function LinePlot(&$datay,$datax=false) {
-	$this->Plot($datay,$datax);
+    function __construct(&$datay,$datax=false) {
+	parent::__construct($datay,$datax);
 	$this->mark = new PlotMark();
 	$this->mark->SetColor($this->color);
 	$this->value = new DisplayValue();
@@ -215,7 +215,7 @@ class AccLinePlot extends Plot {
     var $plots=null,$nbrplots=0,$numpoints=0;
 //---------------
 // CONSTRUCTOR
-    function AccLinePlot($plots) {
+    function __construct($plots) {
 	$this->plots = $plots;
 	$this->nbrplots = count($plots);
 	$this->numpoints = $plots[0]->numpoints;		
diff --git a/src/jpgraph_log.php b/src/jpgraph_log.php
index 128fb75..118cbe0 100644
--- a/src/jpgraph_log.php
+++ b/src/jpgraph_log.php
@@ -20,8 +20,8 @@ class LogScale extends LinearScale {
 // CONSTRUCTOR
 
     // Log scale is specified using the log of min and max
-    function LogScale($min,$max,$type="y") {
-	$this->LinearScale($min,$max,$type);
+    function __construct($min,$max,$type="y") {
+	parent::__construct($min,$max,$type);
 	$this->ticks = new LogTicks();
     }
 
@@ -56,7 +56,7 @@ class LogScale extends LinearScale {
     // Note that for log autoscale the "maxstep" the fourth argument
     // isn't used. This is just included to give the method the same
     // signature as the linear counterpart.
-    function AutoScale(&$img,$min,$max,$dummy) {
+    function AutoScale(&$img,$min,$max,$maxstep=0,$majend = true) {
 	if( $min==0 ) $min=1;
 	assert($max>0);		
 	$smin = floor(log10($min));
@@ -74,7 +74,7 @@ class LogScale extends LinearScale {
 class LogTicks extends Ticks{
 //---------------
 // CONSTRUCTOR
-    function LogTicks() {
+    function __construct() {
     }
 //---------------
 // PUBLIC METHODS	
@@ -171,4 +171,4 @@ class LogTicks extends Ticks{
     }
 } // Class
 /* EOF */
-?>
\ No newline at end of file
+?>
diff --git a/src/jpgraph_pie.php b/src/jpgraph_pie.php
index 5e3cc5f..88ef708 100644
--- a/src/jpgraph_pie.php
+++ b/src/jpgraph_pie.php
@@ -19,7 +19,7 @@ class PiePlot {
     var $posx=0.5,$posy=0.5;
     var $radius=0.3;
     var $explode_radius=array(),$explode_all=false,$explode_r=20;
-    var $labels, $legends=null;
+    var $labels, $legends=array();
     var $csimtargets=null;  // Array of targets for CSIM
     var $csimareas='';		// Generated CSIM text	
     var $csimalts=null;		// ALT tags for corresponding target
@@ -43,7 +43,7 @@ class PiePlot {
 	
 //---------------
 // CONSTRUCTOR
-    function PiePlot(&$data) {
+    function __construct(&$data) {
 	$this->data = $data;
 	$this->title = new Text("");
 	$this->title->SetFont(FF_FONT1,FS_BOLD);
@@ -91,7 +91,7 @@ class PiePlot {
 	if( !empty($this->csimtargets[$i]) )
 	    $this->csimareas .= "<area shape=\"poly\" coords=\"$coords\" href=\"".$this->csimtargets[$i]."\"";
 	if( !empty($this->csimalts[$i]) ) {										
-	    $tmp=sprintf($this->csimalts[$i],$this->data[$i]);
+	    $tmp=sprintf($this->csimalts[$i][0],$this->data[$i]);
 	    $this->csimareas .= " alt=\"$tmp\"";
 	}
 	$this->csimareas .= ">\r\n";
@@ -365,8 +365,8 @@ class PieGraph extends Graph {
     var $plots=array();
 //---------------
 // CONSTRUCTOR
-    function PieGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
-	$this->Graph($width,$height,$cachedName,$timeout,$inline);
+    function __construct($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
+	parent::__construct($width,$height,$cachedName,$timeout,$inline);
 	$this->posx=$width/2;
 	$this->posy=$height/2;
 	$this->SetColor(array(255,255,255));		
diff --git a/src/jpgraph_pie3d.php b/src/jpgraph_pie3d.php
index e74d077..6b51fbf 100644
--- a/src/jpgraph_pie3d.php
+++ b/src/jpgraph_pie3d.php
@@ -22,7 +22,7 @@ class PiePlot3D extends PiePlot {
 	
 //---------------
 // CONSTRUCTOR
-    function PiePlot3d(&$data) {
+    function __construct(&$data) {
 	$this->data = $data;
 	$this->title = new Text("");
 	$this->title->SetFont(FF_FONT1,FS_BOLD);
@@ -40,7 +40,8 @@ class PiePlot3D extends PiePlot {
 	    $this->angle = $a;
     }
 
-    function AddSliceToCSIM($i,$xc,$yc,$height,$width,$thick,$sa,$ea) {  //Slice number, ellipse centre (x,y), height, width, start angle, end angle
+     function AddSliceToCSIM3D($i,$xc,$yc,$height,$width,$thick,$sa,$ea) { 
+	//Slice number, ellipse centre (x,y), height, width, start angle, end angle
 		
 	//add coordinates of the centre to the map
 	$coords = "$xc, $yc";
@@ -79,7 +80,7 @@ class PiePlot3D extends PiePlot {
 	}
 	$coords.= ", $xp, $yp";
 	if( !empty($this->csimalts[$i]) ) {										
-	    $tmp=sprintf($this->csimalts[$i],$this->data[$i]);
+	    $tmp=sprintf($this->csimalts[$i][0],$this->data[$i]);
 	    $alt="alt=\"$tmp\"";
 	}
 	if( !empty($this->csimtargets[$i]) )
@@ -171,7 +172,7 @@ class PiePlot3D extends PiePlot {
 	    $a += 2*M_PI*$d/$sum;
 
 	    if ($this->csimtargets[$i]) {
-		$this->AddSliceToCSIM($i,$xc,$yc,$height,$width,$thick,$old_a,$a);
+		$this->AddSliceToCSIM3D($i,$xc,$yc,$height,$width,$thick,$old_a,$a);
 	    }
 
 	    $xp = $width*cos($a)/2+$xc;
@@ -201,14 +202,14 @@ class PiePlot3D extends PiePlot {
 		$yp = $height*sin($la)/2*$margin;
 									
 		if( ($la >= 0 && $la <= M_PI) || $la>2*M_PI*0.98 ) {
-		    $this->StrokeLabels($this->labels[$i],$img,$la,$xc+$xp,$yc-$yp);	
+		    $this->StrokeLabels3D($this->labels[$i],$img,$la,$xc+$xp,$yc-$yp);	
 		    if( $this->showlabelhint ) {
 			$img->SetColor($this->labelhintcolor);
 			$img->Line($xc+$xp/$margin,$yc-$yp/$margin,$xc+$xp,$yc-$yp);
 		    }
 		}
 		else {
-		    $this->StrokeLabels($this->labels[$i],$img,$la,$xc+$xp,$yc-$yp+$width*$thick);	
+		    $this->StrokeLabels3D($this->labels[$i],$img,$la,$xc+$xp,$yc-$yp+$width*$thick);	
 		    if( $this->showlabelhint ) {
 			$img->SetColor($this->labelhintcolor);
 			$img->Line($xc+$xp/$margin,$yc-$yp/$margin+$width*$thick,$xc+$xp,$yc-$yp+$width*$thick);
@@ -272,7 +273,7 @@ class PiePlot3D extends PiePlot {
 // PRIVATE METHODS	
 
     // Position the labels of each slice
-    function StrokeLabels($label,$img,$a,$xp,$yp) {
+    function StrokeLabels3D($label,$img,$a,$xp,$yp) {
 		
 	$img->SetFont($this->font_family,$this->font_style,$this->font_size);
 	$img->SetColor($this->font_color);
diff --git a/src/jpgraph_scatter.php b/src/jpgraph_scatter.php
index 4a93413..ae7fe5a 100644
--- a/src/jpgraph_scatter.php
+++ b/src/jpgraph_scatter.php
@@ -20,10 +20,10 @@ class ScatterPlot extends Plot {
     var $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
 //---------------
 // CONSTRUCTOR
-    function ScatterPlot(&$datay,$datax=false) {
-	if( (count($datax) != count($datay)) && is_array($datax))
-	    (new JpGraphError())->Raise("JpGraph: Scatterplot must have equal number of X and Y points.");
-	$this->Plot($datay,$datax);
+    function __construct(&$datay,$datax=false) {
+	//if( (count($datax) != count($datay)) && is_array($datax))
+	//    (new JpGraphError())->Raise("JpGraph: Scatterplot must have equal number of X and Y points.");
+	parent::__construct($datay,$datax);
 	$this->mark = new PlotMark();
 	$this->mark->SetType(MARK_CIRCLE);
 	$this->mark->SetColor($this->color);
@@ -79,4 +79,4 @@ class ScatterPlot extends Plot {
 	
 } // Class
 /* EOF */
-?>
\ No newline at end of file
+?>
diff --git a/src/jpgraph_spider.php b/src/jpgraph_spider.php
index 72ab8d3..dbe89a8 100644
--- a/src/jpgraph_spider.php
+++ b/src/jpgraph_spider.php
@@ -34,7 +34,7 @@ class FontProp {
 class SpiderLogTicks extends Ticks {
 //---------------
 // CONSTRUCTOR
-    function SpiderLogTicks() {
+    function __construct() {
     }
 //---------------
 // PUBLIC METHODS	
@@ -103,15 +103,18 @@ class SpiderLogTicks extends Ticks {
 class SpiderLinearTicks extends LinearTicks {
 //---------------
 // CONSTRUCTOR
-    function SpiderLinearTicks() {
+    function __construct() {
 	// Empty
     }
 
 //---------------
 // PUBLIC METHODS	
-
+    
+    function Stroke(&$img,&$scale,$pos){
+    	$this->StrokeSLT(); 
+    } 
     // TODO: Add argument grid
-    function Stroke(&$aImg,&$grid,$aPos,$aAxisAngle,&$aScale,&$aMajPos,&$aMajLabel) {
+    function StrokeSLT(&$aImg,&$grid,$aPos,$aAxisAngle,&$aScale,&$aMajPos,&$aMajLabel) {
 	// Prepare to draw linear ticks
 	$maj_step_abs = abs($aScale->scale_factor*$this->major_step);	
 	$min_step_abs = abs($aScale->scale_factor*$this->minor_step);	
@@ -171,8 +174,8 @@ class SpiderAxis extends Axis {
     var $title=null;
 //---------------
 // CONSTRUCTOR
-    function SpiderAxis(&$img,&$aScale,$color=array(0,0,0)) {
-	parent::Axis($img,$aScale,$color);
+    function __construct(&$img,&$aScale,$color=array(0,0,0)) {
+	parent::__construct($img,$aScale,$color);
 	$this->len=$img->plotheight;
 	$this->font_size = FF_FONT1;
 	$this->title = new FontProp();
@@ -190,7 +193,10 @@ class SpiderAxis extends Axis {
     // $aAxisAngle = Axis angle
     // $grid			= Returns an array with positions used to draw the grid
     //	$lf			= Label flag, TRUE if the axis should have labels
-    function Stroke($pos,$aAxisAngle,&$grid,$title,$lf) {
+    function Stroke($aOtherAxisScale) {
+	    $this->StrokeSA();
+    }
+    function StrokeSA($pos,$aAxisAngle,&$grid,$title,$lf) {
 	$this->img->SetColor($this->color);
 		
 	// Determine end points for the axis
@@ -203,7 +209,7 @@ class SpiderAxis extends Axis {
 	if( !$this->hide )
 	    $this->img->Line($this->scale->scale_abs[0],$pos,$x,$y);
 	
-	$this->scale->ticks->Stroke($this->img,$grid,$pos,$aAxisAngle,$this->scale,$majpos,$majlabel);
+	$this->scale->ticks->StrokeSLT($this->img,$grid,$pos,$aAxisAngle,$this->scale,$majpos,$majlabel);
 		
 	// Draw labels
 	if( $lf && !$this->hide ) {
@@ -267,12 +273,16 @@ class SpiderAxis extends Axis {
 class SpiderGrid extends Grid {
 //------------
 // CONSTRUCTOR
-    function SpiderGrid() {
+    function __construct() {
+	    
     }
 
 //----------------
 // PRIVATE METHODS	
-    function Stroke(&$img,&$grid) {
+    function Stroke() {
+	    $this->StrokeSG();
+    }
+    function StrokeSG(&$img,&$grid) {
 	if( !$this->show ) return;
 	$nbrticks = count($grid[0])/2;
 	$nbrpnts = count($grid);
@@ -312,7 +322,7 @@ class SpiderPlot {
     var $weight=1;
 //---------------
 // CONSTRUCTOR
-    function SpiderPlot($data) {
+    function __construct($data) {
 	$this->data = $data;
     }
 
@@ -405,8 +415,8 @@ class SpiderGraph extends Graph {
     var $grid,$axis=null;
 //---------------
 // CONSTRUCTOR
-    function SpiderGraph($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
-	$this->Graph($width,$height,$cachedName,$timeout,$inline);
+    function __construct($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
+	parent::__construct($width,$height,$cachedName,$timeout,$inline);
 	$this->posx=$width/2;
 	$this->posy=$height/2;
 	$this->len=min($width,$height)*0.35;
@@ -420,8 +430,12 @@ class SpiderGraph extends Graph {
     function SupressTickMarks($f=true) {
 	$this->axis->scale->ticks->SupressTickMarks($f);
     }
+
+    function SetScale($aAxisType,$aYMin=1,$aYMax=1,$aXMin=1,$aXMax=1) {
+	    $this->SetScaleSG($aAxisType,$aYMin=1,$aYMax=1);
+    }	    
 	
-    function SetScale($axtype,$ymin=1,$ymax=1) {
+    function SetScaleSG($axtype,$ymin=1,$ymax=1) {
 	if( $axtype != "lin" && $axtype != "log" ) {
 	    (new JpGraphError())->Raise("Illegal scale for spiderplot ($axtype). Must be \"lin\" or \"log\"");
 	}
@@ -446,7 +460,7 @@ class SpiderGraph extends Graph {
 	$this->len=min($this->img->width,$this->img->height)*$s/2;
     }
 
-    function SetTickDensity($densy=TICKD_NORMAL) {
+    function SetTickDensitySG($densy=TICKD_NORMAL) {
 	$this->ytick_factor=25;		
 	switch( $densy ) {
 	    case TICKD_DENSE:
@@ -484,7 +498,7 @@ class SpiderGraph extends Graph {
 	$this->plots[]=$splot;
     }
 	
-    function GetPlotsYMinMax() {
+    function GetPlotsYMinMaxSG() {
 	$min=$this->plots[0]->Min();
 	$max=$this->plots[0]->Max();
 	foreach( $this->plots as $p ) {
@@ -501,7 +515,7 @@ class SpiderGraph extends Graph {
 	// Set Y-scale
 	if( !$this->yscale->IsSpecified() && 
 	count($this->plots)>0 ) {
-	    list($min,$max) = $this->GetPlotsYMinMax();
+	    list($min,$max) = $this->GetPlotsYMinMaxSG();
 	    $this->yscale->AutoScale($this->img,0,$max,$this->len/$this->ytick_factor);
 	}
 	// Set start position end length of scale (in absolute pixels)
@@ -536,9 +550,9 @@ class SpiderGraph extends Graph {
 		
 	// Draw axis and grid
 	for( $i=0,$a=M_PI/2; $i<$nbrpnts; ++$i, $a+=$astep ) {
-	    $this->axis->Stroke($this->posy,$a,$grid[$i],$this->axis_title[$i],$i==0);
+	    $this->axis->StrokeSA($this->posy,$a,$grid[$i],$this->axis_title[$i],$i==0);
 	}	
-	$this->grid->Stroke($this->img,$grid);
+	$this->grid->StrokeSG($this->img,$grid);
 	$this->title->Center($this->img->left_margin,$this->img->width-$this->img->right_margin,5);
 	$this->title->Stroke($this->img);
 		
