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_LOG.PHP
// Description: Log scale plot extension for JpGraph
// Created: 2001-01-08
// Ver: $Id: jpgraph_log.php 957 2007-12-01 14:00:29Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
// File: JPGRAPH_LOG.PHP
// Description: Log scale plot extension for JpGraph
// Created: 2001-01-08
// Ver: $Id: jpgraph_log.php 1106 2009-02-22 20:16:35Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
DEFINE('LOGLABELS_PLAIN', 0);
DEFINE('LOGLABELS_MAGNITUDE', 1);
@ -22,9 +22,9 @@ class LogScale extends LinearScale
// CONSTRUCTOR
// Log scale is specified using the log of min and max
public function LogScale($min, $max, $type="y")
public function __construct($min, $max, $type="y")
{
$this->LinearScale($min, $max, $type);
parent::__construct($min, $max, $type);
$this->ticks = new LogTicks();
$this->name = 'log';
}
@ -38,8 +38,8 @@ class LogScale extends LinearScale
if (!is_numeric($a)) {
if ($a != '' && $a != '-' && $a != 'x') {
JpGraphError::RaiseL(11001);
// ('Your data contains non-numeric values.');
}
//('Your data contains non-numeric values.');
return 1;
}
if ($a < 0) {
@ -61,8 +61,8 @@ class LogScale extends LinearScale
if (!is_numeric($a)) {
if ($a != '' && $a != '-' && $a != 'x') {
JpGraphError::RaiseL(11001);
//('Your data contains non-numeric values.');
}
//('Your data contains non-numeric values.');
return 1;
}
if ($a==0) {
@ -71,7 +71,7 @@ class LogScale extends LinearScale
$a=log10($a);
return round(($a*1.0 - $this->scale[0]) * $this->scale_factor);
}
// Use bcpow() for increased precision
public function GetMinVal()
{
@ -81,7 +81,7 @@ class LogScale extends LinearScale
return round(pow(10, $this->scale[0]), 14);
}
}
public function GetMaxVal()
{
if (function_exists("bcpow")) {
@ -90,7 +90,7 @@ class LogScale extends LinearScale
return round(pow(10, $this->scale[1]), 14);
}
}
// Logarithmic autoscaling is much simplier since we just
// set the min and max to logs of the min and max values.
// Note that for log autoscale the "maxstep" the fourth argument
@ -101,7 +101,7 @@ class LogScale extends LinearScale
if ($min==0) {
$min=1;
}
if ($max <= 0) {
JpGraphError::RaiseL(11004);
//('Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.');
@ -127,7 +127,7 @@ class LogScale extends LinearScale
$this->Update($img, $smin, $smax);
}
//---------------
// PRIVATE METHODS
// PRIVATE METHODS
} // Class
//===================================================
@ -140,7 +140,7 @@ class LogTicks extends Ticks
private $ticklabels_pos = array();
//---------------
// CONSTRUCTOR
public function LogTicks()
public function __construct()
{
}
//---------------
@ -154,7 +154,7 @@ class LogTicks extends Ticks
{
$this->label_logtype = $aType;
}
// For log scale it's meaningless to speak about a major step
// We just return -1 to make the framework happy (specifically
// StrokeLabels() )
@ -184,16 +184,16 @@ class LogTicks extends Ticks
$limit = $scale->GetMaxVal();
$nextMajor = 10*$start;
$step = $nextMajor / 10.0;
$img->SetLineWeight($this->weight);
if ($scale->type == "y") {
// member direction specified if the ticks should be on
// left or right side.
$a=$pos + $this->direction*$this->GetMinTickAbsSize();
$a2=$pos + $this->direction*$this->GetMajTickAbsSize();
$count=1;
$this->maj_ticks_pos[0]=$scale->Translate($start);
$this->maj_ticklabels_pos[0]=$scale->Translate($start);
@ -227,7 +227,7 @@ class LogTicks extends Ticks
$this->maj_ticks_pos[$i]=$ys;
$this->maj_ticklabels_pos[$i]=$ys;
if ($this->label_formfunc != '') {
$f = $this->label_formfunc;
$this->maj_ticks_label[$i]=call_user_func($f, $nextMajor);