ThirdParty: Updated jpgraph to 4.3.1 (2020-04-24)

This commit is contained in:
Andre Lorbach 2020-07-08 15:28:51 +02:00
parent 9525d4f550
commit 546d932cc7
29 changed files with 392 additions and 127 deletions

View File

@ -238,25 +238,25 @@ if ( !$content['error_occured'] )
// Setup the tab title
$graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
$graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
$graph->tabtitle->SetFont(FF_DV_SANSSERIF,FS_BOLD,9);
$graph->tabtitle->SetPos('left');
// Set Graph footer
$graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
$graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
$graph->footer->left->SetFont( FF_DV_SANSSERIF, FS_NORMAL, 7);
// $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
// $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8);
// $graph->footer->right->SetFont( FF_DV_SANSSERIF, FS_NORMAL, 8);
// $graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
// $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 8);
// $graph->footer->left->SetFont( FF_DV_SANSSERIF, FS_NORMAL, 8);
// $graph->footer->right->SetColor("darkred");
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Set Fonts for graph!
$graph->xaxis->SetFont(FF_VERA,FS_NORMAL,8);
$graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
$graph->legend->SetFont(FF_VERA,FS_NORMAL,8);
$graph->xaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
$graph->yaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
$graph->legend->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
// Create
$p1 = new PiePlot3D($YchartData);
@ -282,7 +282,7 @@ if ( !$content['error_occured'] )
// Set label properties
$p1->SetLabelPos(1.0);
$p1->SetSliceColors(array('#FFF584','#CBFF84','#FF6B9E','#FF9584','#EAFF84','#7BFF51','#51FFA6','#51FF52','#6BCFFF','#5170FF','#519CFF','#EAE3AD','#FFF184','#8584FF','#E698FF','#C384FF','#FF84EC','#FF98A3','#E5C285','#FFDA98' ));
$p1->value->SetFont(FF_VERA, FS_NORMAL, 8);
$p1->value->SetFont(FF_DV_SANSSERIF, FS_NORMAL, 8);
$p1->value->SetColor("black");
// Adjust other Pie Properties
@ -307,7 +307,7 @@ if ( !$content['error_occured'] )
$graph->img->SetAlphaBlending(true);
// Setup X-AXIS
// $graph->xaxis->SetFont(FF_VERA,FS_NORMAL,10);
// $graph->xaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,10);
$graph->xaxis->SetTickLabels($XchartData);
if ( count($XchartData) > 5 )
@ -326,17 +326,17 @@ if ( !$content['error_occured'] )
$graph->yscale->ticks->SupressZeroLabel(false);
// Set Fonts for graph!
$graph->xaxis->SetFont(FF_VERA,FS_NORMAL,7);
$graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
$graph->xaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,7);
$graph->yaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
// Setup the tab title
$graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
$graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
$graph->tabtitle->SetFont(FF_DV_SANSSERIF,FS_BOLD,9);
$graph->tabtitle->SetPos('left');
// Set Graph footer
$graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
$graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
$graph->footer->left->SetFont( FF_DV_SANSSERIF, FS_NORMAL, 7);
// Setup the X and Y grid
$graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5');
@ -358,7 +358,7 @@ if ( !$content['error_occured'] )
// Display value in bars
$bplot->value->Show();
$bplot->value->SetFont(FF_VERA,FS_NORMAL,8);
$bplot->value->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
$bplot->value->SetFormat('%d');
// Add links
@ -392,6 +392,12 @@ if ( !$content['error_occured'] )
$graph->SetMarginColor('white');
$graph->SetBox(); // Box around plotarea
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->xgrid->SetColor('#E3E3E3');
// Setup X-AXIS
$graph->xaxis->SetTickLabels($XchartData);
$graph->xaxis->SetLabelAngle(0);
@ -413,18 +419,18 @@ if ( !$content['error_occured'] )
$graph->yscale->ticks->SupressZeroLabel(false);
// Set Fonts for graph!
$graph->xaxis->SetFont(FF_VERA,FS_NORMAL,7);
$graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
$graph->xaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,7);
$graph->yaxis->SetFont(FF_DV_SANSSERIF,FS_NORMAL,8);
// Setup the tab title
$graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
$graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
$graph->tabtitle->SetFont(FF_DV_SANSSERIF,FS_BOLD,9);
$graph->tabtitle->SetPos('right');
$graph->tabtitle->SetTabAlign('right');
// Set Graph footer
$graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
$graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
$graph->footer->left->SetFont( FF_DV_SANSSERIF, FS_NORMAL, 7);
// Setup the X and Y grid
$graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5');
@ -446,7 +452,7 @@ if ( !$content['error_occured'] )
// Display value in bars
$bplot->value->Show();
$bplot->value->SetFont(FF_VERA,FS_NORMAL, 8);
$bplot->value->SetFont(FF_DV_SANSSERIF,FS_NORMAL, 8);
$bplot->value->SetFormat('%d');
// Add links

