Upgrade jpgrah to 4.3.4

This commit is contained in:
Nigel Sheldon 2021-01-03 17:10:26 +01:00
commit b5868f05f6
72 changed files with 19157 additions and 10327 deletions

View file

@ -1,13 +1,13 @@
<?php
/*=======================================================================
// File: JPGRAPH_SCATTER.PHP
// Description: Scatter (and impuls) plot extension for JpGraph
// Created: 2001-02-11
// Ver: $Id: jpgraph_scatter.php 957 2007-12-01 14:00:29Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
// File: JPGRAPH_SCATTER.PHP
// Description: Scatter (and impuls) plot extension for JpGraph
// Created: 2001-02-11
// Ver: $Id: jpgraph_scatter.php 1397 2009-06-27 21:34:14Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
require_once('jpgraph_plotmark.inc.php');
//===================================================
@ -20,9 +20,11 @@ class FieldArrow
public $iSize=10; // Length in pixels for arrow
public $iArrowSize = 2;
private $isizespec = array(
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10));
public function FieldArrow()
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10)
);
public function __construct()
{
// Empty
}
public function SetSize($aSize, $aArrowSize=2)
@ -70,8 +72,8 @@ class FieldPlot extends Plot
public $arrow = '';
private $iAngles = array();
private $iCallback = '';
public function FieldPlot($datay, $datax, $angles)
public function __construct($datay, $datax, $angles)
{
if ((count($datax) != count($datay))) {
JpGraphError::RaiseL(20001);
@ -79,10 +81,10 @@ class FieldPlot extends Plot
if ((count($datax) != count($angles))) {
JpGraphError::RaiseL(20002);
}//("Fieldplots must have an angle specified for each X and Y points.");
$this->iAngles = $angles;
$this->Plot($datay, $datax);
parent::__construct($datay, $datax);
$this->value->SetAlign('center', 'center');
$this->value->SetMargin(15);
@ -97,7 +99,7 @@ class FieldPlot extends Plot
public function Stroke($img, $xscale, $yscale)
{
// Remeber base color and size
// Remeber base color and size
$bc = $this->arrow->iColor;
$bs = $this->arrow->iSize;
$bas = $this->arrow->iArrowSize;
@ -132,7 +134,7 @@ class FieldPlot extends Plot
$this->value->Stroke($img, $this->coords[0][$i], $xt, $yt);
}
}
// Framework function
public function Legend($aGraph)
{
@ -156,24 +158,24 @@ class FieldPlot extends Plot
//===================================================
class ScatterPlot extends Plot
{
public $mark = '';
public $mark;
public $link;
private $impuls = false;
private $linkpoints = false;
private $linkpointweight=1;
private $linkpointcolor="black";
//---------------
// CONSTRUCTOR
public function ScatterPlot($datay, $datax=false)
public function __construct($datay, $datax=false)
{
if ((count($datax) != count($datay)) && is_array($datax)) {
JpGraphError::RaiseL(20003);
}//("Scatterplot must have equal number of X and Y points.");
$this->Plot($datay, $datax);
if (is_array($datax) && (count($datax) != count($datay))) {
JpGraphError::RaiseL(20003);//("Scatterplot must have equal number of X and Y points.");
}
parent::__construct($datay, $datax);
$this->mark = new PlotMark();
$this->mark->SetType(MARK_SQUARE);
$this->mark->SetColor($this->color);
$this->value->SetAlign('center', 'center');
$this->value->SetMargin(0);
$this->link = new LineProperty(1, 'black', 'solid');
$this->link->iShow = false;
}
//---------------
@ -183,12 +185,18 @@ class ScatterPlot extends Plot
$this->impuls = $f;
}
// Combine the scatter plot points with a line
public function SetLinkPoints($aFlag=true, $aColor="black", $aWeight=1)
public function SetStem($f=true)
{
$this->linkpoints=$aFlag;
$this->linkpointcolor=$aColor;
$this->linkpointweight=$aWeight;
$this->impuls = $f;
}
// Combine the scatter plot points with a line
public function SetLinkPoints($aFlag=true, $aColor="black", $aWeight=1, $aStyle='solid')
{
$this->link->iShow = $aFlag;
$this->link->iColor = $aColor;
$this->link->iWeight = $aWeight;
$this->link->iStyle = $aStyle;
}
public function Stroke($img, $xscale, $yscale)
@ -199,11 +207,11 @@ class ScatterPlot extends Plot
} else {
$yzero=$yscale->scale_abs[0];
}
$this->csimareas = '';
for ($i=0; $i<$this->numpoints; ++$i) {
// Skip null values
// Skip null values
if ($this->coords[0][$i]==='' || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x') {
continue;
}
@ -216,10 +224,12 @@ class ScatterPlot extends Plot
$yt = $yscale->Translate($this->coords[0][$i]);
if ($this->linkpoints && isset($yt_old)) {
$img->SetColor($this->linkpointcolor);
$img->SetLineWeight($this->linkpointweight);
$img->Line($xt_old, $yt_old, $xt, $yt);
if ($this->link->iShow && isset($yt_old)) {
$img->SetColor($this->link->iColor);
$img->SetLineWeight($this->link->iWeight);
$old = $img->SetLineStyle($this->link->iStyle);
$img->StyleLine($xt_old, $yt_old, $xt, $yt);
$img->SetLineStyle($old);
}
if ($this->impuls) {
@ -227,7 +237,7 @@ class ScatterPlot extends Plot
$img->SetLineWeight($this->weight);
$img->Line($xt, $yzero, $xt, $yt);
}
if (!empty($this->csimtargets[$i])) {
if (!empty($this->csimwintargets[$i])) {
$this->mark->SetCSIMTarget($this->csimtargets[$i], $this->csimwintargets[$i]);
@ -236,7 +246,7 @@ class ScatterPlot extends Plot
}
$this->mark->SetCSIMAlt($this->csimalts[$i]);
}
if (isset($this->coords[1])) {
$this->mark->SetCSIMAltVal($this->coords[0][$i], $this->coords[1][$i]);
} else {
@ -244,7 +254,7 @@ class ScatterPlot extends Plot
}
$this->mark->Stroke($img, $xt, $yt);
$this->csimareas .= $this->mark->GetCSIMAreas();
$this->value->Stroke($img, $this->coords[0][$i], $xt, $yt);
@ -252,7 +262,7 @@ class ScatterPlot extends Plot
$yt_old = $yt;
}
}
// Framework function
public function Legend($aGraph)
{