Upgrade jpgrah to 4.3.4
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

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_STOCK.PHP
// Description: Stock plot extension for JpGraph
// Created: 2003-01-27
// Ver: $Id: jpgraph_stock.php 957 2007-12-01 14:00:29Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
// File: JPGRAPH_STOCK.PHP
// Description: Stock plot extension for JpGraph
// Created: 2003-01-27
// Ver: $Id: jpgraph_stock.php 1364 2009-06-24 07:07:44Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
//===================================================
// CLASS StockPlot
@ -22,18 +22,18 @@ class StockPlot extends Plot
private $iStockColor3='darkred';
//---------------
// CONSTRUCTOR
public function StockPlot($datay, $datax=false)
public function __construct($datay, $datax=false)
{
if (count($datay) % $this->iTupleSize) {
JpGraphError::RaiseL(21001, $this->iTupleSize);
//('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.');
}
$this->Plot($datay, $datax);
parent::__construct($datay, $datax);
$this->numpoints /= $this->iTupleSize;
}
//---------------
// PUBLIC METHODS
public function SetColor($aColor, $aColor1='white', $aColor2='darkred', $aColor3='darkred')
{
$this->color = $aColor;
@ -67,7 +67,7 @@ class StockPlot extends Plot
$graph->xaxis->scale->ticks->SetXLabelOffset($a);
$graph->SetTextScaleOff($b);
}
// Method description
public function Stroke($img, $xscale, $yscale)
{
@ -78,9 +78,8 @@ class StockPlot extends Plot
if (isset($this->coords[1])) {
if (count($this->coords[1])!=$n) {
JpGraphError::RaiseL(2003, count($this->coords[1]), $n);
}
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
else {
// ("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
} else {
$exist_x = true;
}
} else {
@ -92,23 +91,26 @@ class StockPlot extends Plot
} else {
$xs=0;
}
$ts = $this->iTupleSize;
$this->csimareas = '';
for ($i=0; $i<$n; ++$i) {
//If value is NULL, then don't draw a bar at all
if ($this->coords[0][$i] === null) {
//If value is NULL, then don't draw a bar at all
if ($this->coords[0][$i*$ts] === null) {
continue;
}
if ($exist_x) {
$x=$this->coords[1][$i];
if ($x === null) {
continue;
}
} else {
$x=$i;
}
$xt = $xscale->Translate($x);
$neg = $this->coords[0][$i*$ts] > $this->coords[0][$i*$ts+1] ;
$yopen = $yscale->Translate($this->coords[0][$i*$ts]);
$yclose = $yscale->Translate($this->coords[0][$i*$ts+1]);
@ -131,7 +133,7 @@ class StockPlot extends Plot
} else {
$img->SetColor($this->color);
}
$img->Rectangle($xl, $yopen, $xr, $yclose);
if ($yopen < $yclose) {
@ -157,8 +159,8 @@ class StockPlot extends Plot
// Setup image maps
if (!empty($this->csimtargets[$i])) {
$this->csimareas.= '<area shape="rect" coords="'.
round($xl).','.round($ytop).','.
round($xr).','.round($ybottom).'" ';
round($xl).','.round($ytop).','.
round($xr).','.round($ybottom).'" ';
$this->csimareas .= ' href="'.$this->csimtargets[$i].'"';
if (!empty($this->csimalts[$i])) {
$sval=$this->csimalts[$i];
@ -183,10 +185,11 @@ class BoxPlot extends StockPlot
{
private $iPColor='black';
private $iNColor='white';
public function BoxPlot($datay, $datax=false)
public function __construct($datay, $datax=false)
{
$this->iTupleSize=5;
parent::StockPlot($datay, $datax);
parent::__construct($datay, $datax);
}
public function SetMedianColor($aPos, $aNeg)
@ -202,7 +205,7 @@ class BoxPlot extends StockPlot
} else {
$img->SetColor($this->iPColor);
}
$y = $yscale->Translate($this->coords[0][$i*5+4]);
$img->Line($xl, $y, $xr, $y);
}