View File

@ -1,7 +1,7 @@
README FOR JPGRAPH 4.0.1
README FOR JPGRAPH 4.3.1
=========================
This package contains the JpGraph PHP library version 4.0.1
This package contains the JpGraph PHP library version 4.3.1
The library is Copyright (C) 2000-2010 Asial Corporatoin and
released under dual license QPL 1.0 for open source and educational
@ -11,9 +11,6 @@ Please see full license details at
http://jpgraph.net/pro/
http://jpgraph.net/download/
* --------------------------------------------------------------------
* PHP4 IS NOT SUPPORTED IN 3.x or 4.x SERIES
* --------------------------------------------------------------------
Requirements:
-------------

View File

@ -0,0 +1,237 @@
class JpCountryFlags {
$iCountryFlags = array(
'Afghanistan' => 'afgh.gif',
'Republic of Angola' => 'agla.gif',
'Republic of Albania' => 'alba.gif',
'Alderney' => 'alde.gif',
'Democratic and Popular Republic of Algeria' => 'alge.gif',
'Territory of American Samoa' => 'amsa.gif',
'Principality of Andorra' => 'andr.gif',
'British Overseas Territory of Anguilla' => 'angu.gif',
'Antarctica' => 'anta.gif',
'Argentine Republic' => 'arge.gif',
'League of Arab States' => 'arle.gif',
'Republic of Armenia' => 'arme.gif',
'Aruba' => 'arub.gif',
'Commonwealth of Australia' => 'astl.gif',
'Republic of Austria' => 'aust.gif',
'Azerbaijani Republic' => 'azer.gif',
'British Antarctic Territory' => 'bant.gif',
'Kingdom of Belgium' => 'belg.gif',
'British Overseas Territory of Bermuda' => 'berm.gif',
'Commonwealth of the Bahamas' => 'bhms.gif',
'Kingdom of Bahrain' => 'bhrn.gif',
'Republic of Belarus' => 'blru.gif',
'Republic of Bolivia' => 'blva.gif',
'Belize' => 'blze.gif',
'Republic of Benin' => 'bnin.gif',
'Republic of Botswana' => 'bots.gif',
'Federative Republic of Brazil' => 'braz.gif',
'Barbados' => 'brbd.gif',
'British Indian Ocean Territory' => 'brin.gif',
'Brunei Darussalam' => 'brun.gif',
'Republic of Burkina' => 'bufa.gif',
'Republic of Bulgaria' => 'bulg.gif',
'Republic of Burundi' => 'buru.gif',
'Overseas Territory of the British Virgin Islands' => 'bvis.gif',
'Central African Republic' => 'cafr.gif',
'Kingdom of Cambodia' => 'camb.gif',
'Republic of Cameroon' => 'came.gif',
'Dominion of Canada' => 'cana.gif',
'Caribbean Community' => 'cari.gif',
'Republic of Cape Verde' => 'cave.gif',
'Republic of Chad' => 'chad.gif',
'Republic of Chile' => 'chil.gif',
'Territory of Christmas Island' => 'chms.gif',
'Commonwealth of Independent States' => 'cins.gif',
'Cook Islands' => 'ckis.gif',
'Republic of Colombia' => 'clmb.gif',
'Territory of Cocos Islands' => 'cois.gif',
'Commonwealth' => 'comn.gif',
'Union of the Comoros' => 'como.gif',
'Republic of the Congo' => 'cong.gif',
'Republic of Costa Rica' => 'corc.gif',
'Republic of Croatia' => 'croa.gif',
'Republic of Cuba' => 'cuba.gif',
'British Overseas Territory of the Cayman Islands' => 'cyis.gif',
'Republic of Cyprus' => 'cypr.gif',
'The Czech Republic' => 'czec.gif',
'Kingdom of Denmark' => 'denm.gif',
'Republic of Djibouti' => 'djib.gif',
'Commonwealth of Dominica' => 'domn.gif',
'Dominican Republic' => 'dore.gif',
'Republic of Ecuador' => 'ecua.gif',
'Arab Republic of Egypt' => 'egyp.gif',
'Republic of El Salvador' => 'elsa.gif',
'England' => 'engl.gif',
'Republic of Equatorial Guinea' => 'eqgu.gif',
'State of Eritrea' => 'erit.gif',
'Republic of Estonia' => 'estn.gif',
'Ethiopia' => 'ethp.gif',
'European Union' => 'euun.gif',
'British Overseas Territory of the Falkland Islands' => 'fais.gif',
'International Federation of Vexillological Associations' => 'fiav.gif',
'Republic of Fiji' => 'fiji.gif',
'Republic of Finland' => 'finl.gif',
'Territory of French Polynesia' => 'fpol.gif',
'French Republic' => 'fran.gif',
'Overseas Department of French Guiana' => 'frgu.gif',
'Gabonese Republic' => 'gabn.gif',
'Republic of the Gambia' => 'gamb.gif',
'Republic of Georgia' => 'geor.gif',
'Federal Republic of Germany' => 'germ.gif',
'Republic of Ghana' => 'ghan.gif',
'Gibraltar' => 'gibr.gif',
'Hellenic Republic' => 'grec.gif',
'State of Grenada' => 'gren.gif',
'Overseas Department of Guadeloupe' => 'guad.gif',
'Territory of Guam' => 'guam.gif',
'Republic of Guatemala' => 'guat.gif',
'The Bailiwick of Guernsey' => 'guer.gif',
'Republic of Guinea' => 'guin.gif',
'Republic of Haiti' => 'hait.gif',
'Hong Kong Special Administrative Region' => 'hokn.gif',
'Republic of Honduras' => 'hond.gif',
'Republic of Hungary' => 'hung.gif',
'Republic of Iceland' => 'icel.gif',
'International Committee of the Red Cross' => 'icrc.gif',
'Republic of India' => 'inda.gif',
'Republic of Indonesia' => 'indn.gif',
'Republic of Iraq' => 'iraq.gif',
'Republic of Ireland' => 'irel.gif',
'Organization of the Islamic Conference' => 'isco.gif',
'Isle of Man' => 'isma.gif',
'State of Israel' => 'isra.gif',
'Italian Republic' => 'ital.gif',
'Jamaica' => 'jama.gif',
'Japan' => 'japa.gif',
'The Bailiwick of Jersey' => 'jers.gif',
'Hashemite Kingdom of Jordan' => 'jord.gif',
'Republic of Kazakhstan' => 'kazk.gif',
'Republic of Kenya' => 'keny.gif',
'Republic of Kiribati' => 'kirb.gif',
'State of Kuwait' => 'kuwa.gif',
'Kyrgyz Republic' => 'kyrg.gif',
'Republic of Latvia' => 'latv.gif',
'Lebanese Republic' => 'leba.gif',
'Kingdom of Lesotho' => 'lest.gif',
'Republic of Liberia' => 'libe.gif',
'Principality of Liechtenstein' => 'liec.gif',
'Republic of Lithuania' => 'lith.gif',
'Grand Duchy of Luxembourg' => 'luxe.gif',
'Macao Special Administrative Region' => 'maca.gif',
'Republic of Macedonia' => 'mace.gif',
'Republic of Madagascar' => 'mada.gif',
'Republic of the Marshall Islands' => 'mais.gif',
'Republic of Maldives' => 'mald.gif',
'Republic of Mali' => 'mali.gif',
'Federation of Malaysia' => 'mals018.gif',
'Republic of Malta' => 'malt.gif',
'Republic of Malawi' => 'malw.gif',
'Overseas Department of Martinique' => 'mart.gif',
'Islamic Republic of Mauritania' => 'maur.gif',
'Territorial Collectivity of Mayotte' => 'mayt.gif',
'United Mexican States' => 'mexc.gif',
'Federated States of Micronesia' => 'micr.gif',
'Midway Islands' => 'miis.gif',
'Republic of Moldova' => 'mold.gif',
'Principality of Monaco' => 'mona.gif',
'Republic of Mongolia' => 'mong.gif',
'British Overseas Territory of Montserrat' => 'mont.gif',
'Kingdom of Morocco' => 'morc.gif',
'Republic of Mozambique' => 'moza.gif',
'Republic of Mauritius' => 'mrts.gif',
'Union of Myanmar' => 'myan.gif',
'Republic of Namibia' => 'namb.gif',
'North Atlantic Treaty Organization' => 'nato.gif',
'Republic of Nauru' => 'naur.gif',
'Turkish Republic of Northern Cyprus' => 'ncyp.gif',
'Netherlands Antilles' => 'nean.gif',
'Kingdom of Nepal' => 'nepa.gif',
'Kingdom of the Netherlands' => 'neth.gif',
'Territory of Norfolk Island' => 'nfis.gif',
'Federal Republic of Nigeria' => 'ngra.gif',
'Republic of Nicaragua' => 'nica.gif',
'Republic of Niger' => 'nigr.gif',
'Niue' => 'niue.gif',
'Commonwealth of the Northern Mariana Islands' => 'nmar.gif',
'Province of Northern Ireland' => 'noir.gif',
'Nordic Council' => 'nord.gif',
'Kingdom of Norway' => 'norw.gif',
'Territory of New Caledonia and Dependencies' => 'nwca.gif',
'New Zealand' => 'nwze.gif',
'Organization of American States' => 'oast.gif',
'Organization of African Unity' => 'oaun.gif',
'International Olympic Committee' => 'olym.gif',
'Sultanate of Oman' => 'oman.gif',
'Organization of Petroleum Exporting Countries' => 'opec.gif',
'Islamic Republic of Pakistan' => 'paks.gif',
'Republic of Palau' => 'pala.gif',
'Independent State of Papua New Guinea' => 'pang.gif',
'Republic of Paraguay' => 'para.gif',
'Republic of the Philippines' => 'phil.gif',
'British Overseas Territory of the Pitcairn Islands' => 'piis.gif',
'Republic of Poland' => 'pola.gif',
'Republic of Portugal' => 'port.gif',
'Commonwealth of Puerto Rico' => 'purc.gif',
'State of Qatar' => 'qata.gif',
'Russian Federation' => 'russ.gif',
'Republic of Rwanda' => 'rwan.gif',
'Kingdom of Saudi Arabia' => 'saar.gif',
'Republic of San Marino' => 'sama.gif',
'Nordic Sami Conference' => 'sami.gif',
'Sark' => 'sark.gif',
'Scotland' => 'scot.gif',
'Principality of Seborga' => 'sebo.gif',
'Republic of Sierra Leone' => 'sile.gif',
'Republic of Singapore' => 'sing.gif',
'Republic of Korea' => 'skor.gif',
'Republic of Slovenia' => 'slva.gif',
'Somali Republic' => 'smla.gif',
'Republic of Somaliland' => 'smld.gif',
'Republic of South Africa' => 'soaf.gif',
'Solomon Islands' => 'sois.gif',
'Kingdom of Spain' => 'span.gif',
'Secretariat of the Pacific Community' => 'spco.gif',
'Democratic Socialist Republic of Sri Lanka' => 'srla.gif',
'Saint Lucia' => 'stlu.gif',
'Republic of the Sudan' => 'suda.gif',
'Republic of Suriname' => 'surn.gif',
'Slovak Republic' => 'svka.gif',
'Kingdom of Sweden' => 'swdn.gif',
'Swiss Confederation' => 'swit.gif',
'Syrian Arab Republic' => 'syra.gif',
'Kingdom of Swaziland' => 'szld.gif',
'Republic of China' => 'taiw.gif',
'Republic of Tajikistan' => 'tajk.gif',
'United Republic of Tanzania' => 'tanz.gif',
'Kingdom of Thailand' => 'thal.gif',
'Autonomous Region of Tibet' => 'tibe.gif',
'Turkmenistan' => 'tkst.gif',
'Togolese Republic' => 'togo.gif',
'Tokelau' => 'toke.gif',
'Kingdom of Tonga' => 'tong.gif',
'Tristan da Cunha' => 'trdc.gif',
'Tromelin' => 'tris.gif',
'Republic of Tunisia' => 'tuns.gif',
'Republic of Turkey' => 'turk.gif',
'Tuvalu' => 'tuva.gif',
'United Arab Emirates' => 'uaem.gif',
'Republic of Uganda' => 'ugan.gif',
'Ukraine' => 'ukrn.gif',
'United Kingdom of Great Britain' => 'unkg.gif',
'United Nations' => 'unna.gif',
'United States of America' => 'unst.gif',
'Oriental Republic of Uruguay' => 'urgy.gif',
'Virgin Islands of the United States' => 'usvs.gif',
'Republic of Uzbekistan' => 'uzbk.gif',
'State of the Vatican City' => 'vacy.gif',
'Republic of Vanuatu' => 'vant.gif',
'Bolivarian Republic of Venezuela' => 'venz.gif',
'Republic of Yemen' => 'yemn.gif',
'Democratic Republic of Congo' => 'zare.gif',
'Republic of Zimbabwe' => 'zbwe.gif'
) ;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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);
@ -219,17 +220,11 @@ class Image {
}
}
static function GetWidth($aImg=null) {
if( $aImg === null ) {
$aImg = $this->img;
}
static function GetWidth($aImg) {
return imagesx($aImg);
}
static function GetHeight($aImg=null) {
if( $aImg === null ) {
$aImg = $this->img;
}
static function GetHeight($aImg) {
return imagesy($aImg);
}
@ -1951,8 +1946,8 @@ class RotImage extends Image {
function __construct($aWidth,$aHeight,$a=0,$aFormat=DEFAULT_GFORMAT,$aSetAutoMargin=true) {
parent::__construct($aWidth,$aHeight,$aFormat,$aSetAutoMargin);
$this->dx=$this->left_margin+$this->plotwidth/2;
$this->dy=$this->top_margin+$this->plotheight/2;
$this->dx=$this->width/2;
$this->dy=$this->height/2;
$this->SetAngle($a);
}
@ -2019,8 +2014,6 @@ class RotImage extends Image {
function SetMargin($lm,$rm,$tm,$bm) {
parent::SetMargin($lm,$rm,$tm,$bm);
$this->dx=$this->left_margin+$this->plotwidth/2;
$this->dy=$this->top_margin+$this->plotheight/2;
$this->UpdateRotMatrice();
}
@ -2271,7 +2264,7 @@ class ImgStreamCache {
// image file doesn't exist or exists but is to old
function GetAndStream($aImage,$aCacheFileName) {
if( $this->Isvalid($aCacheFileName) ) {
$this->StreamImgFile($aImage,$aCacheFileName);
return $this->StreamImgFile($aImage,$aCacheFileName);
}
else {
return false;

View File

@ -3,9 +3,9 @@
// File: JPG-CONFIG.INC
// Description: Configuration file for JpGraph library
// Created: 2004-03-27
// Ver: $Id: jpg-config.inc.php 1749 2009-07-31 10:58:41Z ljp $
// Ver: $Id: jpg-config.inc.php 1871 2009-09-29 05:56:39Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
@ -36,11 +36,10 @@
//
//------------------------------------------------------------------------
// define('CACHE_DIR','/tmp/jpgraph_cache/');
// define('TTF_DIR','/usr/share/fonts/truetype/');
// define('MBTTF_DIR','/usr/share/fonts/truetype/');
// define('TTF_DIR','/usr/share/fonts/TrueType/');
// define('MBTTF_DIR','/usr/share/fonts/TrueType/');
DEFINE("TTF_DIR", $gl_root_path . "BitstreamVeraFonts/");
//-------------------------------------------------------------------------
// Cache directory specification for use with CSIM graphs that are
// using the cache.
@ -88,7 +87,7 @@ define('READ_CACHE',true);
// Determine if the error handler should be image based or purely
// text based. Image based makes it easier since the script will
// always return an image even in case of errors.
define('USE_IMAGE_ERROR_HANDLER',false);
define('USE_IMAGE_ERROR_HANDLER',true);
// Should the library examine the global php_errmsg string and convert
// any error in it to a graphical representation. This is handy for the
@ -131,17 +130,10 @@ define('CACHE_FILE_GROUP','www');
// (Set to '' will give the default persmissions for the 'PHP-user')
define('CACHE_FILE_MOD',0664);
// Decide if we should use the bresenham circle algorithm or the
// built in Arc(). Bresenham gives better visual apperance of circles
// but is more CPU intensive and slower then the built in Arc() function
// in GD. Turned off by default for speed
define('USE_BRESENHAM',false);
// Default theme class name
define('DEFAULT_THEME_CLASS', 'UniversalTheme');
define('SUPERSAMPLING', true);
define('SUPERSAMPLING_SCALE', 1);
?>

View File

@ -19,7 +19,7 @@ require_once('jpgraph_theme.inc.php');
require_once('gd_image.inc.php');
// Version info
define('JPG_VERSION','4.0.1');
define('JPG_VERSION','4.3.1');
// Minimum required PHP version
define('MIN_PHPVERSION','5.1.0');
@ -740,11 +740,6 @@ class Graph {
// Rotate the graph 90 degrees and set the margin
// when we have done a 90 degree rotation
function Set90AndMargin($lm=0,$rm=0,$tm=0,$bm=0) {
$lm = $lm ==0 ? floor(0.2 * $this->img->width) : $lm ;
$rm = $rm ==0 ? floor(0.1 * $this->img->width) : $rm ;
$tm = $tm ==0 ? floor(0.2 * $this->img->height) : $tm ;
$bm = $bm ==0 ? floor(0.1 * $this->img->height) : $bm ;
$adj = ($this->img->height - $this->img->width)/2;
$this->img->SetMargin($tm-$adj,$bm-$adj,$rm+$adj,$lm+$adj);
$this->img->SetCenter(floor($this->img->width/2),floor($this->img->height/2));
@ -1290,9 +1285,11 @@ class Graph {
}
}
$n = count($this->iTables);
for( $i=0; $i < $n; ++$i ) {
$csim .= $this->iTables[$i]->GetCSIMareas();
if($this->iTables != null) {
$n = count($this->iTables);
for ($i = 0; $i < $n; ++$i) {
$csim .= $this->iTables[$i]->GetCSIMareas();
}
}
return $csim;
@ -1367,7 +1364,7 @@ class Graph {
// Now reconstruct any user URL argument
reset($_GET);
while( list($key,$value) = each($_GET) ) {
foreach ($_GET as $key => $value) {
if( is_array($value) ) {
foreach ( $value as $k => $v ) {
$urlarg .= '&amp;'.$key.'%5B'.$k.'%5D='.urlencode($v);
@ -1382,7 +1379,7 @@ class Graph {
// but there is little else we can do. One idea for the
// future might be recreate the POST header in case.
reset($_POST);
while( list($key,$value) = each($_POST) ) {
foreach ($_POST as $key => $value) {
if( is_array($value) ) {
foreach ( $value as $k => $v ) {
$urlarg .= '&amp;'.$key.'%5B'.$k.'%5D='.urlencode($v);
@ -1492,7 +1489,7 @@ class Graph {
else {
$txts = $this->texts;
}
$n = count($txts);
$n = is_array($txts) ? count($txts) : 0;
$min=null;
$max=null;
for( $i=0; $i < $n; ++$i ) {
@ -1521,7 +1518,7 @@ class Graph {
else {
$txts = $this->texts;
}
$n = count($txts);
$n = is_array($txts) ? count($txts) : 0;
$min=null;
$max=null;
for( $i=0; $i < $n; ++$i ) {
@ -1572,8 +1569,10 @@ class Graph {
foreach( $this->y2plots as $p ) {
list($xmin,$ymin) = $p->Min();
list($xmax,$ymax) = $p->Max();
$min = Min($xmin,$min);
$max = Max($xmax,$max);
if( $xmin !== null && $xmax !== null ) {
$min = Min($xmin, $min);
$max = Max($xmax, $max);
}
}
}
@ -1583,8 +1582,10 @@ class Graph {
foreach( $this->ynplots[$i] as $p ) {
list($xmin,$ymin) = $p->Min();
list($xmax,$ymax) = $p->Max();
$min = Min($xmin,$min);
$max = Max($xmax,$max);
if( $xmin !== null && $xmax !== null ) {
$min = Min($xmin, $min);
$max = Max($xmax, $max);
}
}
}
}
@ -3021,7 +3022,7 @@ class Graph {
// 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 ;
@ -3039,7 +3040,7 @@ class Graph {
// 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 ;
@ -3588,7 +3589,7 @@ class Grid {
if( $this->fill ) {
// Draw filled areas
$y2 = $aTicksPos[0];
$y2 = !empty($aTicksPos) ? $aTicksPos[0] : null;
$i=1;
while( $i < $nbrgrids ) {
$y1 = $y2;
@ -4335,14 +4336,14 @@ class LinearTicks extends Ticks {
}
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();
@ -5009,7 +5010,7 @@ class LinearScale {
$this->off=$img->left_margin;
$this->scale_factor = 0;
if( $this->world_size > 0 ) {
$this->scale_factor=$this->world_abs_size/($this->world_size*1.0);
$this->scale_factor=$this->world_abs_size/($this->world_size*0.999999);
}
}
else { // y scale
@ -5017,7 +5018,7 @@ class LinearScale {
$this->off=$img->top_margin+$this->world_abs_size;
$this->scale_factor = 0;
if( $this->world_size > 0 ) {
$this->scale_factor=-$this->world_abs_size/($this->world_size*1.0);
$this->scale_factor=-$this->world_abs_size/($this->world_size*0.999999);
}
}
$size = $this->world_size * $this->scale_factor;
@ -5569,7 +5570,7 @@ class Plot {
function Clear() {
$this->isRunningClear = true;
$this->__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']);
Plot::__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']);
$this->isRunningClear = false;
}

View File

@ -309,6 +309,17 @@ class BarPlot extends Plot {
}
}
/**
* @override
* Without overriding this method, $this->numpoints does not updated correctly.
*/
function Clear() {
$this->isRunningClear = true;
$this->__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']);
$this->isRunningClear = false;
}
function Stroke($img,$xscale,$yscale) {
$numpoints = count($this->coords[0]);
@ -695,9 +706,6 @@ class GroupBarPlot extends BarPlot {
}
$this->numpoints = $plots[0]->numpoints;
$this->width=0.7;
}
function GroupBarPlot($plots) {
self::__construct($plots);
}
//---------------
@ -719,7 +727,7 @@ class GroupBarPlot extends BarPlot {
$n = count($this->plots);
for($i=0; $i < $n; ++$i) {
list($xm,$ym) = $this->plots[$i]->Min();
$xmin = max($xmin,$xm);
$xmin = min($xmin,$xm);
$ymin = min($ymin,$ym);
}
return array($xmin,$ymin);
@ -1114,14 +1122,13 @@ class AccBarPlot extends BarPlot {
// First stroke the accumulated value for the entire bar
// This value is always placed at the top/bottom of the bars
if( $accy_neg < 0 ) {
if( $accy + $accy_neg < 0 ) {
$y=$yscale->Translate($accy_neg);
$this->value->Stroke($img,$accy_neg,$x,$y);
}
else {
$y=$yscale->Translate($accy);
$this->value->Stroke($img,$accy,$x,$y);
}
$this->value->Stroke($img,$accy + $accy_neg,$x,$y);
$accy = 0;
$accy_neg = 0;
@ -1181,7 +1188,7 @@ class AccBarPlot extends BarPlot {
$this->plots[$j]->value->SetMargin(-1);
}
}
$this->plots[$j]->value->Stroke($img,$this->plots[$j]->coords[0][$i],$x,$y);
$this->plots[$j]->value->Stroke($img,$this->plots[$j]->coords[0][$i],round($x),round($y));
}
}

View File

@ -155,7 +155,7 @@ class JpGraphException extends Exception {
}
$errobj->Raise($this->getMessage());
}
static public function defaultHandler(Exception $exception) {
static public function defaultHandler(Throwable $exception) {
global $__jpg_OldHandler;
if( $exception instanceof JpGraphException ) {
$exception->Stroke();

View File

@ -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 :
@ -309,10 +309,9 @@ class FlagImages {
$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];
@ -341,18 +340,16 @@ class FlagImages {
$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;

View File

@ -410,8 +410,8 @@ class Gradient {
$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);

View File

@ -40,9 +40,6 @@ class LinePlot extends Plot{
$this->mark = new PlotMark() ;
$this->color = ColorFactory::getColor();
$this->fill_color = $this->color;
}
function LinePlot($datay,$datax=false) {
self::__construct($datay,$datax);
}
//---------------
// PUBLIC METHODS

View File

@ -131,7 +131,7 @@ class LogTicks extends Ticks{
private $ticklabels_pos = array();
//---------------
// CONSTRUCTOR
function LogTicks() {
function __construct() {
}
//---------------
// PUBLIC METHODS

View File

@ -296,14 +296,16 @@ class PiePlot {
// 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 {
@ -332,10 +334,12 @@ class PiePlot {
}
if( $this->setslicecolors==null ) {
$graph->legend->Add($l,$colors[$ta[$i%$numcolors]],"",0,$this->csimtargets[$i],$alt,$wintarg);
$csimtarget = isset($this->csimtargets[$i]) ? $this->csimtargets[$i] : null;
$graph->legend->Add($l,$colors[$ta[$i%$numcolors]],"",0,$csimtarget,$alt,$wintarg);
}
else {
$graph->legend->Add($l,$this->setslicecolors[$i%$numcolors],"",0,$this->csimtargets[$i],$alt,$wintarg);
$csimtarget = isset($this->csimtargets[$i]) ? $this->csimtargets[$i] : null;
$graph->legend->Add($l,$this->setslicecolors[$i%$numcolors],"",0,$csimtarget,$alt,$wintarg);
}
}
}

View File

@ -423,6 +423,7 @@ class PolarAxis extends Axis {
$this->img->Line($x1,$y1,$x2,$y2);
}
}
$a = (int) $a;
$a += $this->angle_step;
}
}
@ -487,6 +488,7 @@ class PolarAxis extends Axis {
if( $this->show_angle_tick ) {
$this->img->Line($x1,$y1,$x2,$y2);
}
$a = (int) $a;
$a += $this->angle_step;
}
}

View File

@ -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);

View File

@ -141,10 +141,16 @@ class GTextTableCell {
}
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) {

View File

@ -127,12 +127,11 @@ class AquaTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
$height * 0.25
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -109,8 +109,12 @@ class GreenTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -111,8 +111,12 @@ class OceanTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -111,8 +111,12 @@ class OrangeTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -105,8 +105,12 @@ class PastelTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -111,8 +111,12 @@ class RoseTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -129,8 +129,12 @@ class SoftyTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $img->height * 0.25);
// $graph->SetMargin(200, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -114,12 +114,11 @@ class UniversalTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
$height * 0.25
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}

View File

@ -105,8 +105,12 @@ class VividTheme extends Theme
function PreStrokeApply($graph) {
if ($graph->legend->HasItems()) {
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
$graph->SetMargin(
$img->raw_left_margin,
$img->raw_right_margin,
$img->raw_top_margin,
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
);
}
}