Skip to content
This repository has been archived by the owner on Feb 6, 2018. It is now read-only.

Update to v4.2.0 #20

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jpgraph/src/gd_image.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require_once 'jpgraph_rgb.inc.php';
require_once 'jpgraph_ttf.inc.php';
require_once 'imageSmoothArc.php';
require_once 'jpgraph_errhandler.inc.php';

// Line styles
define('LINESTYLE_SOLID',1);
Expand Down
18 changes: 9 additions & 9 deletions lib/jpgraph/src/jpgraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
require_once('gd_image.inc.php');

// Version info
define('JPG_VERSION','4.0.2');
define('JPG_VERSION','4.2.0');

// Minimum required PHP version
define('MIN_PHPVERSION','5.1.0');
Expand Down Expand Up @@ -1492,7 +1492,7 @@ function GetTextsYMinMax($aY2=false) {
else {
$txts = $this->texts;
}
$n = count($txts);
$n = is_array($txts) ? count($txts) : 0;
$min=null;
$max=null;
for( $i=0; $i < $n; ++$i ) {
Expand Down Expand Up @@ -1521,7 +1521,7 @@ function GetTextsXMinMax($aY2=false) {
else {
$txts = $this->texts;
}
$n = count($txts);
$n = is_array($txts) ? count($txts) : 0;
$min=null;
$max=null;
for( $i=0; $i < $n; ++$i ) {
Expand Down Expand Up @@ -3021,7 +3021,7 @@ function SetTextScaleAbsCenterOff($aOff) {

// Get Y min and max values for added lines
function GetLinesYMinMax( $aLines ) {
$n = count($aLines);
$n = is_array($aLines) ? count($aLines) : 0;
if( $n == 0 ) return false;
$min = $aLines[0]->scaleposition ;
$max = $min ;
Expand All @@ -3039,7 +3039,7 @@ function GetLinesYMinMax( $aLines ) {

// Get X min and max values for added lines
function GetLinesXMinMax( $aLines ) {
$n = count($aLines);
$n = is_array($aLines) ? count($aLines) : 0;
if( $n == 0 ) return false ;
$min = $aLines[0]->scaleposition ;
$max = $min ;
Expand Down Expand Up @@ -3588,7 +3588,7 @@ function DoStroke($aTicksPos,$aType,$aColor,$aWeight) {

if( $this->fill ) {
// Draw filled areas
$y2 = $aTicksPos[0];
$y2 = !empty($aTicksPos) ? $aTicksPos[0] : null;
$i=1;
while( $i < $nbrgrids ) {
$y1 = $y2;
Expand Down Expand Up @@ -4335,14 +4335,14 @@ function SetTickPositions($aMajPos,$aMinPos=NULL,$aLabels=NULL) {
}

function HaveManualLabels() {
return count($this->iManualTickLabels) > 0;
return is_array($this->iManualTickLabels) ? count($this->iManualTickLabels) > 0 : false;
}

// Specify all the tick positions manually and possible also the exact labels
function _doManualTickPos($aScale) {
$n=count($this->iManualTickPos);
$m=count($this->iManualMinTickPos);
$doLbl=count($this->iManualTickLabels) > 0;
$m= is_array($this->iManualMinTickPos) ? count($this->iManualMinTickPos) : 0;
$doLbl= is_array($this->iManualTickLabels) ? count($this->iManualTickLabels) > 0 : false;

$this->maj_ticks_pos = array();
$this->maj_ticklabels_pos = array();
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/jpgraph_bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ class GroupBarPlot extends BarPlot {
private $nbrplots=0;
//---------------
// CONSTRUCTOR
function GroupBarPlot($plots) {
function __construct($plots) {
$this->width=0.7;
$this->plots = $plots;
$this->nbrplots = count($plots);
Expand Down
11 changes: 4 additions & 7 deletions lib/jpgraph/src/jpgraph_flags.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class FlagImages {
private $iFlagData ;
private $iOrdIdx=array();

function FlagImages($aSize=FLAGSIZE1) {
function __construct($aSize=FLAGSIZE1) {
switch($aSize) {
case FLAGSIZE1 :
case FLAGSIZE2 :
Expand Down Expand Up @@ -309,10 +309,9 @@ function GetIdxByOrdinal($aOrd,&$outFullName) {
$aOrd--;
$n = count($this->iOrdIdx);
if( $n == 0 ) {
reset($this->iCountryNameMap);
$this->iOrdIdx=array();
$i=0;
while( list($key,$val) = each($this->iCountryNameMap) ) {
foreach( $this->iCountryNameMap as $key => $val ) {
$this->iOrdIdx[$i++] = array($val,$key);
}
$tmp=$this->iOrdIdx[$aOrd];
Expand Down Expand Up @@ -341,18 +340,16 @@ function GetIdxByName($aName,&$outFullName) {
$found=false;
$aName = strtolower($aName);
$nlen = strlen($aName);
reset($this->iCountryNameMap);
// Start by trying to match exact index name
while( list($key,$val) = each($this->iCountryNameMap) ) {
foreach( $this->iCountryNameMap as $key => $val ) {
if( $nlen == strlen($val) && $val == $aName ) {
$found=true;
break;
}
}
if( !$found ) {
reset($this->iCountryNameMap);
// If the exact index doesn't work try a (partial) full name
while( list($key,$val) = each($this->iCountryNameMap) ) {
foreach( $this->iCountryNameMap as $key => $val ) {
if( strpos(strtolower($key), $aName) !== false ) {
$found=true;
break;
Expand Down
4 changes: 2 additions & 2 deletions lib/jpgraph/src/jpgraph_gradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ function GetColArray($from_color,$to_color,$arr_size,&$colors,$numcols=100) {
$bdelta=($to_color[2]-$from_color[2])/$numcols;
$colorsperstep = $numcols/$arr_size;
$prevcolnum = -1;
$from_alpha = $from_color[3];
$to_alpha = $to_color[3];
$from_alpha = floatval($from_color[3]);
$to_alpha = floatval($to_color[3]);
$adelta = ( $to_alpha - $from_alpha ) / $numcols ;
for ($i=0; $i < $arr_size; ++$i) {
$colnum = floor($colorsperstep*$i);
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/jpgraph_line.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LinePlot extends Plot{

//---------------
// CONSTRUCTOR
function LinePlot($datay,$datax=false) {
function __construct($datay,$datax=false) {
parent::__construct($datay,$datax);
$this->mark = new PlotMark() ;
$this->color = ColorFactory::getColor();
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/jpgraph_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class LogTicks extends Ticks{
private $ticklabels_pos = array();
//---------------
// CONSTRUCTOR
function LogTicks() {
function __construct() {
}
//---------------
// PUBLIC METHODS
Expand Down
6 changes: 4 additions & 2 deletions lib/jpgraph/src/jpgraph_pie.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,16 @@ function Legend($graph) {

// Make sure we don't plot more values than data points
// (in case the user added more legends than data points)
$n = min(count($this->legends),count($this->data));
$legendsCount = is_array($this->legends) ? count($this->legends) : 0;
$n = min($legendsCount,count($this->data));
if( $this->legends != "" ) {
$this->legends = array_reverse(array_slice($this->legends,0,$n));
}
for( $i=$n-1; $i >= 0; --$i ) {
$l = $this->legends[$i];
// Replace possible format with actual values
if( count($this->csimalts) > $i ) {
$count = is_array($this->csimalts) ? count($this->csimalts) : 0;
if( $count > $i ) {
$fmt = $this->csimalts[$i];
}
else {
Expand Down
2 changes: 2 additions & 0 deletions lib/jpgraph/src/jpgraph_polar.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ function StrokeAngleLabels($pos,$type) {
$this->img->Line($x1,$y1,$x2,$y2);
}
}
$a = (int) $a;
$a += $this->angle_step;
}
}
Expand Down Expand Up @@ -487,6 +488,7 @@ function StrokeAngleLabels($pos,$type) {
if( $this->show_angle_tick ) {
$this->img->Line($x1,$y1,$x2,$y2);
}
$a = (int) $a;
$a += $this->angle_step;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jpgraph/src/jpgraph_scatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ScatterPlot extends Plot {
//---------------
// CONSTRUCTOR
function __construct($datay,$datax=false) {
if( (count($datax) != count($datay)) && is_array($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);
Expand Down
14 changes: 10 additions & 4 deletions lib/jpgraph/src/jpgraph_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,16 @@ function SetGridStyle($aLeft,$aTop=null,$aBottom=null,$aRight=null) {
}

function SetGridWeight($aLeft=null,$aTop=null,$aBottom=null,$aRight=null) {
if( $aLeft !== null ) $this->iGridWeight[0] = $aLeft;
if( $aTop !== null ) $this->iGridWeight[1] = $aTop;
if( $aBottom !== null ) $this->iGridWeight[2] = $aBottom;
if( $aRight !== null ) $this->iGridWeight[3] = $aRight;
$weight_arr = array($aLeft, $aTop, $aBottom, $aRight);
for ($i = 0; $i < count($weight_arr); $i++) {
if ($weight_arr[$i] === "") {
$weight_arr[$i] = 0;
}
}
if( $aLeft !== null ) $this->iGridWeight[0] = $weight_arr[0];
if( $aTop !== null ) $this->iGridWeight[1] = $weight_arr[1];
if( $aBottom !== null ) $this->iGridWeight[2] = $weight_arr[2];
if( $aRight !== null ) $this->iGridWeight[3] = $weight_arr[3];
}

function SetMargin($aLeft,$aRight,$aTop,$aBottom) {
Expand Down