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
parent 7c3999c5cd
commit b5868f05f6
72 changed files with 19048 additions and 10218 deletions

View file

@ -0,0 +1,63 @@
README FOR JPGRAPH 4.3.4
=========================
This package contains the JpGraph PHP library version 4.3.4
The library is Copyright (C) 2000-2010 Asial Corporatoin and
released under dual license QPL 1.0 for open source and educational
use and JpGraph Professional License for commercial use.
Please see full license details at
http://jpgraph.net/pro/
http://jpgraph.net/download/
Requirements:
-------------
Miminum:
* PHP 5.1.0 or higher
* GD 2.0.28 or higher
Note: Earlier versions might work but is unsupported.
Recommended:
* >= PHP 5.2.0
* PHP Builtin GD library
Installation
------------
1. Make sure that the PHP version is compatible with the stated
requirements and that the PHP installation has support for
the GD library. Please run phpinfo() to check if GD library
is supported in the installation.
If the GD library doesn't seem to be installed
please consult the PHP manual under section "Image" for
instructions on where to find this library. Please refer to
the manual section "Verifying your PHP installation"
2. Unzip and copy the files to a directory of your choice where Your
httpd sever can access them.
For a global site installation you should copy the files to
somewhere in the PHP search path.
3. Check that the default directory paths in jpg-config.inc.php
for cache directory and TTF directory suits your installation.
Note1: The default directories are different depending on if
the library is running on Windows or UNIX.
Note2: Apache/PHP must have write permission to your cache
directory if you enable the cache feature. By default the cache
is disabled.
Documentation
-------------
The installation includes HTML documentation and reference guide for the
library. The portal page for all documentation is
<YOUR-INSTALLATION-DIRECTORY>/docs/index.html
Bug reports and suggestions
---------------------------
Should be reported using the contact form at
http://jpgraph.net/contact/

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,391 @@
<?php
/*
Copyright (c) 2006-2008 Ulrich Mierendorff
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Changelog:
version 1.1
- improved the rendering speed by ~20%
- Thanks to Matthias Mächler for fixing some small errors:
* uninitialized variables
* deprecated passing of $img reference in imageSmoothArc ()
version 1.0
Release of rewritten script
*/
function imageSmoothArcDrawSegment(&$img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, $stop, $seg)
{
// Originally written from scratch by Ulrich Mierendorff, 06/2006
// Rewritten and improved, 04/2007, 07/2007
// Please do not use THIS function directly. Scroll down to imageSmoothArc(...).
$fillColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], $color[3]);
$xStart = abs($a * cos($start));
$yStart = abs($b * sin($start));
$xStop = abs($a * cos($stop));
$yStop = abs($b * sin($stop));
$dxStart = 0;
$dyStart = 0;
$dxStop = 0;
$dyStop = 0;
if ($xStart != 0) {
$dyStart = $yStart/$xStart;
}
if ($xStop != 0) {
$dyStop = $yStop/$xStop;
}
if ($yStart != 0) {
$dxStart = $xStart/$yStart;
}
if ($yStop != 0) {
$dxStop = $xStop/$yStop;
}
if (abs($xStart) >= abs($yStart)) {
$aaStartX = true;
} else {
$aaStartX = false;
}
if ($xStop >= $yStop) {
$aaStopX = true;
} else {
$aaStopX = false;
}
//$xp = +1; $yp = -1; $xa = +1; $ya = 0;
for ($x = 0; $x < $a; $x += 1) {
/*$y = $b * sqrt( 1 - ($x*$x)/($a*$a) );
$error = $y - (int)($y);
$y = (int)($y);
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );*/
$_y1 = $dyStop*$x;
$_y2 = $dyStart*$x;
if ($xStart > $xStop) {
$error1 = $_y1 - (int)($_y1);
$error2 = 1 - $_y2 + (int)$_y2;
$_y1 = $_y1-$error1;
$_y2 = $_y2+$error2;
} else {
$error1 = 1 - $_y1 + (int)$_y1;
$error2 = $_y2 - (int)($_y2);
$_y1 = $_y1+$error1;
$_y2 = $_y2-$error2;
}
/*
if ($aaStopX)
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
if ($aaStartX)
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
*/
if ($seg == 0 || $seg == 2) {
$i = $seg;
if (!($start > $i*M_PI/2 && $x > $xStart)) {
if ($i == 0) {
$xp = +1;
$yp = -1;
$xa = +1;
$ya = 0;
} else {
$xp = -1;
$yp = +1;
$xa = 0;
$ya = +1;
}
if ($stop < ($i+1)*(M_PI/2) && $x <= $xStop) {
$diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1);
$y1 = $_y1;
if ($aaStopX) {
imageSetPixel($img, $cx+$xp*($x)+$xa, $cy+$yp*($y1+1)+$ya, $diffColor1);
}
} else {
$y = $b * sqrt(1 - ($x*$x)/($a*$a));
$error = $y - (int)($y);
$y = (int)($y);
$diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error);
$y1 = $y;
if ($x < $aaAngleX) {
imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor);
}
}
if ($start > $i*M_PI/2 && $x <= $xStart) {
$diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2);
$y2 = $_y2;
if ($aaStartX) {
imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y2-1)+$ya, $diffColor2);
}
} else {
$y2 = 0;
}
if ($y2 <= $y1) {
imageLine($img, $cx+$xp*$x+$xa, $cy+$yp*$y1+$ya, $cx+$xp*$x+$xa, $cy+$yp*$y2+$ya, $fillColor);
}
}
}
if ($seg == 1 || $seg == 3) {
$i = $seg;
if (!($stop < ($i+1)*M_PI/2 && $x > $xStop)) {
if ($i == 1) {
$xp = -1;
$yp = -1;
$xa = 0;
$ya = 0;
} else {
$xp = +1;
$yp = +1;
$xa = 1;
$ya = 1;
}
if ($start > $i*M_PI/2 && $x < $xStart) {
$diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2);
$y1 = $_y2;
if ($aaStartX) {
imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor2);
}
} else {
$y = $b * sqrt(1 - ($x*$x)/($a*$a));
$error = $y - (int)($y);
$y = (int) $y;
$diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error);
$y1 = $y;
if ($x < $aaAngleX) {
imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y1+1)+$ya, $diffColor);
}
}
if ($stop < ($i+1)*M_PI/2 && $x <= $xStop) {
$diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1);
$y2 = $_y1;
if ($aaStopX) {
imageSetPixel($img, $cx+$xp*$x+$xa, $cy+$yp*($y2-1)+$ya, $diffColor1);
}
} else {
$y2 = 0;
}
if ($y2 <= $y1) {
imageLine($img, $cx+$xp*$x+$xa, $cy+$yp*$y1+$ya, $cx+$xp*$x+$xa, $cy+$yp*$y2+$ya, $fillColor);
}
}
}
}
///YYYYY
for ($y = 0; $y < $b; $y += 1) {
/*$x = $a * sqrt( 1 - ($y*$y)/($b*$b) );
$error = $x - (int)($x);
$x = (int)($x);
$diffColor = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error );
*/
$_x1 = $dxStop*$y;
$_x2 = $dxStart*$y;
if ($yStart > $yStop) {
$error1 = $_x1 - (int)($_x1);
$error2 = 1 - $_x2 + (int)$_x2;
$_x1 = $_x1-$error1;
$_x2 = $_x2+$error2;
} else {
$error1 = 1 - $_x1 + (int)$_x1;
$error2 = $_x2 - (int)($_x2);
$_x1 = $_x1+$error1;
$_x2 = $_x2-$error2;
}
/*
if (!$aaStopX)
$diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
if (!$aaStartX)
$diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
*/
if ($seg == 0 || $seg == 2) {
$i = $seg;
if (!($start > $i*M_PI/2 && $y > $yStop)) {
if ($i == 0) {
$xp = +1;
$yp = -1;
$xa = 1;
$ya = 0;
} else {
$xp = -1;
$yp = +1;
$xa = 0;
$ya = 1;
}
if ($stop < ($i+1)*(M_PI/2) && $y <= $yStop) {
$diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1);
$x1 = $_x1;
if (!$aaStopX) {
imageSetPixel($img, $cx+$xp*($x1-1)+$xa, $cy+$yp*($y)+$ya, $diffColor1);
}
}
if ($start > $i*M_PI/2 && $y < $yStart) {
$diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2);
$x2 = $_x2;
if (!$aaStartX) {
imageSetPixel($img, $cx+$xp*($x2+1)+$xa, $cy+$yp*($y)+$ya, $diffColor2);
}
} else {
$x = $a * sqrt(1 - ($y*$y)/($b*$b));
$error = $x - (int)($x);
$x = (int)($x);
$diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error);
$x1 = $x;
if ($y < $aaAngleY && $y <= $yStop) {
imageSetPixel($img, $cx+$xp*($x1+1)+$xa, $cy+$yp*$y+$ya, $diffColor);
}
}
}
}
if ($seg == 1 || $seg == 3) {
$i = $seg;
if (!($stop < ($i+1)*M_PI/2 && $y > $yStart)) {
if ($i == 1) {
$xp = -1;
$yp = -1;
$xa = 0;
$ya = 0;
} else {
$xp = +1;
$yp = +1;
$xa = 1;
$ya = 1;
}
if ($start > $i*M_PI/2 && $y < $yStart) {
$diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2);
$x1 = $_x2;
if (!$aaStartX) {
imageSetPixel($img, $cx+$xp*($x1-1)+$xa, $cy+$yp*$y+$ya, $diffColor2);
}
}
if ($stop < ($i+1)*M_PI/2 && $y <= $yStop) {
$diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1);
$x2 = $_x1;
if (!$aaStopX) {
imageSetPixel($img, $cx+$xp*($x2+1)+$xa, $cy+$yp*$y+$ya, $diffColor1);
}
} else {
$x = $a * sqrt(1 - ($y*$y)/($b*$b));
$error = $x - (int)($x);
$x = (int)($x);
$diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error);
$x1 = $x;
if ($y < $aaAngleY && $y < $yStart) {
imageSetPixel($img, $cx+$xp*($x1+1)+$xa, $cy+$yp*$y+$ya, $diffColor);
}
}
}
}
}
}
function imageSmoothArc(&$img, $cx, $cy, $w, $h, $color, $start, $stop)
{
// Originally written from scratch by Ulrich Mierendorff, 06/2006
// Rewritten and improved, 04/2007, 07/2007
// compared to old version:
// + Support for transparency added
// + Improved quality of edges & antialiasing
// note: This function does not represent the fastest way to draw elliptical
// arcs. It was written without reading any papers on that subject. Better
// algorithms may be twice as fast or even more.
// what it cannot do: It does not support outlined arcs, only filled
// Parameters:
// $cx - Center of ellipse, X-coord
// $cy - Center of ellipse, Y-coord
// $w - Width of ellipse ($w >= 2)
// $h - Height of ellipse ($h >= 2 )
// $color - Color of ellipse as a four component array with RGBA
// $start - Starting angle of the arc, no limited range!
// $stop - Stop angle of the arc, no limited range!
// $start _can_ be greater than $stop!
// If any value is not in the given range, results are undefined!
// This script does not use any special algorithms, everything is completely
// written from scratch; see http://de.wikipedia.org/wiki/Ellipse for formulas.
while ($start < 0) {
$start += 2*M_PI;
}
while ($stop < 0) {
$stop += 2*M_PI;
}
while ($start > 2*M_PI) {
$start -= 2*M_PI;
}
while ($stop > 2*M_PI) {
$stop -= 2*M_PI;
}
if ($start > $stop) {
imageSmoothArc($img, $cx, $cy, $w, $h, $color, $start, 2*M_PI);
imageSmoothArc($img, $cx, $cy, $w, $h, $color, 0, $stop);
return;
}
$a = 1.0*round($w/2);
$b = 1.0*round($h/2);
$cx = 1.0*round($cx);
$cy = 1.0*round($cy);
$aaAngle = atan(($b*$b)/($a*$a)*tan(0.25*M_PI));
$aaAngleX = $a*cos($aaAngle);
$aaAngleY = $b*sin($aaAngle);
$a -= 0.5; // looks better...
$b -= 0.5;
for ($i=0; $i<4;$i++) {
if ($start < ($i+1)*M_PI/2) {
if ($start > $i*M_PI/2) {
if ($stop > ($i+1)*M_PI/2) {
imageSmoothArcDrawSegment($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, ($i+1)*M_PI/2, $i);
} else {
imageSmoothArcDrawSegment($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, $stop, $i);
break;
}
} else {
if ($stop > ($i+1)*M_PI/2) {
imageSmoothArcDrawSegment($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $i*M_PI/2, ($i+1)*M_PI/2, $i);
} else {
imageSmoothArcDrawSegment($img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $i*M_PI/2, $stop, $i);
break;
}
}
}
}
}

View file

@ -3,9 +3,9 @@
// File: IMGDATA_ROUNDBALLS.INC // File: IMGDATA_ROUNDBALLS.INC
// Description: Base64 encoded images for small round markers // Description: Base64 encoded images for small round markers
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_balls.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_balls.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class ImgData_Balls extends ImgData class ImgData_Balls extends ImgData
@ -76,7 +76,7 @@ class ImgData_Balls extends ImgData
return parent::GetImg($aMark, $aIdx); return parent::GetImg($aMark, $aIdx);
} }
public function ImgData_Balls() public function __construct()
{ {
//========================================================== //==========================================================

View file

@ -3,9 +3,9 @@
// File: IMGDATA_BEVELS.INC // File: IMGDATA_BEVELS.INC
// Description: Base64 encoded images for round bevels // Description: Base64 encoded images for round bevels
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_bevels.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_bevels.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class ImgData_Bevels extends ImgData class ImgData_Bevels extends ImgData
@ -19,7 +19,7 @@ class ImgData_Bevels extends ImgData
protected $imgdata ; protected $imgdata ;
public function ImgData_Bevels() public function __construct()
{ {
//========================================================== //==========================================================
// File: bullets_balls_red_013.png // File: bullets_balls_red_013.png

View file

@ -3,9 +3,9 @@
// File: IMGDATA_DIAMONDS.INC // File: IMGDATA_DIAMONDS.INC
// Description: Base64 encoded images for diamonds // Description: Base64 encoded images for diamonds
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_diamonds.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_diamonds.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class ImgData_Diamonds extends ImgData class ImgData_Diamonds extends ImgData
@ -20,7 +20,7 @@ class ImgData_Diamonds extends ImgData
protected $maxidx = 7 ; protected $maxidx = 7 ;
protected $imgdata ; protected $imgdata ;
public function ImgData_Diamonds() public function __construct()
{ {
//========================================================== //==========================================================
// File: diam_red.png // File: diam_red.png

View file

@ -3,9 +3,9 @@
// File: IMGDATA_PUSHPINS.INC // File: IMGDATA_PUSHPINS.INC
// Description: Base64 encoded images for pushpins // Description: Base64 encoded images for pushpins
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_pushpins.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_pushpins.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class ImgData_PushPins extends ImgData class ImgData_PushPins extends ImgData
@ -21,7 +21,7 @@ class ImgData_PushPins extends ImgData
protected $imgdata_large; protected $imgdata_large;
protected $imgdata_small ; protected $imgdata_small ;
public function ImgData_PushPins() public function __construct()
{ {
// The anchor should be where the needle "hits" the paper // The anchor should be where the needle "hits" the paper

View file

@ -3,9 +3,9 @@
// File: IMGDATA_SQUARES.INC // File: IMGDATA_SQUARES.INC
// Description: Base64 encoded images for squares // Description: Base64 encoded images for squares
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_squares.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_squares.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class ImgData_Squares extends ImgData class ImgData_Squares extends ImgData

View file

@ -3,9 +3,9 @@
// File: IMGDATA_STARS.INC // File: IMGDATA_STARS.INC
// Description: Base64 encoded images for stars // Description: Base64 encoded images for stars
// Created: 2003-03-20 // Created: 2003-03-20
// Ver: $Id: imgdata_stars.inc.php 860 2007-03-23 19:16:19Z ljp $ // Ver: $Id: imgdata_stars.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
@ -20,7 +20,7 @@ class ImgData_Stars extends ImgData
protected $maxidx = 7 ; protected $maxidx = 7 ;
protected $imgdata ; protected $imgdata ;
public function ImgData_Stars() public function __construct()
{ {
//========================================================== //==========================================================
// File: bstar_green_001.png // File: bstar_green_001.png

View file

@ -3,13 +3,12 @@
// File: JPG-CONFIG.INC // File: JPG-CONFIG.INC
// Description: Configuration file for JpGraph library // Description: Configuration file for JpGraph library
// Created: 2004-03-27 // Created: 2004-03-27
// Ver: $Id: jpg-config.inc.php 781 2006-10-08 08:07:47Z 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.
//======================================================================== //========================================================================
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Directories for cache and font directory. // Directories for cache and font directory.
// //
@ -27,8 +26,8 @@
// //
// UNIX: // UNIX:
// CACHE_DIR /tmp/jpgraph_cache/ // CACHE_DIR /tmp/jpgraph_cache/
// TTF_DIR /usr/X11R6/lib/X11/fonts/truetype/ // TTF_DIR /usr/share/fonts/truetype/
// MBTTF_DIR /usr/share/fonts/ja/TrueType/ // MBTTF_DIR /usr/share/fonts/truetype/
// //
// WINDOWS: // WINDOWS:
// CACHE_DIR $SERVER_TEMP/jpgraph_cache/ // CACHE_DIR $SERVER_TEMP/jpgraph_cache/
@ -36,9 +35,9 @@
// MBTTF_DIR $SERVER_SYSTEMROOT/fonts/ // MBTTF_DIR $SERVER_SYSTEMROOT/fonts/
// //
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// DEFINE("CACHE_DIR","/tmp/jpgraph_cache/"); // define('CACHE_DIR','/tmp/jpgraph_cache/');
// DEFINE("TTF_DIR","/usr/X11R6/lib/X11/fonts/truetype/"); // define('TTF_DIR','/usr/share/fonts/TrueType/');
// DEFINE("MBTTF_DIR","/usr/share/fonts/ja/TrueType/"); // define('MBTTF_DIR','/usr/share/fonts/TrueType/');
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Cache directory specification for use with CSIM graphs that are // Cache directory specification for use with CSIM graphs that are
@ -51,70 +50,8 @@
// Note: The default setting is to create a subdirectory in the // Note: The default setting is to create a subdirectory in the
// directory from where the image script is executed and store all files // directory from where the image script is executed and store all files
// there. As ususal this directory must be writeable by the PHP process. // there. As ususal this directory must be writeable by the PHP process.
DEFINE("CSIMCACHE_DIR", "csimcache/"); define('CSIMCACHE_DIR', 'csimcache/');
DEFINE("CSIMCACHE_HTTP_DIR", "csimcache/"); define('CSIMCACHE_HTTP_DIR', 'csimcache/');
//------------------------------------------------------------------------
// Defines for font setup
//------------------------------------------------------------------------
// Actual name of the TTF file used together with FF_CHINESE aka FF_BIG5
// This is the TTF file being used when the font family is specified as
// either FF_CHINESE or FF_BIG5
DEFINE('CHINESE_TTF_FONT', 'bkai00mp.ttf');
// Special unicode greek language support
DEFINE("LANGUAGE_GREEK", false);
// If you are setting this config to true the conversion of greek characters
// will assume that the input text is windows 1251
DEFINE("GREEK_FROM_WINDOWS", false);
// Special unicode cyrillic language support
DEFINE("LANGUAGE_CYRILLIC", false);
// If you are setting this config to true the conversion
// will assume that the input text is windows 1251, if
// false it will assume koi8-r
DEFINE("CYRILLIC_FROM_WINDOWS", false);
// The following constant is used to auto-detect
// whether cyrillic conversion is really necessary
// if enabled. Just replace 'windows-1251' with a variable
// containing the input character encoding string
// of your application calling jpgraph.
// A typical such string would be 'UTF-8' or 'utf-8'.
// The comparison is case-insensitive.
// If this charset is not a 'koi8-r' or 'windows-1251'
// derivate then no conversion is done.
//
// This constant can be very important in multi-user
// multi-language environments where a cyrillic conversion
// could be needed for some cyrillic people
// and resulting in just erraneous conversions
// for not-cyrillic language based people.
//
// Example: In the free project management
// software dotproject.net $locale_char_set is dynamically
// set by the language environment the user has chosen.
//
// Usage: DEFINE('LANGUAGE_CHARSET', $locale_char_set);
//
// where $locale_char_set is a GLOBAL (string) variable
// from the application including JpGraph.
//
DEFINE('LANGUAGE_CHARSET', null);
// Japanese TrueType font used with FF_MINCHO, FF_PMINCHO, FF_GOTHIC, FF_PGOTHIC
DEFINE('MINCHO_TTF_FONT', 'ipam.ttf');
DEFINE('PMINCHO_TTF_FONT', 'ipamp.ttf');
DEFINE('GOTHIC_TTF_FONT', 'ipag.ttf');
DEFINE('PGOTHIC_TTF_FONT', 'ipagp.ttf');
// Assume that Japanese text have been entered in EUC-JP encoding.
// If this define is true then conversion from EUC-JP to UTF8 is done
// automatically in the library using the mbstring module in PHP.
DEFINE('ASSUME_EUCJP_ENCODING', false);
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Various JpGraph Settings. Adjust accordingly to your // Various JpGraph Settings. Adjust accordingly to your
@ -124,12 +61,12 @@ DEFINE('ASSUME_EUCJP_ENCODING', false);
// Deafult locale for error messages. // Deafult locale for error messages.
// This defaults to English = 'en' // This defaults to English = 'en'
DEFINE('DEFAULT_ERR_LOCALE', 'en'); define('DEFAULT_ERR_LOCALE', 'en');
// Deafult graphic format set to "auto" which will automatically // Deafult graphic format set to 'auto' which will automatically
// choose the best available format in the order png,gif,jpeg // choose the best available format in the order png,gif,jpeg
// (The supported format depends on what your PHP installation supports) // (The supported format depends on what your PHP installation supports)
DEFINE("DEFAULT_GFORMAT", "auto"); define('DEFAULT_GFORMAT', 'auto');
// Should the cache be used at all? By setting this to false no // Should the cache be used at all? By setting this to false no
// files will be generated in the cache directory. // files will be generated in the cache directory.
@ -137,88 +74,63 @@ DEFINE("DEFAULT_GFORMAT", "auto");
// false will still create the image in the cache directory // false will still create the image in the cache directory
// just not use it. By setting USE_CACHE=false no files will even // just not use it. By setting USE_CACHE=false no files will even
// be generated in the cache directory. // be generated in the cache directory.
DEFINE("USE_CACHE", false); define('USE_CACHE', false);
// Should we try to find an image in the cache before generating it? // Should we try to find an image in the cache before generating it?
// Set this define to false to bypass the reading of the cache and always // Set this define to false to bypass the reading of the cache and always
// regenerate the image. Note that even if reading the cache is // regenerate the image. Note that even if reading the cache is
// disabled the cached will still be updated with the newly generated // disabled the cached will still be updated with the newly generated
// image. Set also "USE_CACHE" below. // image. Set also 'USE_CACHE' below.
DEFINE("READ_CACHE", true); define('READ_CACHE', true);
// Determine if the error handler should be image based or purely // Determine if the error handler should be image based or purely
// text based. Image based makes it easier since the script will // text based. Image based makes it easier since the script will
// always return an image even in case of errors. // always return an image even in case of errors.
DEFINE("USE_IMAGE_ERROR_HANDLER", true); define('USE_IMAGE_ERROR_HANDLER', true);
// Should the library examin the global php_errmsg string and convert // Should the library examine the global php_errmsg string and convert
// any error in it to a graphical representation. This is handy for the // any error in it to a graphical representation. This is handy for the
// occasions when, for example, header files cannot be found and this results // occasions when, for example, header files cannot be found and this results
// in the graph not being created and just a "red-cross" image would be seen. // in the graph not being created and just a 'red-cross' image would be seen.
// This should be turned off for a production site. // This should be turned off for a production site.
DEFINE("CATCH_PHPERRMSG", true); define('CATCH_PHPERRMSG', true);
// Determine if the library should also setup the default PHP // Determine if the library should also setup the default PHP
// error handler to generate a graphic error mesage. This is useful // error handler to generate a graphic error mesage. This is useful
// during development to be able to see the error message as an image // during development to be able to see the error message as an image
// instead as a "red-cross" in a page where an image is expected. // instead as a 'red-cross' in a page where an image is expected.
DEFINE("INSTALL_PHP_ERR_HANDLER", false); define('INSTALL_PHP_ERR_HANDLER', false);
// If the color palette is full should JpGraph try to allocate
// the closest match? If you plan on using background images or
// gradient fills it might be a good idea to enable this.
// If not you will otherwise get an error saying that the color palette is
// exhausted. The drawback of using approximations is that the colors
// might not be exactly what you specified.
// Note1: This does only apply to paletted images, not truecolor
// images since they don't have the limitations of maximum number
// of colors.
DEFINE("USE_APPROX_COLORS", true);
// Should usage of deprecated functions and parameters give a fatal error? // Should usage of deprecated functions and parameters give a fatal error?
// (Useful to check if code is future proof.) // (Useful to check if code is future proof.)
DEFINE("ERR_DEPRECATED", true); define('ERR_DEPRECATED', true);
// Should the time taken to generate each picture be branded to the lower // The builtin GD function imagettfbbox() fuction which calculates the bounding box for
// left in corner in each generated image? Useful for performace measurements // text using TTF fonts is buggy. By setting this define to true the library
// generating graphs // uses its own compensation for this bug. However this will give a
DEFINE("BRAND_TIMING", false); // slightly different visual apparance than not using this compensation.
// Enabling this compensation will in general give text a bit more space to more
// What format should be used for the timing string? // truly reflect the actual bounding box which is a bit larger than what the
DEFINE("BRAND_TIME_FORMAT", "(%01.3fs)"); // GD function thinks.
define('USE_LIBRARY_IMAGETTFBBOX', true);
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// The following constants should rarely have to be changed ! // The following constants should rarely have to be changed !
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// What group should the cached file belong to // What group should the cached file belong to
// (Set to "" will give the default group for the "PHP-user") // (Set to '' will give the default group for the 'PHP-user')
// Please note that the Apache user must be a member of the // Please note that the Apache user must be a member of the
// specified group since otherwise it is impossible for Apache // specified group since otherwise it is impossible for Apache
// to set the specified group. // to set the specified group.
DEFINE("CACHE_FILE_GROUP", "wwwadmin"); define('CACHE_FILE_GROUP', 'www');
// What permissions should the cached file have // What permissions should the cached file have
// (Set to "" will give the default persmissions for the "PHP-user") // (Set to '' will give the default persmissions for the 'PHP-user')
DEFINE("CACHE_FILE_MOD", 0664); define('CACHE_FILE_MOD', 0664);
// Decide if we should use the bresenham circle algorithm or the // Default theme class name
// built in Arc(). Bresenham gives better visual apperance of circles define('DEFAULT_THEME_CLASS', 'UniversalTheme');
// 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);
// Special file name to indicate that we only want to calc define('SUPERSAMPLING', true);
// the image map in the call to Graph::Stroke() used define('SUPERSAMPLING_SCALE', 1);
// internally from the GetHTMLCSIM() method.
DEFINE("_CSIM_SPECIALFILE", "_csim_special_");
// HTTP GET argument that is used with image map
// to indicate to the script to just generate the image
// and not the full CSIM HTML page.
DEFINE("_CSIM_DISPLAY", "_jpg_csimd");
// Special filename for Graph::Stroke(). If this filename is given
// then the image will NOT be streamed to browser of file. Instead the
// Stroke call will return the handler for the created GD image.
DEFINE("_IMG_HANDLER", "__handle");

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_ANTISPAM.PHP // File: JPGRAPH_ANTISPAM.PHP
// Description: Genarate anti-spam challenge // Description: Genarate anti-spam challenge
// Created: 2004-10-07 // Created: 2004-10-07
// Ver: $Id: jpgraph_antispam-digits.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_antispam-digits.php 1930 2010-01-22 20:19:27Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class HandDigits class HandDigits
@ -14,7 +14,7 @@ class HandDigits
public $iHeight=30; public $iHeight=30;
public $iWidth=30; public $iWidth=30;
public function HandDigits() public function __construct()
{ {
//========================================================== //==========================================================
// d6-small.jpg // d6-small.jpg
@ -157,9 +157,9 @@ class HandDigits
class AntiSpam class AntiSpam
{ {
public $iNumber=''; private $iNumber='';
public function AntiSpam($aNumber='') public function __construct($aNumber='')
{ {
$this->iNumber = $aNumber; $this->iNumber = $aNumber;
} }

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_ANTISPAM.PHP // File: JPGRAPH_ANTISPAM.PHP
// Description: Genarate anti-spam challenge // Description: Genarate anti-spam challenge
// Created: 2004-10-07 // Created: 2004-10-07
// Ver: $Id: jpgraph_antispam.php 808 2006-11-28 19:10:40Z ljp $ // Ver: $Id: jpgraph_antispam.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
class HandDigits class HandDigits
@ -14,7 +14,7 @@ class HandDigits
public $iHeight=30; public $iHeight=30;
public $iWidth=30; public $iWidth=30;
public function HandDigits() public function __construct()
{ {
//========================================================== //==========================================================
@ -548,7 +548,7 @@ class AntiSpam
private $iData=''; private $iData='';
private $iDD=null; private $iDD=null;
public function AntiSpam($aData='') public function __construct($aData='')
{ {
$this->iData = $aData; $this->iData = $aData;
$this->iDD = new HandDigits(); $this->iDD = new HandDigits();

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_BAR.PHP // File: JPGRAPH_BAR.PHP
// Description: Bar plot extension for JpGraph // Description: Bar plot extension for JpGraph
// Created: 2001-01-08 // Created: 2001-01-08
// Ver: $Id: jpgraph_bar.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_bar.php 1905 2009-10-06 18:00:21Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -48,12 +48,15 @@ class BarPlot extends Plot
protected $bar_shadow_color="black"; protected $bar_shadow_color="black";
protected $bar_shadow_hsize=3; protected $bar_shadow_hsize=3;
protected $bar_shadow_vsize=3; protected $bar_shadow_vsize=3;
protected $bar_3d=false;
protected $bar_3d_hsize=3;
protected $bar_3d_vsize=3;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function BarPlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
$this->Plot($datay, $datax); parent::__construct($datay, $datax);
++$this->numpoints; ++$this->numpoints;
} }
@ -61,15 +64,24 @@ class BarPlot extends Plot
// PUBLIC METHODS // PUBLIC METHODS
// Set a drop shadow for the bar (or rather an "up-right" shadow) // Set a drop shadow for the bar (or rather an "up-right" shadow)
public function SetShadow($color="black", $hsize=3, $vsize=3, $show=true) public function SetShadow($aColor="black", $aHSize=3, $aVSize=3, $aShow=true)
{ {
$this->bar_shadow=$show; $this->bar_shadow=$aShow;
$this->bar_shadow_color=$color; $this->bar_shadow_color=$aColor;
$this->bar_shadow_vsize=$vsize; $this->bar_shadow_vsize=$aVSize;
$this->bar_shadow_hsize=$hsize; $this->bar_shadow_hsize=$aHSize;
// Adjust the value margin to compensate for shadow // Adjust the value margin to compensate for shadow
$this->value->margin += $vsize; $this->value->margin += $aVSize;
}
public function Set3D($aHSize=3, $aVSize=3, $aShow=true)
{
$this->bar_3d=$aShow;
$this->bar_3d_vsize=$aVSize;
$this->bar_3d_hsize=$aHSize;
$this->value->margin += $aVSize;
} }
// DEPRECATED use SetYBase instead // DEPRECATED use SetYBase instead
@ -85,6 +97,20 @@ class BarPlot extends Plot
$this->ybase=$aYStartValue; $this->ybase=$aYStartValue;
} }
// The method will take the specified pattern anre
// return a pattern index that corresponds to the original
// patterm being rotated 90 degreees. This is needed when plottin
// Horizontal bars
public function RotatePattern($aPat, $aRotate=true)
{
$rotate = array(1 => 2, 2 => 1, 3 => 3, 4 => 5, 5 => 4, 6 => 6, 7 => 7, 8 => 8);
if ($aRotate) {
return $rotate[$aPat];
} else {
return $aPat;
}
}
public function Legend($graph) public function Legend($graph)
{ {
if ($this->grad && $this->legend!="" && !$this->fill) { if ($this->grad && $this->legend!="" && !$this->fill) {
@ -101,14 +127,17 @@ class BarPlot extends Plot
); );
} elseif ($this->legend!="" && ($this->iPattern > -1 || is_array($this->iPattern))) { } elseif ($this->legend!="" && ($this->iPattern > -1 || is_array($this->iPattern))) {
if (is_array($this->iPattern)) { if (is_array($this->iPattern)) {
$p1 = $this->iPattern[0]; $p1 = $this->RotatePattern($this->iPattern[0], $graph->img->a == 90);
$p2 = $this->iPatternColor[0]; $p2 = $this->iPatternColor[0];
$p3 = $this->iPatternDensity[0]; $p3 = $this->iPatternDensity[0];
} else { } else {
$p1 = $this->iPattern; $p1 = $this->RotatePattern($this->iPattern, $graph->img->a == 90);
$p2 = $this->iPatternColor; $p2 = $this->iPatternColor;
$p3 = $this->iPatternDensity; $p3 = $this->iPatternDensity;
} }
if ($p3 < 90) {
$p3 += 5;
}
$color = array($p1,$p2,$p3,$this->fill_color); $color = array($p1,$p2,$p3,$this->fill_color);
// A kludge: Too mark that we add a pattern we use a type value of < 100 // A kludge: Too mark that we add a pattern we use a type value of < 100
$graph->legend->Add( $graph->legend->Add(
@ -180,7 +209,7 @@ class BarPlot extends Plot
if ($this->abswidth == -1) { if ($this->abswidth == -1) {
// Not set // Not set
// set width to a visuable sensible default // set width to a visuable sensible default
$this->abswidth = $graph->img->plotwidth/(2*count($this->coords[0])); $this->abswidth = $graph->img->plotwidth/(2*$this->numpoints);
} }
} }
} }
@ -235,6 +264,11 @@ class BarPlot extends Plot
public function SetFillColor($aColor) public function SetFillColor($aColor)
{ {
// Do an extra error check if the color is specified as an RGB array triple
// In that case convert it to a hex string since it will otherwise be
// interpretated as an array of colors for each individual bar.
$aColor = RGB::tryHexConversion($aColor);
$this->fill = true ; $this->fill = true ;
$this->fill_color=$aColor; $this->fill_color=$aColor;
} }
@ -261,7 +295,7 @@ class BarPlot extends Plot
if (is_array($aColor)) { if (is_array($aColor)) {
$this->iPatternColor = array(); $this->iPatternColor = array();
if (count($aColor) != $n) { if (count($aColor) != $n) {
JpGraphError::Raise('NUmber of colors is not the same as the number of patterns in BarPlot::SetPattern()'); JpGraphError::RaiseL(2001);//('NUmber of colors is not the same as the number of patterns in BarPlot::SetPattern()');
} }
} else { } else {
$this->iPatternColor = $aColor; $this->iPatternColor = $aColor;
@ -283,19 +317,19 @@ class BarPlot extends Plot
switch ($aPattern) { switch ($aPattern) {
case PATTERN_DIAG1: case PATTERN_DIAG1:
$aPatternValue= 1; $aPatternValue= 1;
$aDensity = 90; $aDensity = 92;
break; break;
case PATTERN_DIAG2: case PATTERN_DIAG2:
$aPatternValue= 1; $aPatternValue= 1;
$aDensity = 75; $aDensity = 78;
break; break;
case PATTERN_DIAG3: case PATTERN_DIAG3:
$aPatternValue= 2; $aPatternValue= 2;
$aDensity = 90; $aDensity = 92;
break; break;
case PATTERN_DIAG4: case PATTERN_DIAG4:
$aPatternValue= 2; $aPatternValue= 2;
$aDensity = 75; $aDensity = 78;
break; break;
case PATTERN_CROSS1: case PATTERN_CROSS1:
$aPatternValue= 8; $aPatternValue= 8;
@ -315,23 +349,37 @@ class BarPlot extends Plot
break; break;
case PATTERN_STRIPE1: case PATTERN_STRIPE1:
$aPatternValue= 5; $aPatternValue= 5;
$aDensity = 90; $aDensity = 94;
break; break;
case PATTERN_STRIPE2: case PATTERN_STRIPE2:
$aPatternValue= 5; $aPatternValue= 5;
$aDensity = 75; $aDensity = 85;
break; break;
default: default:
JpGraphError::Raise('Unknown pattern specified in call to BarPlot::SetPattern()'); JpGraphError::RaiseL(2002);
//('Unknown pattern specified in call to BarPlot::SetPattern()');
} }
} }
/**
* @override
* Without overriding this method, $this->numpoints does not updated correctly.
*/
public function Clear()
{
$this->isRunningClear = true;
$this->__construct($this->inputValues['aDatay'], $this->inputValues['aDatax']);
$this->isRunningClear = false;
}
public function Stroke($img, $xscale, $yscale) public function Stroke($img, $xscale, $yscale)
{ {
$numpoints = count($this->coords[0]); $numpoints = count($this->coords[0]);
if (isset($this->coords[1])) { if (isset($this->coords[1])) {
if (count($this->coords[1])!=$numpoints) { if (count($this->coords[1])!=$numpoints) {
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints"); JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints);
//"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints");
} else { } else {
$exist_x = true; $exist_x = true;
} }
@ -411,6 +459,10 @@ class BarPlot extends Plot
$fromcolor = $this->grad_fromcolor; $fromcolor = $this->grad_fromcolor;
$tocolor = $this->grad_tocolor; $tocolor = $this->grad_tocolor;
$style = $this->grad_style; $style = $this->grad_style;
} else {
$fromcolor = $this->grad_fromcolor[$i % $ng][0];
$tocolor = $this->grad_fromcolor[$i % $ng][1];
$style = $this->grad_fromcolor[$i % $ng][2];
} }
} else { } else {
$fromcolor = $this->grad_fromcolor[$i % $ng][0]; $fromcolor = $this->grad_fromcolor[$i % $ng][0];
@ -447,12 +499,14 @@ class BarPlot extends Plot
$img->PopColor(); $img->PopColor();
} }
/////////////////////////kokorahen rectangle polygon//////////////////////
// Remember value of this bar // Remember value of this bar
$val=$this->coords[0][$i]; $val=$this->coords[0][$i];
if (!empty($val) && !is_numeric($val)) { if (!empty($val) && !is_numeric($val)) {
JpGraphError::Raise('All values for a barplot must be numeric. You have specified value['.$i.'] == \''.$val.'\''); JpGraphError::RaiseL(2004, $i, $val);
//'All values for a barplot must be numeric. You have specified value['.$i.'] == \''.$val.'\'');
} }
// Determine the shadow // Determine the shadow
@ -490,7 +544,7 @@ class BarPlot extends Plot
if (is_array($this->bar_shadow_color)) { if (is_array($this->bar_shadow_color)) {
$numcolors = count($this->bar_shadow_color); $numcolors = count($this->bar_shadow_color);
if ($numcolors == 0) { if ($numcolors == 0) {
JpGraphError::Raise('You have specified an empty array for shadow colors in the bar plot.'); JpGraphError::RaiseL(2005);//('You have specified an empty array for shadow colors in the bar plot.');
} }
$img->PushColor($this->bar_shadow_color[$i % $numcolors]); $img->PushColor($this->bar_shadow_color[$i % $numcolors]);
} else { } else {
@ -498,6 +552,60 @@ class BarPlot extends Plot
} }
$img->FilledPolygon($sp); $img->FilledPolygon($sp);
$img->PopColor(); $img->PopColor();
} elseif ($this->bar_3d && $val != 0) {
// Determine the 3D
$ssh = $this->bar_3d_hsize;
$ssv = $this->bar_3d_vsize;
// Create points to create a "upper-right" shadow
if ($val > 0) {
$sp1[0]=$pts[6];
$sp1[1]=$pts[7];
$sp1[2]=$pts[4];
$sp1[3]=$pts[5];
$sp1[4]=$pts[4]+$ssh;
$sp1[5]=$pts[5]-$ssv;
$sp1[6]=$pts[6]+$ssh;
$sp1[7]=$pts[7]-$ssv;
$sp2[0]=$pts[4];
$sp2[1]=$pts[5];
$sp2[2]=$pts[2];
$sp2[3]=$pts[3];
$sp2[4]=$pts[2]+$ssh;
$sp2[5]=$pts[3]-$ssv;
$sp2[6]=$pts[4]+$ssh;
$sp2[7]=$pts[5]-$ssv;
} elseif ($val < 0) {
$sp1[0]=$pts[4];
$sp1[1]=$pts[5];
$sp1[2]=$pts[6];
$sp1[3]=$pts[7];
$sp1[4]=$pts[6]+$ssh;
$sp1[5]=$pts[7]-$ssv;
$sp1[6]=$pts[4]+$ssh;
$sp1[7]=$pts[5]-$ssv;
$sp2[0]=$pts[6];
$sp2[1]=$pts[7];
$sp2[2]=$pts[0];
$sp2[3]=$pts[1];
$sp2[4]=$pts[0]+$ssh;
$sp2[5]=$pts[1]-$ssv;
$sp2[6]=$pts[6]+$ssh;
$sp2[7]=$pts[7]-$ssv;
}
$base_color = $this->fill_color;
$img->PushColor($base_color . ':0.7');
$img->FilledPolygon($sp1);
$img->PopColor();
$img->PushColor($base_color . ':1.1');
$img->FilledPolygon($sp2);
$img->PopColor();
} }
// Stroke the pattern // Stroke the pattern
@ -540,6 +648,7 @@ class BarPlot extends Plot
$prect->Stroke($img); $prect->Stroke($img);
} }
} }
// Stroke the outline of the bar // Stroke the outline of the bar
if (is_array($this->color)) { if (is_array($this->color)) {
$img->SetColor($this->color[$i % count($this->color)]); $img->SetColor($this->color[$i % count($this->color)]);
@ -557,6 +666,8 @@ class BarPlot extends Plot
// Determine how to best position the values of the individual bars // Determine how to best position the values of the individual bars
$x=$pts[2]+($pts[4]-$pts[2])/2; $x=$pts[2]+($pts[4]-$pts[2])/2;
$this->value->SetMargin(5);
if ($this->valuepos=='top') { if ($this->valuepos=='top') {
$y=$pts[3]; $y=$pts[3];
if ($img->a === 90) { if ($img->a === 90) {
@ -565,6 +676,14 @@ class BarPlot extends Plot
} else { } else {
$this->value->SetAlign('left', 'center'); $this->value->SetAlign('left', 'center');
} }
} else {
if ($val < 0) {
$this->value->SetMargin(-5);
$y=$pts[1];
$this->value->SetAlign('center', 'bottom');
} else {
$this->value->SetAlign('center', 'bottom');
}
} }
$this->value->Stroke($img, $val, $x, $y); $this->value->Stroke($img, $val, $x, $y);
} elseif ($this->valuepos=='max') { } elseif ($this->valuepos=='max') {
@ -575,10 +694,14 @@ class BarPlot extends Plot
} else { } else {
$this->value->SetAlign('right', 'center'); $this->value->SetAlign('right', 'center');
} }
} else {
if ($val < 0) {
$this->value->SetAlign('center', 'bottom');
} else { } else {
$this->value->SetAlign('center', 'top'); $this->value->SetAlign('center', 'top');
} }
$this->value->SetMargin(-3); }
$this->value->SetMargin(-5);
$this->value->Stroke($img, $val, $x, $y); $this->value->Stroke($img, $val, $x, $y);
} elseif ($this->valuepos=='center') { } elseif ($this->valuepos=='center') {
$y = ($pts[3] + $pts[1])/2; $y = ($pts[3] + $pts[1])/2;
@ -597,7 +720,8 @@ class BarPlot extends Plot
$this->value->SetMargin(3); $this->value->SetMargin(3);
$this->value->Stroke($img, $val, $x, $y); $this->value->Stroke($img, $val, $x, $y);
} else { } else {
JpGraphError::Raise('Unknown position for values on bars :'.$this->valuepos); JpGraphError::RaiseL(2006, $this->valuepos);
//'Unknown position for values on bars :'.$this->valuepos);
} }
// Create the client side image map // Create the client side image map
$rpts = $img->ArrRotate($pts); $rpts = $img->ArrRotate($pts);
@ -631,21 +755,21 @@ class BarPlot extends Plot
//=================================================== //===================================================
class GroupBarPlot extends BarPlot class GroupBarPlot extends BarPlot
{ {
private $plots; public $plots;
private $nbrplots=0; private $nbrplots=0;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function GroupBarPlot($plots) public function __construct($plots)
{ {
$this->width=0.7; $this->width=0.7;
$this->plots = $plots; $this->plots = $plots;
$this->nbrplots = count($plots); $this->nbrplots = count($plots);
if ($this->nbrplots < 1) { if ($this->nbrplots < 1) {
JpGraphError::Raise('Cannot create GroupBarPlot from empty plot array.'); JpGraphError::RaiseL(2007);//('Cannot create GroupBarPlot from empty plot array.');
} }
for ($i=0; $i < $this->nbrplots; ++$i) { for ($i=0; $i < $this->nbrplots; ++$i) {
if (empty($this->plots[$i]) || !isset($this->plots[$i])) { if (empty($this->plots[$i]) || !isset($this->plots[$i])) {
JpGraphError::Raise("Group bar plot element nbr $i is undefined or empty."); JpGraphError::RaiseL(2008, $i);//("Group bar plot element nbr $i is undefined or empty.");
} }
} }
$this->numpoints = $plots[0]->numpoints; $this->numpoints = $plots[0]->numpoints;
@ -660,7 +784,8 @@ class GroupBarPlot extends BarPlot
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
$c = get_class($this->plots[$i]); $c = get_class($this->plots[$i]);
if (!($this->plots[$i] instanceof BarPlot)) { if (!($this->plots[$i] instanceof BarPlot)) {
JpGraphError::Raise('One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the Group Bar plot from an array of BarPlot or AccBarPlot objects. (Class = '.$c.')'); JpGraphError::RaiseL(2009, $c);
//('One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the Group Bar plot from an array of BarPlot or AccBarPlot objects. (Class = '.$c.')');
} }
$this->plots[$i]->DoLegend($graph); $this->plots[$i]->DoLegend($graph);
} }
@ -672,7 +797,7 @@ class GroupBarPlot extends BarPlot
$n = count($this->plots); $n = count($this->plots);
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
list($xm, $ym) = $this->plots[$i]->Min(); list($xm, $ym) = $this->plots[$i]->Min();
$xmin = max($xmin, $xm); $xmin = min($xmin, $xm);
$ymin = min($ymin, $ym); $ymin = min($ymin, $ym);
} }
return array($xmin,$ymin); return array($xmin,$ymin);
@ -729,22 +854,35 @@ class GroupBarPlot extends BarPlot
//=================================================== //===================================================
class AccBarPlot extends BarPlot class AccBarPlot extends BarPlot
{ {
private $plots=null; public $plots=null;
private $nbrplots=0; private $nbrplots=0;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function AccBarPlot($plots) public function __construct($plots)
{ {
$this->plots = $plots; $this->plots = $plots;
$this->nbrplots = count($plots); $this->nbrplots = count($plots);
if ($this->nbrplots < 1) { if ($this->nbrplots < 1) {
JpGraphError::Raise('Cannot create AccBarPlot from empty plot array.'); JpGraphError::RaiseL(2010);//('Cannot create AccBarPlot from empty plot array.');
} }
for ($i=0; $i < $this->nbrplots; ++$i) { for ($i=0; $i < $this->nbrplots; ++$i) {
if (empty($this->plots[$i]) || !isset($this->plots[$i])) { if (empty($this->plots[$i]) || !isset($this->plots[$i])) {
JpGraphError::Raise("Acc bar plot element nbr $i is undefined or empty."); JpGraphError::RaiseL(2011, $i);//("Acc bar plot element nbr $i is undefined or empty.");
} }
} }
// We can only allow individual plost which do not have specified X-positions
for ($i=0; $i < $this->nbrplots; ++$i) {
if (!empty($this->plots[$i]->coords[1])) {
JpGraphError::RaiseL(2015);
//'Individual bar plots in an AccBarPlot or GroupBarPlot can not have specified X-positions.');
}
}
// Use 0 weight by default which means that the individual bar
// weights will be used per part n the accumulated bar
$this->SetWeight(0);
$this->numpoints = $plots[0]->numpoints; $this->numpoints = $plots[0]->numpoints;
$this->value = new DisplayValue(); $this->value = new DisplayValue();
} }
@ -757,7 +895,8 @@ class AccBarPlot extends BarPlot
for ($i=$n-1; $i >= 0; --$i) { for ($i=$n-1; $i >= 0; --$i) {
$c = get_class($this->plots[$i]); $c = get_class($this->plots[$i]);
if (!($this->plots[$i] instanceof BarPlot)) { if (!($this->plots[$i] instanceof BarPlot)) {
JpGraphError::Raise('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects.(Class='.$c.')'); JpGraphError::RaiseL(2012, $c);
//('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects.(Class='.$c.')');
} }
$this->plots[$i]->DoLegend($graph); $this->plots[$i]->DoLegend($graph);
} }
@ -846,6 +985,7 @@ class AccBarPlot extends BarPlot
{ {
$pattern=null; $pattern=null;
$img->SetLineWeight($this->weight); $img->SetLineWeight($this->weight);
$grad=null;
for ($i=0; $i < $this->numpoints-1; $i++) { for ($i=0; $i < $this->numpoints-1; $i++) {
$accy = 0; $accy = 0;
$accy_neg = 0; $accy_neg = 0;
@ -909,7 +1049,7 @@ class AccBarPlot extends BarPlot
if (is_array($this->bar_shadow_color)) { if (is_array($this->bar_shadow_color)) {
$numcolors = count($this->bar_shadow_color); $numcolors = count($this->bar_shadow_color);
if ($numcolors == 0) { if ($numcolors == 0) {
JpGraphError::Raise('You have specified an empty array for shadow colors in the bar plot.'); JpGraphError::RaiseL(2013);//('You have specified an empty array for shadow colors in the bar plot.');
} }
$img->PushColor($this->bar_shadow_color[$i % $numcolors]); $img->PushColor($this->bar_shadow_color[$i % $numcolors]);
} else { } else {
@ -944,7 +1084,43 @@ class AccBarPlot extends BarPlot
} }
if ($this->plots[$j]->grad) { if ($this->plots[$j]->grad) {
if ($grad === null) {
$grad = new Gradient($img); $grad = new Gradient($img);
}
if (is_array($this->plots[$j]->grad_fromcolor)) {
// The first argument (grad_fromcolor) can be either an array or a single color. If it is an array
// then we have two choices. It can either a) be a single color specified as an RGB triple or it can be
// an array to specify both (from, to style) for each individual bar. The way to know the difference is
// to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB
// triple.
$ng = count($this->plots[$j]->grad_fromcolor);
if ($ng === 3) {
if (is_numeric($this->plots[$j]->grad_fromcolor[0]) && $this->plots[$j]->grad_fromcolor[0] > 0 &&
$this->plots[$j]->grad_fromcolor[0] < 256) {
// RGB Triple
$fromcolor = $this->plots[$j]->grad_fromcolor;
$tocolor = $this->plots[$j]->grad_tocolor;
$style = $this->plots[$j]->grad_style;
} else {
$fromcolor = $this->plots[$j]->grad_fromcolor[$i % $ng][0];
$tocolor = $this->plots[$j]->grad_fromcolor[$i % $ng][1];
$style = $this->plots[$j]->grad_fromcolor[$i % $ng][2];
}
} else {
$fromcolor = $this->plots[$j]->grad_fromcolor[$i % $ng][0];
$tocolor = $this->plots[$j]->grad_fromcolor[$i % $ng][1];
$style = $this->plots[$j]->grad_fromcolor[$i % $ng][2];
}
$grad->FilledRectangle(
$pts[2],
$pts[3],
$pts[6],
$pts[7],
$fromcolor,
$tocolor,
$style
);
} else {
$grad->FilledRectangle( $grad->FilledRectangle(
$pts[2], $pts[2],
$pts[3], $pts[3],
@ -954,6 +1130,7 @@ class AccBarPlot extends BarPlot
$this->plots[$j]->grad_tocolor, $this->plots[$j]->grad_tocolor,
$this->plots[$j]->grad_style $this->plots[$j]->grad_style
); );
}
} else { } else {
if (is_array($this->plots[$j]->fill_color)) { if (is_array($this->plots[$j]->fill_color)) {
$numcolors = count($this->plots[$j]->fill_color); $numcolors = count($this->plots[$j]->fill_color);
@ -971,9 +1148,10 @@ class AccBarPlot extends BarPlot
if ($fillcolor !== false) { if ($fillcolor !== false) {
$img->FilledPolygon($pts); $img->FilledPolygon($pts);
} }
$img->SetColor($this->plots[$j]->color);
} }
$img->SetColor($this->plots[$j]->color);
// Stroke the pattern // Stroke the pattern
if ($this->plots[$j]->iPattern > -1) { if ($this->plots[$j]->iPattern > -1) {
if ($pattern===null) { if ($pattern===null) {
@ -1024,11 +1202,19 @@ class AccBarPlot extends BarPlot
$pts[] = $pts[0]; $pts[] = $pts[0];
$pts[] = $pts[1]; $pts[] = $pts[1];
$img->SetLineWeight($this->plots[$j]->line_weight); $img->SetLineWeight($this->plots[$j]->weight);
$img->Polygon($pts); $img->Polygon($pts);
$img->SetLineWeight(1); $img->SetLineWeight(1);
} }
// Daw potential bar around the entire accbar bar
if ($this->weight > 0) {
$y=$yscale->Translate(0);
$img->SetColor($this->color);
$img->SetLineWeight($this->weight);
$img->Rectangle($pts[0], $y, $pts[6], $pts[5]);
}
// Draw labels for each acc.bar // Draw labels for each acc.bar
$x=$pts[2]+($pts[4]-$pts[2])/2; $x=$pts[2]+($pts[4]-$pts[2])/2;
@ -1038,13 +1224,12 @@ class AccBarPlot extends BarPlot
// First stroke the accumulated value for the entire bar // First stroke the accumulated value for the entire bar
// This value is always placed at the top/bottom of the bars // 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); $y=$yscale->Translate($accy_neg);
$this->value->Stroke($img, $accy_neg, $x, $y);
} else { } else {
$y=$yscale->Translate($accy); $y=$yscale->Translate($accy);
$this->value->Stroke($img, $accy, $x, $y);
} }
$this->value->Stroke($img, $accy + $accy_neg, $x, $y);
$accy = 0; $accy = 0;
$accy_neg = 0; $accy_neg = 0;
@ -1098,7 +1283,7 @@ class AccBarPlot extends BarPlot
$this->plots[$j]->value->SetMargin(-1); $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));
} }
} }
return true; return true;

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_CANVAS.PHP // File: JPGRAPH_CANVAS.PHP
// Description: Canvas drawing extension for JpGraph // Description: Canvas drawing extension for JpGraph
// Created: 2001-01-08 // Created: 2001-01-08
// Ver: $Id: jpgraph_canvas.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_canvas.php 1923 2010-01-11 13:48:49Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -21,9 +21,9 @@ class CanvasGraph extends Graph
{ {
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function CanvasGraph($aWidth=300, $aHeight=200, $aCachedName="", $timeout=0, $inline=1) public function __construct($aWidth=300, $aHeight=200, $aCachedName="", $timeout=0, $inline=1)
{ {
$this->Graph($aWidth, $aHeight, $aCachedName, $timeout, $inline); parent::__construct($aWidth, $aHeight, $aCachedName, $timeout, $inline);
} }
//--------------- //---------------
@ -68,7 +68,7 @@ class CanvasGraph extends Graph
// Should we do any final image transformation // Should we do any final image transformation
if ($this->iImgTrans) { if ($this->iImgTrans) {
if (!class_exists('ImgTrans')) { if (!class_exists('ImgTrans', false)) {
require_once('jpgraph_imgtrans.php'); require_once('jpgraph_imgtrans.php');
} }

View file

@ -3,16 +3,16 @@
// File: JPGRAPH_CANVTOOLS.PHP // File: JPGRAPH_CANVTOOLS.PHP
// Description: Some utilities for text and shape drawing on a canvas // Description: Some utilities for text and shape drawing on a canvas
// Created: 2002-08-23 // Created: 2002-08-23
// Ver: $Id: jpgraph_canvtools.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_canvtools.php 1857 2009-09-28 14:38:14Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
DEFINE('CORNER_TOPLEFT', 0); define('CORNER_TOPLEFT', 0);
DEFINE('CORNER_TOPRIGHT', 1); define('CORNER_TOPRIGHT', 1);
DEFINE('CORNER_BOTTOMRIGHT', 2); define('CORNER_BOTTOMRIGHT', 2);
DEFINE('CORNER_BOTTOMLEFT', 3); define('CORNER_BOTTOMLEFT', 3);
//=================================================== //===================================================
@ -31,7 +31,7 @@ class CanvasScale
private $iymin=0; private $iymin=0;
private $iymax=10; private $iymax=10;
public function CanvasScale($graph, $xmin=0, $xmax=10, $ymin=0, $ymax=10) public function __construct($graph, $xmin=0, $xmax=10, $ymin=0, $ymax=10)
{ {
$this->g = $graph; $this->g = $graph;
$this->w = $graph->img->width; $this->w = $graph->img->width;
@ -50,6 +50,11 @@ class CanvasScale
$this->iymax = $ymax; $this->iymax = $ymax;
} }
public function Get()
{
return array($this->ixmin,$this->ixmax,$this->iymin,$this->iymax);
}
public function Translate($x, $y) public function Translate($x, $y)
{ {
$xp = round(($x-$this->ixmin)/($this->ixmax - $this->ixmin) * $this->w); $xp = round(($x-$this->ixmin)/($this->ixmax - $this->ixmin) * $this->w);
@ -80,7 +85,7 @@ class Shape
private $img; private $img;
private $scale; private $scale;
public function Shape($aGraph, $scale) public function __construct($aGraph, $scale)
{ {
$this->img = $aGraph->img; $this->img = $aGraph->img;
$this->img->SetColor('black'); $this->img->SetColor('black');
@ -99,6 +104,11 @@ class Shape
$this->img->Line($x1, $y1, $x2, $y2); $this->img->Line($x1, $y1, $x2, $y2);
} }
public function SetLineWeight($aWeight)
{
$this->img->SetLineWeight($aWeight);
}
public function Polygon($p, $aClosed=false) public function Polygon($p, $aClosed=false)
{ {
$n=count($p); $n=count($p);
@ -420,7 +430,7 @@ class CanvasRectangleText
private $iShadowWidth=3; private $iShadowWidth=3;
private $iShadowColor=''; private $iShadowColor='';
public function CanvasRectangleText($aTxt='', $xl=0, $yt=0, $w=0, $h=0) public function __construct($aTxt='', $xl=0, $yt=0, $w=0, $h=0)
{ {
$this->iTxt = new Text($aTxt); $this->iTxt = new Text($aTxt);
$this->ix = $xl; $this->ix = $xl;

View file

@ -0,0 +1,613 @@
<?php
/*=======================================================================
// File: JPGRAPH_CONTOUR.PHP
// Description: Contour plot
// Created: 2009-03-08
// Ver: $Id: jpgraph_contour.php 1870 2009-09-29 04:24:18Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
require_once('jpgraph_meshinterpolate.inc.php');
define('HORIZ_EDGE', 0);
define('VERT_EDGE', 1);
/**
* This class encapsulates the core contour plot algorithm. It will find the path
* of the specified isobars in the data matrix specified. It is assumed that the
* data matrix models an equspaced X-Y mesh of datavalues corresponding to the Z
* values.
*
*/
class Contour
{
private $dataPoints = array();
private $nbrCols=0;
private $nbrRows=0;
private $horizEdges = array();
private $vertEdges=array();
private $isobarValues = array();
private $stack = null;
private $isobarCoord = array();
private $nbrIsobars = 10;
private $isobarColors = array();
private $invert = true;
private $highcontrast = false;
private $highcontrastbw = false;
/**
* Create a new contour level "algorithm machine".
* @param $aMatrix The values to find the contour from
* @param $aIsobars Mixed. If integer it determines the number of isobars to be used. The levels are determined
* automatically as equdistance between the min and max value of the matrice.
* If $aIsobars is an array then this is interpretated as an array of values to be used as isobars in the
* contour plot.
* @return an instance of the contour algorithm
*/
public function __construct($aMatrix, $aIsobars=10, $aColors=null)
{
$this->nbrRows = count($aMatrix);
$this->nbrCols = count($aMatrix[0]);
$this->dataPoints = $aMatrix;
if (is_array($aIsobars)) {
// use the isobar values supplied
$this->nbrIsobars = count($aIsobars);
$this->isobarValues = $aIsobars;
} else {
// Determine the isobar values automatically
$this->nbrIsobars = $aIsobars;
list($min, $max) = $this->getMinMaxVal();
$stepSize = ($max-$min) / $aIsobars ;
$isobar = $min+$stepSize/2;
for ($i = 0; $i < $aIsobars; $i++) {
$this->isobarValues[$i] = $isobar;
$isobar += $stepSize;
}
}
if ($aColors !== null && count($aColors) > 0) {
if (!is_array($aColors)) {
JpGraphError::RaiseL(28001);
//'Third argument to Contour must be an array of colors.'
}
if (count($aColors) != count($this->isobarValues)) {
JpGraphError::RaiseL(28002);
//'Number of colors must equal the number of isobar lines specified';
}
$this->isobarColors = $aColors;
}
}
/**
* Flip the plot around the Y-coordinate. This has the same affect as flipping the input
* data matrice
*
* @param $aFlg If true the the vertice in input data matrice position (0,0) corresponds to the top left
* corner of teh plot otherwise it will correspond to the bottom left corner (a horizontal flip)
*/
public function SetInvert($aFlg=true)
{
$this->invert = $aFlg;
}
/**
* Find the min and max values in the data matrice
*
* @return array(min_value,max_value)
*/
public function getMinMaxVal()
{
$min = $this->dataPoints[0][0];
$max = $this->dataPoints[0][0];
for ($i = 0; $i < $this->nbrRows; $i++) {
if (($mi=min($this->dataPoints[$i])) < $min) {
$min = $mi;
}
if (($ma=max($this->dataPoints[$i])) > $max) {
$max = $ma;
}
}
return array($min,$max);
}
/**
* Reset the two matrices that keeps track on where the isobars crosses the
* horizontal and vertical edges
*/
public function resetEdgeMatrices()
{
for ($k = 0; $k < 2; $k++) {
for ($i = 0; $i <= $this->nbrRows; $i++) {
for ($j = 0; $j <= $this->nbrCols; $j++) {
$this->edges[$k][$i][$j] = false;
}
}
}
}
/**
* Determine if the specified isobar crosses the horizontal edge specified by its row and column
*
* @param $aRow Row index of edge to be checked
* @param $aCol Col index of edge to be checked
* @param $aIsobar Isobar value
* @return true if the isobar is crossing this edge
*/
public function isobarHCrossing($aRow, $aCol, $aIsobar)
{
if ($aCol >= $this->nbrCols-1) {
JpGraphError::RaiseL(28003, $aCol);
//'ContourPlot Internal Error: isobarHCrossing: Coloumn index too large (%d)'
}
if ($aRow >= $this->nbrRows) {
JpGraphError::RaiseL(28004, $aRow);
//'ContourPlot Internal Error: isobarHCrossing: Row index too large (%d)'
}
$v1 = $this->dataPoints[$aRow][$aCol];
$v2 = $this->dataPoints[$aRow][$aCol+1];
return ($aIsobar-$v1)*($aIsobar-$v2) < 0 ;
}
/**
* Determine if the specified isobar crosses the vertical edge specified by its row and column
*
* @param $aRow Row index of edge to be checked
* @param $aCol Col index of edge to be checked
* @param $aIsobar Isobar value
* @return true if the isobar is crossing this edge
*/
public function isobarVCrossing($aRow, $aCol, $aIsobar)
{
if ($aRow >= $this->nbrRows-1) {
JpGraphError::RaiseL(28005, $aRow);
//'isobarVCrossing: Row index too large
}
if ($aCol >= $this->nbrCols) {
JpGraphError::RaiseL(28006, $aCol);
//'isobarVCrossing: Col index too large
}
$v1 = $this->dataPoints[$aRow][$aCol];
$v2 = $this->dataPoints[$aRow+1][$aCol];
return ($aIsobar-$v1)*($aIsobar-$v2) < 0 ;
}
/**
* Determine all edges, horizontal and vertical that the specified isobar crosses. The crossings
* are recorded in the two edge matrices.
*
* @param $aIsobar The value of the isobar to be checked
*/
public function determineIsobarEdgeCrossings($aIsobar)
{
$ib = $this->isobarValues[$aIsobar];
for ($i = 0; $i < $this->nbrRows-1; $i++) {
for ($j = 0; $j < $this->nbrCols-1; $j++) {
$this->edges[HORIZ_EDGE][$i][$j] = $this->isobarHCrossing($i, $j, $ib);
$this->edges[VERT_EDGE][$i][$j] = $this->isobarVCrossing($i, $j, $ib);
}
}
// We now have the bottom and rightmost edges unsearched
for ($i = 0; $i < $this->nbrRows-1; $i++) {
$this->edges[VERT_EDGE][$i][$j] = $this->isobarVCrossing($i, $this->nbrCols-1, $ib);
}
for ($j = 0; $j < $this->nbrCols-1; $j++) {
$this->edges[HORIZ_EDGE][$i][$j] = $this->isobarHCrossing($this->nbrRows-1, $j, $ib);
}
}
/**
* Return the normalized coordinates for the crossing of the specified edge with the specified
* isobar- The crossing is simpy detrmined with a linear interpolation between the two vertices
* on each side of the edge and the value of the isobar
*
* @param $aRow Row of edge
* @param $aCol Column of edge
* @param $aEdgeDir Determine if this is a horizontal or vertical edge
* @param $ib The isobar value
* @return unknown_type
*/
public function getCrossingCoord($aRow, $aCol, $aEdgeDir, $aIsobarVal)
{
// In order to avoid numerical problem when two vertices are very close
// we have to check and avoid dividing by close to zero denumerator.
if ($aEdgeDir == HORIZ_EDGE) {
$d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow][$aCol+1]);
if ($d > 0.001) {
$xcoord = $aCol + abs($aIsobarVal - $this->dataPoints[$aRow][$aCol]) / $d;
} else {
$xcoord = $aCol;
}
$ycoord = $aRow;
} else {
$d = abs($this->dataPoints[$aRow][$aCol] - $this->dataPoints[$aRow+1][$aCol]);
if ($d > 0.001) {
$ycoord = $aRow + abs($aIsobarVal - $this->dataPoints[$aRow][$aCol]) / $d;
} else {
$ycoord = $aRow;
}
$xcoord = $aCol;
}
if ($this->invert) {
$ycoord = $this->nbrRows-1 - $ycoord;
}
return array($xcoord,$ycoord);
}
/**
* In order to avoid all kinds of unpleasent extra checks and complex boundary
* controls for the degenerated case where the contour levels exactly crosses
* one of the vertices we add a very small delta (0.1%) to the data point value.
* This has no visible affect but it makes the code sooooo much cleaner.
*
*/
public function adjustDataPointValues()
{
$ni = count($this->isobarValues);
for ($k = 0; $k < $ni; $k++) {
$ib = $this->isobarValues[$k];
for ($row = 0 ; $row < $this->nbrRows-1; ++$row) {
for ($col = 0 ; $col < $this->nbrCols-1; ++$col) {
if (abs($this->dataPoints[$row][$col] - $ib) < 0.0001) {
$this->dataPoints[$row][$col] += $this->dataPoints[$row][$col]*0.001;
}
}
}
}
}
/**
* @param $aFlg
* @param $aBW
* @return unknown_type
*/
public function UseHighContrastColor($aFlg=true, $aBW=false)
{
$this->highcontrast = $aFlg;
$this->highcontrastbw = $aBW;
}
/**
* Calculate suitable colors for each defined isobar
*
*/
public function CalculateColors()
{
if ($this->highcontrast) {
if ($this->highcontrastbw) {
for ($ib = 0; $ib < $this->nbrIsobars; $ib++) {
$this->isobarColors[$ib] = 'black';
}
} else {
// Use only blue/red scale
$step = round(255/($this->nbrIsobars-1));
for ($ib = 0; $ib < $this->nbrIsobars; $ib++) {
$this->isobarColors[$ib] = array($ib*$step, 50, 255-$ib*$step);
}
}
} else {
$n = $this->nbrIsobars;
$v = 0;
$step = 1 / ($this->nbrIsobars-1);
for ($ib = 0; $ib < $this->nbrIsobars; $ib++) {
$this->isobarColors[$ib] = RGB::GetSpectrum($v);
$v += $step;
}
}
}
/**
* This is where the main work is done. For each isobar the crossing of the edges are determined
* and then each cell is analyzed to find the 0, 2 or 4 crossings. Then the normalized coordinate
* for the crossings are determined and pushed on to the isobar stack. When the method is finished
* the $isobarCoord will hold one arrayfor each isobar where all the line segments that makes
* up the contour plot are stored.
*
* @return array( $isobarCoord, $isobarValues, $isobarColors )
*/
public function getIsobars()
{
$this->adjustDataPointValues();
for ($isobar = 0; $isobar < $this->nbrIsobars; $isobar++) {
$ib = $this->isobarValues[$isobar];
$this->resetEdgeMatrices();
$this->determineIsobarEdgeCrossings($isobar);
$this->isobarCoord[$isobar] = array();
$ncoord = 0;
for ($row = 0 ; $row < $this->nbrRows-1; ++$row) {
for ($col = 0 ; $col < $this->nbrCols-1; ++$col) {
// Find out how many crossings around the edges
$n = 0;
if ($this->edges[HORIZ_EDGE][$row][$col]) {
$neigh[$n++] = array($row, $col, HORIZ_EDGE);
}
if ($this->edges[HORIZ_EDGE][$row+1][$col]) {
$neigh[$n++] = array($row+1,$col, HORIZ_EDGE);
}
if ($this->edges[VERT_EDGE][$row][$col]) {
$neigh[$n++] = array($row, $col, VERT_EDGE);
}
if ($this->edges[VERT_EDGE][$row][$col+1]) {
$neigh[$n++] = array($row, $col+1,VERT_EDGE);
}
if ($n == 2) {
$n1=0;
$n2=1;
$this->isobarCoord[$isobar][$ncoord++] = array(
$this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
$this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib) );
} elseif ($n == 4) {
// We must determine how to connect the edges either northwest->southeast or
// northeast->southwest. We do that by calculating the imaginary middle value of
// the cell by averaging the for corners. This will compared with the value of the
// top left corner will help determine the orientation of the ridge/creek
$midval = ($this->dataPoints[$row][$col]+$this->dataPoints[$row][$col+1]+$this->dataPoints[$row+1][$col]+$this->dataPoints[$row+1][$col+1])/4;
$v = $this->dataPoints[$row][$col];
if ($midval == $ib) {
// Orientation "+"
$n1=0;
$n2=1;
$n3=2;
$n4=3;
} elseif (($midval > $ib && $v > $ib) || ($midval < $ib && $v < $ib)) {
// Orientation of ridge/valley = "\"
$n1=0;
$n2=3;
$n3=2;
$n4=1;
} elseif (($midval > $ib && $v < $ib) || ($midval < $ib && $v > $ib)) {
// Orientation of ridge/valley = "/"
$n1=0;
$n2=2;
$n3=3;
$n4=1;
}
$this->isobarCoord[$isobar][$ncoord++] = array(
$this->getCrossingCoord($neigh[$n1][0], $neigh[$n1][1], $neigh[$n1][2], $ib),
$this->getCrossingCoord($neigh[$n2][0], $neigh[$n2][1], $neigh[$n2][2], $ib) );
$this->isobarCoord[$isobar][$ncoord++] = array(
$this->getCrossingCoord($neigh[$n3][0], $neigh[$n3][1], $neigh[$n3][2], $ib),
$this->getCrossingCoord($neigh[$n4][0], $neigh[$n4][1], $neigh[$n4][2], $ib) );
}
}
}
}
if (count($this->isobarColors) == 0) {
// No manually specified colors. Calculate them automatically.
$this->CalculateColors();
}
return array( $this->isobarCoord, $this->isobarValues, $this->isobarColors );
}
}
/**
* This class represent a plotting of a contour outline of data given as a X-Y matrice
*
*/
class ContourPlot extends Plot
{
private $contour;
private $contourCoord;
private $contourVal;
private $contourColor;
private $nbrCountours = 0 ;
private $dataMatrix = array();
private $invertLegend = false;
private $interpFactor = 1;
private $flipData = false;
private $isobar = 10;
private $showLegend = false;
private $highcontrast = false;
private $highcontrastbw = false;
private $manualIsobarColors = array();
/**
* Construct a contour plotting algorithm. The end result of the algorithm is a sequence of
* line segments for each isobar given as two vertices.
*
* @param $aDataMatrix The Z-data to be used
* @param $aIsobar A mixed variable, if it is an integer then this specified the number of isobars to use.
* The values of the isobars are automatically detrmined to be equ-spaced between the min/max value of the
* data. If it is an array then it explicetely gives the isobar values
* @param $aInvert By default the matrice with row index 0 corresponds to Y-value 0, i.e. in the bottom of
* the plot. If this argument is true then the row with the highest index in the matrice corresponds to
* Y-value 0. In affect flipping the matrice around an imaginary horizontal axis.
* @param $aHighContrast Use high contrast colors (blue/red:ish)
* @param $aHighContrastBW Use only black colors for contours
* @return an instance of the contour plot algorithm
*/
public function __construct($aDataMatrix, $aIsobar=10, $aFactor=1, $aInvert=false, $aIsobarColors=array())
{
$this->dataMatrix = $aDataMatrix;
$this->flipData = $aInvert;
$this->isobar = $aIsobar;
$this->interpFactor = $aFactor;
if ($this->interpFactor > 1) {
if ($this->interpFactor > 5) {
JpGraphError::RaiseL(28007);// ContourPlot interpolation factor is too large (>5)
}
$ip = new MeshInterpolate();
$this->dataMatrix = $ip->Linear($this->dataMatrix, $this->interpFactor);
}
$this->contour = new Contour($this->dataMatrix, $this->isobar, $aIsobarColors);
if (is_array($aIsobar)) {
$this->nbrContours = count($aIsobar);
} else {
$this->nbrContours = $aIsobar;
}
}
/**
* Flipe the data around the center
*
* @param $aFlg
*
*/
public function SetInvert($aFlg=true)
{
$this->flipData = $aFlg;
}
/**
* Set the colors for the isobar lines
*
* @param $aColorArray
*
*/
public function SetIsobarColors($aColorArray)
{
$this->manualIsobarColors = $aColorArray;
}
/**
* Show the legend
*
* @param $aFlg true if the legend should be shown
*
*/
public function ShowLegend($aFlg=true)
{
$this->showLegend = $aFlg;
}
/**
* @param $aFlg true if the legend should start with the lowest isobar on top
* @return unknown_type
*/
public function Invertlegend($aFlg=true)
{
$this->invertLegend = $aFlg;
}
/* Internal method. Give the min value to be used for the scaling
*
*/
public function Min()
{
return array(0,0);
}
/* Internal method. Give the max value to be used for the scaling
*
*/
public function Max()
{
return array(count($this->dataMatrix[0])-1,count($this->dataMatrix)-1);
}
/**
* Internal ramewrok method to setup the legend to be used for this plot.
* @param $aGraph The parent graph class
*/
public function Legend($aGraph)
{
if (! $this->showLegend) {
return;
}
if ($this->invertLegend) {
for ($i = 0; $i < $this->nbrContours; $i++) {
$aGraph->legend->Add(sprintf('%.1f', $this->contourVal[$i]), $this->contourColor[$i]);
}
} else {
for ($i = $this->nbrContours-1; $i >= 0 ; $i--) {
$aGraph->legend->Add(sprintf('%.1f', $this->contourVal[$i]), $this->contourColor[$i]);
}
}
}
/**
* Framework function which gets called before the Stroke() method is called
*
* @see Plot#PreScaleSetup($aGraph)
*
*/
public function PreScaleSetup($aGraph)
{
$xn = count($this->dataMatrix[0])-1;
$yn = count($this->dataMatrix)-1;
$aGraph->xaxis->scale->Update($aGraph->img, 0, $xn);
$aGraph->yaxis->scale->Update($aGraph->img, 0, $yn);
$this->contour->SetInvert($this->flipData);
list($this->contourCoord, $this->contourVal, $this->contourColor) = $this->contour->getIsobars();
}
/**
* Use high contrast color schema
*
* @param $aFlg True, to use high contrast color
* @param $aBW True, Use only black and white color schema
*/
public function UseHighContrastColor($aFlg=true, $aBW=false)
{
$this->highcontrast = $aFlg;
$this->highcontrastbw = $aBW;
$this->contour->UseHighContrastColor($this->highcontrast, $this->highcontrastbw);
}
/**
* Internal method. Stroke the contour plot to the graph
*
* @param $img Image handler
* @param $xscale Instance of the xscale to use
* @param $yscale Instance of the yscale to use
*/
public function Stroke($img, $xscale, $yscale)
{
if (count($this->manualIsobarColors) > 0) {
$this->contourColor = $this->manualIsobarColors;
if (count($this->manualIsobarColors) != $this->nbrContours) {
JpGraphError::RaiseL(28002);
}
}
$img->SetLineWeight($this->line_weight);
for ($c = 0; $c < $this->nbrContours; $c++) {
$img->SetColor($this->contourColor[$c]);
$n = count($this->contourCoord[$c]);
$i = 0;
while ($i < $n) {
list($x1, $y1) = $this->contourCoord[$c][$i][0];
$x1t = $xscale->Translate($x1);
$y1t = $yscale->Translate($y1);
list($x2, $y2) = $this->contourCoord[$c][$i++][1];
$x2t = $xscale->Translate($x2);
$y2t = $yscale->Translate($y2);
$img->Line($x1t, $y1t, $x2t, $y2t);
}
}
}
}
// EOF

View file

@ -3,47 +3,47 @@
// File: JPGRAPH_DATE.PHP // File: JPGRAPH_DATE.PHP
// Description: Classes to handle Date scaling // Description: Classes to handle Date scaling
// Created: 2005-05-02 // Created: 2005-05-02
// Ver: $Id: jpgraph_date.php 912 2007-09-26 21:00:35Z ljp $ // Ver: $Id: jpgraph_date.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
DEFINE('HOURADJ_1', 0+30); define('HOURADJ_1', 0+30);
DEFINE('HOURADJ_2', 1+30); define('HOURADJ_2', 1+30);
DEFINE('HOURADJ_3', 2+30); define('HOURADJ_3', 2+30);
DEFINE('HOURADJ_4', 3+30); define('HOURADJ_4', 3+30);
DEFINE('HOURADJ_6', 4+30); define('HOURADJ_6', 4+30);
DEFINE('HOURADJ_12', 5+30); define('HOURADJ_12', 5+30);
DEFINE('MINADJ_1', 0+20); define('MINADJ_1', 0+20);
DEFINE('MINADJ_5', 1+20); define('MINADJ_5', 1+20);
DEFINE('MINADJ_10', 2+20); define('MINADJ_10', 2+20);
DEFINE('MINADJ_15', 3+20); define('MINADJ_15', 3+20);
DEFINE('MINADJ_30', 4+20); define('MINADJ_30', 4+20);
DEFINE('SECADJ_1', 0); define('SECADJ_1', 0);
DEFINE('SECADJ_5', 1); define('SECADJ_5', 1);
DEFINE('SECADJ_10', 2); define('SECADJ_10', 2);
DEFINE('SECADJ_15', 3); define('SECADJ_15', 3);
DEFINE('SECADJ_30', 4); define('SECADJ_30', 4);
DEFINE('YEARADJ_1', 0+30); define('YEARADJ_1', 0+30);
DEFINE('YEARADJ_2', 1+30); define('YEARADJ_2', 1+30);
DEFINE('YEARADJ_5', 2+30); define('YEARADJ_5', 2+30);
DEFINE('MONTHADJ_1', 0+20); define('MONTHADJ_1', 0+20);
DEFINE('MONTHADJ_6', 1+20); define('MONTHADJ_6', 1+20);
DEFINE('DAYADJ_1', 0); define('DAYADJ_1', 0);
DEFINE('DAYADJ_WEEK', 1); define('DAYADJ_WEEK', 1);
DEFINE('DAYADJ_7', 1); define('DAYADJ_7', 1);
DEFINE('SECPERYEAR', 31536000); define('SECPERYEAR', 31536000);
DEFINE('SECPERDAY', 86400); define('SECPERDAY', 86400);
DEFINE('SECPERHOUR', 3600); define('SECPERHOUR', 3600);
DEFINE('SECPERMIN', 60); define('SECPERMIN', 60);
class DateScale extends LinearScale class DateScale extends LinearScale
@ -56,7 +56,7 @@ class DateScale extends LinearScale
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function DateScale($aMin=0, $aMax=0, $aType='x') public function __construct($aMin=0, $aMax=0, $aType='x')
{ {
assert($aType=="x"); assert($aType=="x");
assert($aMin<=$aMax); assert($aMin<=$aMax);
@ -433,10 +433,16 @@ class DateScale extends LinearScale
// identical to LinearScale::AutoScale // identical to LinearScale::AutoScale
if ($aStartTime == $aEndTime) { if ($aStartTime == $aEndTime) {
// Special case when we only have one data point. // Special case when we only have one data point.
// Create a small artifical intervall to do the autoscaling // Create a small artificial interval to do the autoscaling
$aStartTime -= 10; $aStartTime -= 10;
$aEndTime += 10; $aEndTime += 10;
} }
if (abs($aEndTime - $aStartTime) <= 1) {
// Special case when we only have one second.
// Create a small artificial interval to do the autoscaling
$aStartTime -= 1;
$aEndTime += 1;
}
$done=false; $done=false;
$i=0; $i=0;
while (! $done && $i < 5) { while (! $done && $i < 5) {

View file

@ -5,11 +5,18 @@
// error messages. All localized error messages are stored // error messages. All localized error messages are stored
// in a separate file under the "lang/" subdirectory. // in a separate file under the "lang/" subdirectory.
// Created: 2006-09-24 // Created: 2006-09-24
// Ver: $Id: jpgraph_errhandler.inc.php 973 2008-03-09 15:29:44Z ljp $ // Ver: $Id: jpgraph_errhandler.inc.php 1920 2009-12-08 10:02:26Z ljp $
// //
// Copyright 2006 (c) Aditus Consulting. All rights reserved. // Copyright 2006 (c) Aditus Consulting. All rights reserved.
//======================================================================== //========================================================================
if (!defined('DEFAULT_ERR_LOCALE')) {
define('DEFAULT_ERR_LOCALE', 'en');
}
if (!defined('USE_IMAGE_ERROR_HANDLER')) {
define('USE_IMAGE_ERROR_HANDLER', true);
}
global $__jpg_err_locale ; global $__jpg_err_locale ;
$__jpg_err_locale = DEFAULT_ERR_LOCALE; $__jpg_err_locale = DEFAULT_ERR_LOCALE;
@ -17,7 +24,7 @@ $__jpg_err_locale = DEFAULT_ERR_LOCALE;
class ErrMsgText class ErrMsgText
{ {
private $lt=null; private $lt=null;
public function ErrMsgText() public function __construct()
{ {
global $__jpg_err_locale; global $__jpg_err_locale;
$file = 'lang/'.$__jpg_err_locale.'.inc.php'; $file = 'lang/'.$__jpg_err_locale.'.inc.php';
@ -96,14 +103,12 @@ class ErrMsgText
// //
class JpGraphError class JpGraphError
{ {
private static $__jpg_err; private static $__iImgFlg = true;
public static function Install($aErrObject) private static $__iLogFile = '';
{ private static $__iTitle = 'JpGraph Error: ';
self::$__jpg_err = new $aErrObject;
}
public static function Raise($aMsg, $aHalt=true) public static function Raise($aMsg, $aHalt=true)
{ {
self::$__jpg_err->Raise($aMsg, $aHalt); throw new JpGraphException($aMsg);
} }
public static function SetErrLocale($aLoc) public static function SetErrLocale($aLoc)
{ {
@ -112,12 +117,91 @@ class JpGraphError
} }
public static function RaiseL($errnbr, $a1=null, $a2=null, $a3=null, $a4=null, $a5=null) public static function RaiseL($errnbr, $a1=null, $a2=null, $a3=null, $a4=null, $a5=null)
{ {
$t = new ErrMsgText(); throw new JpGraphExceptionL($errnbr, $a1, $a2, $a3, $a4, $a5);
$msg = $t->Get($errnbr, $a1, $a2, $a3, $a4, $a5); }
self::$__jpg_err->Raise($msg); public static function SetImageFlag($aFlg=true)
{
self::$__iImgFlg = $aFlg;
}
public static function GetImageFlag()
{
return self::$__iImgFlg;
}
public static function SetLogFile($aFile)
{
self::$__iLogFile = $aFile;
}
public static function GetLogFile()
{
return self::$__iLogFile;
}
public static function SetTitle($aTitle)
{
self::$__iTitle = $aTitle;
}
public static function GetTitle()
{
return self::$__iTitle;
} }
} }
class JpGraphException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// make sure everything is assigned properly
parent::__construct($message, $code);
}
// custom string representation of object
public function _toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message} at " . basename($this->getFile()) . ":" . $this->getLine() . "\n" . $this->getTraceAsString() . "\n";
}
// custom representation of error as an image
public function Stroke()
{
if (JpGraphError::GetImageFlag()) {
$errobj = new JpGraphErrObjectImg();
$errobj->SetTitle(JpGraphError::GetTitle());
} else {
$errobj = new JpGraphErrObject();
$errobj->SetTitle(JpGraphError::GetTitle());
$errobj->SetStrokeDest(JpGraphError::GetLogFile());
}
$errobj->Raise($this->getMessage());
}
public static function defaultHandler(Throwable $exception)
{
global $__jpg_OldHandler;
if ($exception instanceof JpGraphException) {
$exception->Stroke();
} else {
// Restore old handler
if ($__jpg_OldHandler !== null) {
set_exception_handler($__jpg_OldHandler);
}
throw $exception;
}
}
}
class JpGraphExceptionL extends JpGraphException
{
// Redefine the exception so message isn't optional
public function __construct($errcode, $a1=null, $a2=null, $a3=null, $a4=null, $a5=null)
{
// make sure everything is assigned properly
$errtxt = new ErrMsgText();
JpGraphError::SetTitle('JpGraph Error: '.$errcode);
parent::__construct($errtxt->Get($errcode, $a1, $a2, $a3, $a4, $a5), 0);
}
}
// Setup the default handler
global $__jpg_OldHandler;
$__jpg_OldHandler = set_exception_handler(array('JpGraphException','defaultHandler'));
// //
// First of all set up a default error handler // First of all set up a default error handler
// //
@ -127,11 +211,11 @@ class JpGraphError
//============================================================= //=============================================================
class JpGraphErrObject class JpGraphErrObject
{ {
protected $iTitle = "JpGraph Error"; protected $iTitle = "JpGraph error: ";
protected $iDest = false; protected $iDest = false;
public function JpGraphErrObject() public function __construct()
{ {
// Empty. Reserved for future use // Empty. Reserved for future use
} }
@ -147,20 +231,31 @@ class JpGraphErrObject
} }
// If aHalt is true then execution can't continue. Typical used for fatal errors // If aHalt is true then execution can't continue. Typical used for fatal errors
public function Raise($aMsg, $aHalt=true) public function Raise($aMsg, $aHalt=false)
{ {
$aMsg = $this->iTitle.' '.$aMsg; if ($this->iDest != '') {
if ($this->iDest) { if ($this->iDest == 'syslog') {
error_log($this->iTitle.$aMsg);
} else {
$str = '['.date('r').'] '.$this->iTitle.$aMsg."\n";
$f = @fopen($this->iDest, 'a'); $f = @fopen($this->iDest, 'a');
if ($f) { if ($f) {
@fwrite($f, $aMsg); @fwrite($f, $str);
@fclose($f); @fclose($f);
} }
}
} else {
$aMsg = $this->iTitle.$aMsg;
// Check SAPI and if we are called from the command line
// send the error to STDERR instead
if (PHP_SAPI == 'cli') {
fwrite(STDERR, $aMsg);
} else { } else {
echo $aMsg; echo $aMsg;
} }
}
if ($aHalt) { if ($aHalt) {
die(); exit(1);
} }
} }
} }
@ -170,6 +265,12 @@ class JpGraphErrObject
//============================================================== //==============================================================
class JpGraphErrObjectImg extends JpGraphErrObject class JpGraphErrObjectImg extends JpGraphErrObject
{ {
public function __construct()
{
parent::__construct();
// Empty. Reserved for future use
}
public function Raise($aMsg, $aHalt=true) public function Raise($aMsg, $aHalt=true)
{ {
$img_iconerror = $img_iconerror =
@ -189,6 +290,7 @@ class JpGraphErrObjectImg extends JpGraphErrObject
'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx'. 'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx'.
'qL72fwAAAABJRU5ErkJggg==' ; 'qL72fwAAAABJRU5ErkJggg==' ;
if (function_exists("imagetypes")) { if (function_exists("imagetypes")) {
$supported = imagetypes(); $supported = imagetypes();
} else { } else {
@ -257,17 +359,18 @@ class JpGraphErrObjectImg extends JpGraphErrObject
// Window title // Window title
$m = floor($w/2-5); $m = floor($w/2-5);
$l = 100; $l = 110;
$img->SetColor("lightgray:1.3"); $img->SetColor("lightgray:1.3");
$img->FilledRectangle($m-$l, 2, $m+$l, 16); $img->FilledRectangle($m-$l, 2, $m+$l, 16);
// Stroke text // Stroke text
$img->SetColor("darkred"); $img->SetColor("darkred");
$img->SetFont(FF_FONT2, FS_BOLD); $img->SetFont(FF_FONT2, FS_BOLD);
$img->StrokeText($m-50, 15, $this->iTitle); $img->StrokeText($m-90, 15, $this->iTitle);
$img->SetColor("black"); $img->SetColor("black");
$img->SetFont(FF_FONT1, FS_NORMAL); $img->SetFont(FF_FONT1, FS_NORMAL);
$txt = new Text($aMsg, 52, 25); $txt = new Text($aMsg, 52, 25);
$txt->SetFont(FF_FONT1);
$txt->Align("left", "top"); $txt->Align("left", "top");
$txt->Stroke($img); $txt->Stroke($img);
if ($this->iDest) { if ($this->iDest) {
@ -283,9 +386,7 @@ class JpGraphErrObjectImg extends JpGraphErrObject
} }
// Install the default error handler
if (USE_IMAGE_ERROR_HANDLER) { if (! USE_IMAGE_ERROR_HANDLER) {
JpGraphError::Install("JpGraphErrObjectImg"); JpGraphError::SetImageFlag(false);
} else {
JpGraphError::Install("JpGraphErrObject");
} }

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_ERROR.PHP // File: JPGRAPH_ERROR.PHP
// Description: Error plot extension for JpGraph // Description: Error plot extension for JpGraph
// Created: 2001-01-08 // Created: 2001-01-08
// Ver: $Id: jpgraph_error.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_error.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -17,11 +17,12 @@
class ErrorPlot extends Plot class ErrorPlot extends Plot
{ {
private $errwidth=2; private $errwidth=2;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function ErrorPlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
$this->Plot($datay, $datax); parent::__construct($datay, $datax);
$this->numpoints /= 2; $this->numpoints /= 2;
} }
//--------------- //---------------
@ -97,9 +98,9 @@ class ErrorLinePlot extends ErrorPlot
public $line=null; public $line=null;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function ErrorLinePlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
$this->ErrorPlot($datay, $datax); parent::__construct($datay, $datax);
// Calculate line coordinates as the average of the error limits // Calculate line coordinates as the average of the error limits
$n = count($datay); $n = count($datay);
for ($i=0; $i < $n; $i+=2) { for ($i=0; $i < $n; $i+=2) {
@ -136,7 +137,7 @@ class LineErrorPlot extends ErrorPlot
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
// Data is (val, errdeltamin, errdeltamax) // Data is (val, errdeltamin, errdeltamax)
public function LineErrorPlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
$ly=array(); $ly=array();
$ey=array(); $ey=array();
@ -150,7 +151,7 @@ class LineErrorPlot extends ErrorPlot
$ey[]=$datay[$i]+$datay[$i+1]; $ey[]=$datay[$i]+$datay[$i+1];
$ey[]=$datay[$i]+$datay[$i+2]; $ey[]=$datay[$i]+$datay[$i+2];
} }
$this->ErrorPlot($ey, $datax); parent::__construct($ey, $datax);
$this->line=new LinePlot($ly, $datax); $this->line=new LinePlot($ly, $datax);
} }

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_FLAGS.PHP // File: JPGRAPH_FLAGS.PHP
// Description: Class Jpfile. Handles plotmarks // Description: Class Jpfile. Handles plotmarks
// Created: 2003-06-28 // Created: 2003-06-28
// Ver: $Id: jpgraph_flags.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_flags.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
//------------------------------------------------------------ //------------------------------------------------------------
@ -267,7 +267,7 @@ class FlagImages
private $iFlagData ; private $iFlagData ;
private $iOrdIdx=array(); private $iOrdIdx=array();
public function FlagImages($aSize=FLAGSIZE1) public function __construct($aSize=FLAGSIZE1)
{ {
switch ($aSize) { switch ($aSize) {
case FLAGSIZE1: case FLAGSIZE1:
@ -304,7 +304,7 @@ class FlagImages
return Image::CreateFromString($d); return Image::CreateFromString($d);
} else { } else {
JpGraphError::RaiseL(5002, $aIdx); JpGraphError::RaiseL(5002, $aIdx);
//("Flag index \" $aIdx\" does not exist."); //("Flag index \"<EFBFBD>$aIdx\" does not exist.");
} }
} }
@ -313,10 +313,9 @@ class FlagImages
$aOrd--; $aOrd--;
$n = count($this->iOrdIdx); $n = count($this->iOrdIdx);
if ($n == 0) { if ($n == 0) {
reset($this->iCountryNameMap);
$this->iOrdIdx=array(); $this->iOrdIdx=array();
$i=0; $i=0;
while (list($key, $val) = each($this->iCountryNameMap)) { foreach ($this->iCountryNameMap as $key => $val) {
$this->iOrdIdx[$i++] = array($val,$key); $this->iOrdIdx[$i++] = array($val,$key);
} }
$tmp=$this->iOrdIdx[$aOrd]; $tmp=$this->iOrdIdx[$aOrd];
@ -342,18 +341,16 @@ class FlagImages
$found=false; $found=false;
$aName = strtolower($aName); $aName = strtolower($aName);
$nlen = strlen($aName); $nlen = strlen($aName);
reset($this->iCountryNameMap);
// Start by trying to match exact index name // 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) { if ($nlen == strlen($val) && $val == $aName) {
$found=true; $found=true;
break; break;
} }
} }
if (!$found) { if (!$found) {
reset($this->iCountryNameMap);
// If the exact index doesn't work try a (partial) full name // 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) { if (strpos(strtolower($key), $aName) !== false) {
$found=true; $found=true;
break; break;

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_GANTT.PHP // File: JPGRAPH_GANTT.PHP
// Description: JpGraph Gantt plot extension // Description: JpGraph Gantt plot extension
// Created: 2001-11-12 // Created: 2001-11-12
// Ver: $Id: jpgraph_gantt.php 956 2007-11-17 13:19:20Z ljp $ // Ver: $Id: jpgraph_gantt.php 1809 2009-09-09 13:07:33Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -14,114 +14,114 @@ require_once('jpgraph_iconplot.php');
require_once('jpgraph_plotmark.inc.php'); require_once('jpgraph_plotmark.inc.php');
// Maximum size for Automatic Gantt chart // Maximum size for Automatic Gantt chart
DEFINE('MAX_GANTTIMG_SIZE_W', 4000); define('MAX_GANTTIMG_SIZE_W', 8000);
DEFINE('MAX_GANTTIMG_SIZE_H', 5000); define('MAX_GANTTIMG_SIZE_H', 5000);
// Scale Header types // Scale Header types
DEFINE("GANTT_HDAY", 1); define("GANTT_HDAY", 1);
DEFINE("GANTT_HWEEK", 2); define("GANTT_HWEEK", 2);
DEFINE("GANTT_HMONTH", 4); define("GANTT_HMONTH", 4);
DEFINE("GANTT_HYEAR", 8); define("GANTT_HYEAR", 8);
DEFINE("GANTT_HHOUR", 16); define("GANTT_HHOUR", 16);
DEFINE("GANTT_HMIN", 32); define("GANTT_HMIN", 32);
// Bar patterns // Bar patterns
DEFINE("GANTT_RDIAG", BAND_RDIAG); // Right diagonal lines define("GANTT_RDIAG", BAND_RDIAG); // Right diagonal lines
DEFINE("GANTT_LDIAG", BAND_LDIAG); // Left diagonal lines define("GANTT_LDIAG", BAND_LDIAG); // Left diagonal lines
DEFINE("GANTT_SOLID", BAND_SOLID); // Solid one color define("GANTT_SOLID", BAND_SOLID); // Solid one color
DEFINE("GANTT_VLINE", BAND_VLINE); // Vertical lines define("GANTT_VLINE", BAND_VLINE); // Vertical lines
DEFINE("GANTT_HLINE", BAND_HLINE); // Horizontal lines define("GANTT_HLINE", BAND_HLINE); // Horizontal lines
DEFINE("GANTT_3DPLANE", BAND_3DPLANE); // "3D" Plane define("GANTT_3DPLANE", BAND_3DPLANE); // "3D" Plane
DEFINE("GANTT_HVCROSS", BAND_HVCROSS); // Vertical/Hor crosses define("GANTT_HVCROSS", BAND_HVCROSS); // Vertical/Hor crosses
DEFINE("GANTT_DIAGCROSS", BAND_DIAGCROSS); // Diagonal crosses define("GANTT_DIAGCROSS", BAND_DIAGCROSS); // Diagonal crosses
// Conversion constant // Conversion constant
DEFINE("SECPERDAY", 3600*24); define("SECPERDAY", 3600*24);
// Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY // Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY
// You should use the proper locale strings directly // You should use the proper locale strings directly
// from now on. // from now on.
DEFINE("LOCALE_EN", "en_UK"); define("LOCALE_EN", "en_UK");
DEFINE("LOCALE_SV", "sv_SE"); define("LOCALE_SV", "sv_SE");
// Layout of bars // Layout of bars
DEFINE("GANTT_EVEN", 1); define("GANTT_EVEN", 1);
DEFINE("GANTT_FROMTOP", 2); define("GANTT_FROMTOP", 2);
// Style for minute header // Style for minute header
DEFINE("MINUTESTYLE_MM", 0); // 15 define("MINUTESTYLE_MM", 0); // 15
DEFINE("MINUTESTYLE_CUSTOM", 2); // Custom format define("MINUTESTYLE_CUSTOM", 2); // Custom format
// Style for hour header // Style for hour header
DEFINE("HOURSTYLE_HM24", 0); // 13:10 define("HOURSTYLE_HM24", 0); // 13:10
DEFINE("HOURSTYLE_HMAMPM", 1); // 1:10pm define("HOURSTYLE_HMAMPM", 1); // 1:10pm
DEFINE("HOURSTYLE_H24", 2); // 13 define("HOURSTYLE_H24", 2); // 13
DEFINE("HOURSTYLE_HAMPM", 3); // 1pm define("HOURSTYLE_HAMPM", 3); // 1pm
DEFINE("HOURSTYLE_CUSTOM", 4); // User defined define("HOURSTYLE_CUSTOM", 4); // User defined
// Style for day header // Style for day header
DEFINE("DAYSTYLE_ONELETTER", 0); // "M" define("DAYSTYLE_ONELETTER", 0); // "M"
DEFINE("DAYSTYLE_LONG", 1); // "Monday" define("DAYSTYLE_LONG", 1); // "Monday"
DEFINE("DAYSTYLE_LONGDAYDATE1", 2); // "Monday 23 Jun" define("DAYSTYLE_LONGDAYDATE1", 2); // "Monday 23 Jun"
DEFINE("DAYSTYLE_LONGDAYDATE2", 3); // "Monday 23 Jun 2003" define("DAYSTYLE_LONGDAYDATE2", 3); // "Monday 23 Jun 2003"
DEFINE("DAYSTYLE_SHORT", 4); // "Mon" define("DAYSTYLE_SHORT", 4); // "Mon"
DEFINE("DAYSTYLE_SHORTDAYDATE1", 5); // "Mon 23/6" define("DAYSTYLE_SHORTDAYDATE1", 5); // "Mon 23/6"
DEFINE("DAYSTYLE_SHORTDAYDATE2", 6); // "Mon 23 Jun" define("DAYSTYLE_SHORTDAYDATE2", 6); // "Mon 23 Jun"
DEFINE("DAYSTYLE_SHORTDAYDATE3", 7); // "Mon 23" define("DAYSTYLE_SHORTDAYDATE3", 7); // "Mon 23"
DEFINE("DAYSTYLE_SHORTDATE1", 8); // "23/6" define("DAYSTYLE_SHORTDATE1", 8); // "23/6"
DEFINE("DAYSTYLE_SHORTDATE2", 9); // "23 Jun" define("DAYSTYLE_SHORTDATE2", 9); // "23 Jun"
DEFINE("DAYSTYLE_SHORTDATE3", 10); // "Mon 23" define("DAYSTYLE_SHORTDATE3", 10); // "Mon 23"
DEFINE("DAYSTYLE_SHORTDATE4", 11); // "23" define("DAYSTYLE_SHORTDATE4", 11); // "23"
DEFINE("DAYSTYLE_CUSTOM", 12); // "M" define("DAYSTYLE_CUSTOM", 12); // "M"
// Styles for week header // Styles for week header
DEFINE("WEEKSTYLE_WNBR", 0); define("WEEKSTYLE_WNBR", 0);
DEFINE("WEEKSTYLE_FIRSTDAY", 1); define("WEEKSTYLE_FIRSTDAY", 1);
DEFINE("WEEKSTYLE_FIRSTDAY2", 2); define("WEEKSTYLE_FIRSTDAY2", 2);
DEFINE("WEEKSTYLE_FIRSTDAYWNBR", 3); define("WEEKSTYLE_FIRSTDAYWNBR", 3);
DEFINE("WEEKSTYLE_FIRSTDAY2WNBR", 4); define("WEEKSTYLE_FIRSTDAY2WNBR", 4);
// Styles for month header // Styles for month header
DEFINE("MONTHSTYLE_SHORTNAME", 0); define("MONTHSTYLE_SHORTNAME", 0);
DEFINE("MONTHSTYLE_LONGNAME", 1); define("MONTHSTYLE_LONGNAME", 1);
DEFINE("MONTHSTYLE_LONGNAMEYEAR2", 2); define("MONTHSTYLE_LONGNAMEYEAR2", 2);
DEFINE("MONTHSTYLE_SHORTNAMEYEAR2", 3); define("MONTHSTYLE_SHORTNAMEYEAR2", 3);
DEFINE("MONTHSTYLE_LONGNAMEYEAR4", 4); define("MONTHSTYLE_LONGNAMEYEAR4", 4);
DEFINE("MONTHSTYLE_SHORTNAMEYEAR4", 5); define("MONTHSTYLE_SHORTNAMEYEAR4", 5);
DEFINE("MONTHSTYLE_FIRSTLETTER", 6); define("MONTHSTYLE_FIRSTLETTER", 6);
// Types of constrain links // Types of constrain links
DEFINE('CONSTRAIN_STARTSTART', 0); define('CONSTRAIN_STARTSTART', 0);
DEFINE('CONSTRAIN_STARTEND', 1); define('CONSTRAIN_STARTEND', 1);
DEFINE('CONSTRAIN_ENDSTART', 2); define('CONSTRAIN_ENDSTART', 2);
DEFINE('CONSTRAIN_ENDEND', 3); define('CONSTRAIN_ENDEND', 3);
// Arrow direction for constrain links // Arrow direction for constrain links
DEFINE('ARROW_DOWN', 0); define('ARROW_DOWN', 0);
DEFINE('ARROW_UP', 1); define('ARROW_UP', 1);
DEFINE('ARROW_LEFT', 2); define('ARROW_LEFT', 2);
DEFINE('ARROW_RIGHT', 3); define('ARROW_RIGHT', 3);
// Arrow type for constrain type // Arrow type for constrain type
DEFINE('ARROWT_SOLID', 0); define('ARROWT_SOLID', 0);
DEFINE('ARROWT_OPEN', 1); define('ARROWT_OPEN', 1);
// Arrow size for constrain lines // Arrow size for constrain lines
DEFINE('ARROW_S1', 0); define('ARROW_S1', 0);
DEFINE('ARROW_S2', 1); define('ARROW_S2', 1);
DEFINE('ARROW_S3', 2); define('ARROW_S3', 2);
DEFINE('ARROW_S4', 3); define('ARROW_S4', 3);
DEFINE('ARROW_S5', 4); define('ARROW_S5', 4);
// Activity types for use with utility method CreateSimple() // Activity types for use with utility method CreateSimple()
DEFINE('ACTYPE_NORMAL', 0); define('ACTYPE_NORMAL', 0);
DEFINE('ACTYPE_GROUP', 1); define('ACTYPE_GROUP', 1);
DEFINE('ACTYPE_MILESTONE', 2); define('ACTYPE_MILESTONE', 2);
DEFINE('ACTINFO_3D', 1); define('ACTINFO_3D', 1);
DEFINE('ACTINFO_2D', 0); define('ACTINFO_2D', 0);
// Check if array_fill() exists // Check if array_fill() exists
@ -161,7 +161,7 @@ class GanttActivityInfo
private $iStyle=1; private $iStyle=1;
private $iHeaderAlign='center'; private $iHeaderAlign='center';
public function GanttActivityInfo() public function __construct()
{ {
$this->vgrid = new LineProperty(); $this->vgrid = new LineProperty();
} }
@ -303,12 +303,7 @@ class GanttActivityInfo
if ($this->iStyle == 1) { if ($this->iStyle == 1) {
// Make a 3D effect // Make a 3D effect
$aImg->SetColor('white'); $aImg->SetColor('white');
$aImg->Line( $aImg->Line($aXLeft, $yTop+1, $aXRight, $yTop+1);
$aXLeft,
$yTop+1,
$aXRight,
$yTop+1
);
} }
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
@ -376,10 +371,11 @@ class GanttGraph extends Graph
private $iSimpleProgressBkgColor='gray'; private $iSimpleProgressBkgColor='gray';
private $iSimpleProgressColor='darkgreen'; private $iSimpleProgressColor='darkgreen';
private $iSimpleProgressStyle=GANTT_SOLID; private $iSimpleProgressStyle=GANTT_SOLID;
private $iZoomFactor = 1.0;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
// Create a new gantt graph // Create a new gantt graph
public function GanttGraph($aWidth=0, $aHeight=0, $aCachedName="", $aTimeOut=0, $aInline=true) public function __construct($aWidth=0, $aHeight=0, $aCachedName="", $aTimeOut=0, $aInline=true)
{ {
// Backward compatibility // Backward compatibility
@ -394,7 +390,7 @@ class GanttGraph extends Graph
JpgraphError::RaiseL(6002); JpgraphError::RaiseL(6002);
//("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension."); //("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.");
} }
Graph::Graph($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline); parent::__construct($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline);
$this->scale = new GanttScale($this->img); $this->scale = new GanttScale($this->img);
// Default margins // Default margins
@ -503,7 +499,7 @@ class GanttGraph extends Graph
// Setup caption // Setup caption
$a->caption->Set($data[$i][$csimpos-1]); $a->caption->Set($data[$i][$csimpos-1]);
// Check if this activity should have a CSIM target ? // Check if this activity should have a CSIM target<EFBFBD>?
if (!empty($data[$i][$csimpos])) { if (!empty($data[$i][$csimpos])) {
$a->SetCSIMTarget($data[$i][$csimpos]); $a->SetCSIMTarget($data[$i][$csimpos]);
$a->SetCSIMAlt($data[$i][$csimpos+1]); $a->SetCSIMAlt($data[$i][$csimpos+1]);
@ -517,6 +513,12 @@ class GanttGraph extends Graph
} }
} }
// Set user specified scale zoom factor when auto sizing is used
public function SetZoomFactor($aZoom)
{
$this->iZoomFactor = $aZoom;
}
// Set what headers should be shown // Set what headers should be shown
public function ShowHeaders($aFlg) public function ShowHeaders($aFlg)
@ -545,6 +547,8 @@ class GanttGraph extends Graph
$cl = $aObject[0]; $cl = $aObject[0];
if (class_exists('IconPlot', false) && ($cl instanceof IconPlot)) { if (class_exists('IconPlot', false) && ($cl instanceof IconPlot)) {
$this->AddIcon($aObject); $this->AddIcon($aObject);
} elseif (class_exists('Text', false) && ($cl instanceof Text)) {
$this->AddText($aObject);
} else { } else {
$n = count($aObject); $n = count($aObject);
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
@ -554,12 +558,32 @@ class GanttGraph extends Graph
} else { } else {
if (class_exists('IconPlot', false) && ($aObject instanceof IconPlot)) { if (class_exists('IconPlot', false) && ($aObject instanceof IconPlot)) {
$this->AddIcon($aObject); $this->AddIcon($aObject);
} elseif (class_exists('Text', false) && ($aObject instanceof Text)) {
$this->AddText($aObject);
} else { } else {
$this->iObj[] = $aObject; $this->iObj[] = $aObject;
} }
} }
} }
public function StrokeTexts()
{
// Stroke any user added text objects
if ($this->texts != null) {
$n = count($this->texts);
for ($i=0; $i < $n; ++$i) {
if ($this->texts[$i]->iScalePosX !== null && $this->texts[$i]->iScalePosY !== null) {
$x = $this->scale->TranslateDate($this->texts[$i]->iScalePosX);
$y = $this->scale->TranslateVertPos($this->texts[$i]->iScalePosY);
$y -= $this->scale->GetVertSpacing()/2;
} else {
$x = $y = null;
}
$this->texts[$i]->Stroke($this->img, $x, $y);
}
}
}
// Override inherit method from Graph and give a warning message // Override inherit method from Graph and give a warning message
public function SetScale($aAxisType, $aYMin=1, $aYMax=1, $aXMin=1, $aXMax=1) public function SetScale($aAxisType, $aYMin=1, $aYMax=1, $aXMin=1, $aXMax=1)
{ {
@ -612,8 +636,10 @@ class GanttGraph extends Graph
$m=10; $m=10;
if ($this->iObj != null) { if ($this->iObj != null) {
$n = count($this->iObj); $n = count($this->iObj);
// We can not include the title of GnttVLine since that title is stroked at the bottom
// of the Gantt bar and not in the activity title columns
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
if (!empty($this->iObj[$i]->title)) { if (!empty($this->iObj[$i]->title) && !($this->iObj[$i] instanceof GanttVLine)) {
$m=max($m, $this->iObj[$i]->title->GetHeight($this->img)); $m=max($m, $this->iObj[$i]->title->GetHeight($this->img));
} }
} }
@ -691,14 +717,26 @@ class GanttGraph extends Graph
// The predefined left, right, top, bottom margins. // The predefined left, right, top, bottom margins.
// Note that the top margin might incease depending on // Note that the top margin might incease depending on
// the title. // the title.
$hadj = $vadj = 0;
if ($this->doshadow) {
$hadj = $this->shadow_width;
$vadj = $this->shadow_width+5;
}
$lm = $this->img->left_margin; $lm = $this->img->left_margin;
$rm = $this->img->right_margin; $rm = $this->img->right_margin +$hadj;
$rm += 2 ; $rm += 2 ;
$tm = $this->img->top_margin; $tm = $this->img->top_margin;
$bm = $this->img->bottom_margin; $bm = $this->img->bottom_margin + $vadj;
$bm += 1; $bm += 2;
if (BRAND_TIMING) {
$bm += 10; // If there are any added GanttVLine we must make sure that the
// bottom margin is wide enough to hold a title.
$n = count($this->iObj);
for ($i=0; $i < $n; ++$i) {
if ($this->iObj[$i] instanceof GanttVLine) {
$bm = max($bm, $this->iObj[$i]->title->GetHeight($this->img)+10);
}
} }
// First find out the height // First find out the height
@ -777,10 +815,7 @@ class GanttGraph extends Graph
$txt = "88"; $txt = "88";
break; break;
case DAYSTYLE_CUSTOM: case DAYSTYLE_CUSTOM:
$txt = date( $txt = date($this->scale->day->iLabelFormStr, strtotime('2003-12-20 18:00'));
$this->scale->day->iLabelFormStr,
strtotime('2003-12-20 18:00')
);
break; break;
case DAYSTYLE_ONELETTER: case DAYSTYLE_ONELETTER:
default: default:
@ -919,6 +954,8 @@ class GanttGraph extends Graph
// Add the width of the vertivcal divider line // Add the width of the vertivcal divider line
$titlewidth += $this->scale->divider->iWeight*2; $titlewidth += $this->scale->divider->iWeight*2;
// Adjust the width by the user specified zoom factor
$fw *= $this->iZoomFactor;
// Now get the total width taking // Now get the total width taking
// titlewidth, left and rigt margin, dayfont size // titlewidth, left and rigt margin, dayfont size
@ -1050,6 +1087,9 @@ class GanttGraph extends Graph
$this->StrokeIcons(); $this->StrokeIcons();
} }
// Stroke all added user texts
$this->StrokeTexts();
// Should we do any final image transformation // Should we do any final image transformation
if ($this->iImgTrans) { if ($this->iImgTrans) {
if (!class_exists('ImgTrans', false)) { if (!class_exists('ImgTrans', false)) {
@ -1193,19 +1233,19 @@ class GanttGraph extends Graph
// CLASS PredefIcons // CLASS PredefIcons
// Description: Predefined icons for use with Gantt charts // Description: Predefined icons for use with Gantt charts
//=================================================== //===================================================
DEFINE('GICON_WARNINGRED', 0); define('GICON_WARNINGRED', 0);
DEFINE('GICON_TEXT', 1); define('GICON_TEXT', 1);
DEFINE('GICON_ENDCONS', 2); define('GICON_ENDCONS', 2);
DEFINE('GICON_MAIL', 3); define('GICON_MAIL', 3);
DEFINE('GICON_STARTCONS', 4); define('GICON_STARTCONS', 4);
DEFINE('GICON_CALC', 5); define('GICON_CALC', 5);
DEFINE('GICON_MAGNIFIER', 6); define('GICON_MAGNIFIER', 6);
DEFINE('GICON_LOCK', 7); define('GICON_LOCK', 7);
DEFINE('GICON_STOP', 8); define('GICON_STOP', 8);
DEFINE('GICON_WARNINGYELLOW', 9); define('GICON_WARNINGYELLOW', 9);
DEFINE('GICON_FOLDEROPEN', 10); define('GICON_FOLDEROPEN', 10);
DEFINE('GICON_FOLDER', 11); define('GICON_FOLDER', 11);
DEFINE('GICON_TEXTIMPORTANT', 12); define('GICON_TEXTIMPORTANT', 12);
class PredefIcons class PredefIcons
{ {
@ -1226,7 +1266,7 @@ class PredefIcons
return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1])); return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
} }
public function PredefIcons() public function __construct()
{ {
//========================================================== //==========================================================
// warning.png // warning.png
@ -1526,7 +1566,7 @@ class IconImage
private $iyalign='center'; private $iyalign='center';
private $iScale=1.0; private $iScale=1.0;
public function IconImage($aIcon, $aScale=1) public function __construct($aIcon, $aScale=1)
{ {
global $_gPredefIcons ; global $_gPredefIcons ;
if (is_string($aIcon)) { if (is_string($aIcon)) {
@ -1601,6 +1641,7 @@ class TextProperty
private $iFFamily=FF_FONT1; private $iFFamily=FF_FONT1;
private $iFStyle=FS_NORMAL; private $iFStyle=FS_NORMAL;
private $iFSize=10; private $iFSize=10;
private $iFontArray=array();
private $iColor="black"; private $iColor="black";
private $iText=""; private $iText="";
private $iHAlign="left"; private $iHAlign="left";
@ -1608,7 +1649,7 @@ class TextProperty
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function TextProperty($aTxt='') public function __construct($aTxt='')
{ {
$this->iText = $aTxt; $this->iText = $aTxt;
} }
@ -1693,6 +1734,16 @@ class TextProperty
$this->iFSize = $aFSize; $this->iFSize = $aFSize;
} }
public function SetColumnFonts($aFontArray)
{
if (!is_array($aFontArray) || count($aFontArray[0]) != 3) {
JpGraphError::RaiseL(6033);
// 'Array of fonts must contain arrays with 3 elements, i.e. (Family, Style, Size)'
}
$this->iFontArray = $aFontArray;
}
public function IsColumns() public function IsColumns()
{ {
return is_array($this->iText) ; return is_array($this->iText) ;
@ -1709,7 +1760,7 @@ class TextProperty
if (strlen($this->iText) == 0) { if (strlen($this->iText) == 0) {
return 0; return 0;
} }
$tmp = split("\t", $this->iText); $tmp = preg_split('/\t/', $this->iText);
if (count($tmp) <= 1 || !$aUseTabs) { if (count($tmp) <= 1 || !$aUseTabs) {
$w = $aImg->GetTextWidth($this->iText); $w = $aImg->GetTextWidth($this->iText);
return $w + 2*$extra_margin; return $w + 2*$extra_margin;
@ -1729,7 +1780,13 @@ class TextProperty
// Must be an array of texts. In this case we return the sum of the // Must be an array of texts. In this case we return the sum of the
// length + a fixed margin of 4 pixels on each text string // length + a fixed margin of 4 pixels on each text string
$n = count($this->iText); $n = count($this->iText);
$nf = count($this->iFontArray);
for ($i=0, $w=0; $i < $n; ++$i) { for ($i=0, $w=0; $i < $n; ++$i) {
if ($i < $nf) {
$aImg->SetFont($this->iFontArray[$i][0], $this->iFontArray[$i][1], $this->iFontArray[$i][2]);
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
$tmp = $this->iText[$i]; $tmp = $this->iText[$i];
if (is_string($tmp)) { if (is_string($tmp)) {
$w += $aImg->GetTextWidth($tmp)+$extra_margin; $w += $aImg->GetTextWidth($tmp)+$extra_margin;
@ -1754,10 +1811,16 @@ class TextProperty
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize); $aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_array($this->iText)) { if (is_array($this->iText)) {
$n = count($this->iText); $n = count($this->iText);
$nf = count($this->iFontArray);
for ($i=0, $w=array(); $i < $n; ++$i) { for ($i=0, $w=array(); $i < $n; ++$i) {
$tmp = $this->iText[$i]; $tmp = $this->iText[$i];
if (is_string($tmp)) { if (is_string($tmp)) {
$w[$i] = $aImg->GetTextWidth($this->iText[$i])+$aMargin; if ($i < $nf) {
$aImg->SetFont($this->iFontArray[$i][0], $this->iFontArray[$i][1], $this->iFontArray[$i][2]);
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
$w[$i] = $aImg->GetTextWidth($tmp)+$aMargin;
} else { } else {
if (is_object($tmp) === false) { if (is_object($tmp) === false) {
JpGraphError::RaiseL(6012); JpGraphError::RaiseL(6012);
@ -1774,8 +1837,23 @@ class TextProperty
// Get total height of text // Get total height of text
public function GetHeight($aImg) public function GetHeight($aImg)
{ {
$nf = count($this->iFontArray);
$maxheight = -1;
if ($nf > 0) {
// We have to find out the largest font and take that one as the
// height of the row
for ($i=0; $i < $nf; ++$i) {
$aImg->SetFont($this->iFontArray[$i][0], $this->iFontArray[$i][1], $this->iFontArray[$i][2]);
$height = $aImg->GetFontHeight();
$maxheight = max($height, $maxheight);
}
}
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize); $aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
return $aImg->GetFontHeight(); $height = $aImg->GetFontHeight();
$maxheight = max($height, $maxheight);
return $maxheight;
} }
// Unhide/hide the text // Unhide/hide the text
@ -1793,16 +1871,15 @@ class TextProperty
$aImg->SetColor($this->iColor); $aImg->SetColor($this->iColor);
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize); $aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
$aImg->SetTextAlign($this->iHAlign, $this->iVAlign); $aImg->SetTextAlign($this->iHAlign, $this->iVAlign);
if ($this->GetNbrTabs() <= 1) { if ($this->GetNbrTabs() < 1) {
if (is_string($this->iText)) { if (is_string($this->iText)) {
// Get rid of any "\t" characters and stroke string
if (is_array($aX)) { if (is_array($aX)) {
$aX=$aX[0]; $aX=$aX[0];
} }
if (is_array($aY)) { if (is_array($aY)) {
$aY=$aY[0]; $aY=$aY[0];
} }
$aImg->StrokeText($aX, $aY, str_replace("\t", " ", $this->iText)); $aImg->StrokeText($aX, $aY, $this->iText);
} elseif (is_array($this->iText) && ($n = count($this->iText)) > 0) { } elseif (is_array($this->iText) && ($n = count($this->iText)) > 0) {
$ax = is_array($aX) ; $ax = is_array($aX) ;
$ay = is_array($aY) ; $ay = is_array($aY) ;
@ -1823,14 +1900,26 @@ class TextProperty
if (is_object($tmp)) { if (is_object($tmp)) {
$tmp->Stroke($aImg, $aX[$i], $aY[$i]); $tmp->Stroke($aImg, $aX[$i], $aY[$i]);
} else { } else {
if ($i < count($this->iFontArray)) {
$font = $this->iFontArray[$i];
$aImg->SetFont($font[0], $font[1], $font[2]);
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
$aImg->StrokeText($aX[$i], $aY[$i], str_replace("\t", " ", $tmp)); $aImg->StrokeText($aX[$i], $aY[$i], str_replace("\t", " ", $tmp));
} }
} }
} }
} else { } else {
$tmp = split("\t", $this->iText); $tmp = preg_split('/\t/', $this->iText);
$n = min(count($tmp), count($aX)); $n = min(count($tmp), count($aX));
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
if ($i < count($this->iFontArray)) {
$font = $this->iFontArray[$i];
$aImg->SetFont($font[0], $font[1], $font[2]);
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
$aImg->StrokeText($aX[$i], $aY, $tmp[$i]); $aImg->StrokeText($aX[$i], $aY, $tmp[$i]);
} }
} }
@ -1864,7 +1953,7 @@ class HeaderProperty
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function HeaderProperty() public function __construct()
{ {
$this->grid = new LineProperty(); $this->grid = new LineProperty();
} }
@ -1881,6 +1970,11 @@ class HeaderProperty
$this->iIntervall = $aInt; $this->iIntervall = $aInt;
} }
public function SetInterval($aInt)
{
$this->iIntervall = $aInt;
}
public function GetIntervall() public function GetIntervall()
{ {
return $this->iIntervall ; return $this->iIntervall ;
@ -1997,7 +2091,6 @@ class GanttScale
// Out image to stroke the scale to // Out image to stroke the scale to
private $iImg; private $iImg;
private $iTableHeaderBackgroundColor="white"; private $iTableHeaderBackgroundColor="white";
private $iTableHeaderFrameColor="black"; private $iTableHeaderFrameColor="black";
private $iTableHeaderFrameWeight=1; private $iTableHeaderFrameWeight=1;
private $iAvailableHeight=-1; private $iAvailableHeight=-1;
@ -2009,7 +2102,7 @@ class GanttScale
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function GanttScale($aImg) public function __construct($aImg)
{ {
$this->iImg = $aImg; $this->iImg = $aImg;
$this->iDateLocale = new DateLocale(); $this->iDateLocale = new DateLocale();
@ -2404,21 +2497,26 @@ class GanttScale
} }
// Get screen coordinatesz for the vertical position for a bar // Get screen coordinatesz for the vertical position for a bar
public function TranslateVertPos($aPos) public function TranslateVertPos($aPos, $atTop=false)
{ {
$img=$this->iImg; $img=$this->iImg;
$ph=$this->iAvailableHeight;
if ($aPos > $this->iVertLines) { if ($aPos > $this->iVertLines) {
JpGraphError::RaiseL(6015, $aPos); JpGraphError::RaiseL(6015, $aPos);
} }
// 'Illegal vertical position %d' // 'Illegal vertical position %d'
if ($this->iVertLayout == GANTT_EVEN) { if ($this->iVertLayout == GANTT_EVEN) {
// Position the top bar at 1 vert spacing from the scale // Position the top bar at 1 vert spacing from the scale
return round($img->top_margin + $this->iVertHeaderSize + ($aPos+1)*$this->iVertSpacing); $pos = round($img->top_margin + $this->iVertHeaderSize + ($aPos+1)*$this->iVertSpacing);
} else { } else {
// position the top bar at 1/2 a vert spacing from the scale // position the top bar at 1/2 a vert spacing from the scale
return round($img->top_margin + $this->iVertHeaderSize + $this->iTopPlotMargin + ($aPos+1)*$this->iVertSpacing); $pos = round($img->top_margin + $this->iVertHeaderSize + $this->iTopPlotMargin + ($aPos+1)*$this->iVertSpacing);
} }
if ($atTop) {
$pos -= $this->iVertSpacing;
}
return $pos;
} }
// What is the vertical spacing? // What is the vertical spacing?
@ -2539,8 +2637,6 @@ class GanttScale
} }
$img->StrokeText(round($x+$width/2), round($yb-$this->minute->iTitleVertMargin), $txt); $img->StrokeText(round($x+$width/2), round($yb-$this->minute->iTitleVertMargin), $txt);
// FIXME: The rounding problem needs to be solved properly ...
//
// Fix a rounding problem the wrong way .. // Fix a rounding problem the wrong way ..
// If we also have hour scale then don't draw the firsta or last // If we also have hour scale then don't draw the firsta or last
// gridline since that will be overwritten by the hour scale gridline if such exists. // gridline since that will be overwritten by the hour scale gridline if such exists.
@ -2826,8 +2922,8 @@ class GanttScale
$txtOffset = 3; $txtOffset = 3;
} else { } else {
JpGraphError::RaiseL(6021); JpGraphError::RaiseL(6021);
}
//("Unknown formatting style for week."); //("Unknown formatting style for week.");
}
for ($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) { for ($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) {
$img->PushColor($this->week->iTextColor); $img->PushColor($this->week->iTextColor);
@ -3097,8 +3193,8 @@ class GanttScale
{ {
if (!$this->IsRangeSet()) { if (!$this->IsRangeSet()) {
JpGraphError::RaiseL(6022); JpGraphError::RaiseL(6022);
}
//("Gantt scale has not been specified."); //("Gantt scale has not been specified.");
}
$img=$this->iImg; $img=$this->iImg;
// If minutes are displayed then hour interval must be 1 // If minutes are displayed then hour interval must be 1
@ -3134,6 +3230,7 @@ class GanttScale
// Now we can calculate the correct scaling factor for each vertical position // Now we can calculate the correct scaling factor for each vertical position
$this->iAvailableHeight = $img->height - $img->top_margin - $img->bottom_margin - $offd; $this->iAvailableHeight = $img->height - $img->top_margin - $img->bottom_margin - $offd;
$this->iVertHeaderSize = $offmin; $this->iVertHeaderSize = $offmin;
if ($this->iVertSpacing == -1) { if ($this->iVertSpacing == -1) {
$this->iVertSpacing = $this->iAvailableHeight / $this->iVertLines; $this->iVertSpacing = $this->iAvailableHeight / $this->iVertLines;
@ -3156,7 +3253,7 @@ class GanttConstraint
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function GanttConstraint($aRow, $aType, $aColor, $aArrowSize, $aArrowType) public function __construct($aRow, $aType, $aColor, $aArrowSize, $aArrowType)
{ {
$this->iConstrainType = $aType; $this->iConstrainType = $aType;
$this->iConstrainRow = $aRow; $this->iConstrainRow = $aRow;
@ -3186,10 +3283,10 @@ class GanttPlotObject
public $iVPos=0; // Vertical position public $iVPos=0; // Vertical position
protected $iLabelLeftMargin=2; // Title margin protected $iLabelLeftMargin=2; // Title margin
public function GanttPlotObject() public function __construct()
{ {
$this->title = new TextProperty(); $this->title = new TextProperty();
$this->title->Align("left", "center"); $this->title->Align('left', 'center');
$this->caption = new TextProperty(); $this->caption = new TextProperty();
} }
@ -3236,12 +3333,6 @@ class GanttPlotObject
$this->iConstrainPos = array($xt,$yt,$xb,$yb); $this->iConstrainPos = array($xt,$yt,$xb,$yb);
} }
/*
function GetConstrain() {
return array($this->iConstrainRow,$this->iConstrainType);
}
*/
public function GetMinDate() public function GetMinDate()
{ {
return $this->iStart; return $this->iStart;
@ -3298,8 +3389,8 @@ class Progress
{ {
if ($aProg < 0.0 || $aProg > 1.0) { if ($aProg < 0.0 || $aProg > 1.0) {
JpGraphError::RaiseL(6027); JpGraphError::RaiseL(6027);
}
//("Progress value must in range [0, 1]"); //("Progress value must in range [0, 1]");
}
$this->iProgress = $aProg; $this->iProgress = $aProg;
} }
@ -3321,8 +3412,8 @@ class Progress
} }
} }
DEFINE('GANTT_HGRID1', 0); define('GANTT_HGRID1', 0);
DEFINE('GANTT_HGRID2', 1); define('GANTT_HGRID2', 1);
//=================================================== //===================================================
// CLASS HorizontalGridLine // CLASS HorizontalGridLine
@ -3337,7 +3428,7 @@ class HorizontalGridLine
private $line=null; private $line=null;
private $iStart=0; // 0=from left margin, 1=just along header private $iStart=0; // 0=from left margin, 1=just along header
public function HorizontalGridLine() public function __construct()
{ {
$this->line = new LineProperty(); $this->line = new LineProperty();
$this->line->SetColor('gray@0.4'); $this->line->SetColor('gray@0.4');
@ -3429,11 +3520,14 @@ class GanttBar extends GanttPlotObject
private $iPattern=GANTT_RDIAG; private $iPattern=GANTT_RDIAG;
private $iPatternColor="blue"; private $iPatternColor="blue";
private $iPatternDensity=95; private $iPatternDensity=95;
private $iBreakStyle=false;
private $iBreakLineStyle='dotted';
private $iBreakLineWeight=1;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function GanttBar($aPos, $aLabel, $aStart, $aEnd, $aCaption="", $aHeightFactor=0.6) public function __construct($aPos, $aLabel, $aStart, $aEnd, $aCaption="", $aHeightFactor=0.6)
{ {
parent::GanttPlotObject(); parent::__construct();
$this->iStart = $aStart; $this->iStart = $aStart;
// Is the end date given as a date or as number of days added to start date? // Is the end date given as a date or as number of days added to start date?
if (is_string($aEnd)) { if (is_string($aEnd)) {
@ -3467,6 +3561,13 @@ class GanttBar extends GanttPlotObject
$this->iShadowColor=$aColor; $this->iShadowColor=$aColor;
} }
public function SetBreakStyle($aFlg=true, $aLineStyle='dotted', $aLineWeight=1)
{
$this->iBreakStyle = $aFlg;
$this->iBreakLineStyle = $aLineStyle;
$this->iBreakLineWeight = $aLineWeight;
}
public function GetMaxDate() public function GetMaxDate()
{ {
return $this->iEnd; return $this->iEnd;
@ -3528,14 +3629,13 @@ class GanttBar extends GanttPlotObject
$vs = $this->iHeightFactor; $vs = $this->iHeightFactor;
} else { } else {
JpGraphError::RaiseL(6028, $this->iHeightFactor); JpGraphError::RaiseL(6028, $this->iHeightFactor);
}
// ("Specified height (".$this->iHeightFactor.") for gantt bar is out of range."); // ("Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
}
// Clip date to min max dates to show // Clip date to min max dates to show
$st = $aScale->NormalizeDate($this->iStart); $st = $aScale->NormalizeDate($this->iStart);
$en = $aScale->NormalizeDate($this->iEnd); $en = $aScale->NormalizeDate($this->iEnd);
$limst = max($st, $aScale->iStartDate); $limst = max($st, $aScale->iStartDate);
$limen = min($en, $aScale->iEndDate); $limen = min($en, $aScale->iEndDate);
@ -3582,8 +3682,19 @@ class GanttBar extends GanttPlotObject
// Remember the positions for the bar // Remember the positions for the bar
$this->SetConstrainPos($xt, $yt, $xb, $yb); $this->SetConstrainPos($xt, $yt, $xb, $yb);
$prect->ShowFrame(false); $prect->ShowFrame(false);
$prect->SetBackground($this->iFillColor); $prect->SetBackground($this->iFillColor);
if ($this->iBreakStyle) {
$aImg->SetColor($this->iFrameColor);
$olds = $aImg->SetLineStyle($this->iBreakLineStyle);
$oldw = $aImg->SetLineWeight($this->iBreakLineWeight);
$aImg->StyleLine($xt, $yt, $xb, $yt);
$aImg->StyleLine($xt, $yb, $xb, $yb);
$aImg->SetLineStyle($olds);
$aImg->SetLineWeight($oldw);
} else {
if ($this->iShadow) { if ($this->iShadow) {
$aImg->SetColor($this->iFrameColor); $aImg->SetColor($this->iFrameColor);
$aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor); $aImg->ShadowRectangle($xt, $yt, $xb, $yb, $this->iFillColor, $this->iShadowWidth, $this->iShadowColor);
@ -3595,7 +3706,7 @@ class GanttBar extends GanttPlotObject
$aImg->SetColor($this->iFrameColor); $aImg->SetColor($this->iFrameColor);
$aImg->Rectangle($xt, $yt, $xb, $yb); $aImg->Rectangle($xt, $yt, $xb, $yb);
} }
}
// CSIM for bar // CSIM for bar
if (! empty($this->csimtarget)) { if (! empty($this->csimtarget)) {
$coords = "$xt,$yt,$xb,$yt,$xb,$yb,$xt,$yb"; $coords = "$xt,$yt,$xb,$yt,$xb,$yb,$xt,$yb";
@ -3689,9 +3800,9 @@ class MileStone extends GanttPlotObject
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function MileStone($aVPos, $aLabel, $aDate, $aCaption="") public function __construct($aVPos, $aLabel, $aDate, $aCaption="")
{ {
GanttPlotObject::GanttPlotObject(); GanttPlotObject::__construct();
$this->caption->Set($aCaption); $this->caption->Set($aCaption);
$this->caption->Align("left", "center"); $this->caption->Align("left", "center");
$this->caption->SetFont(FF_FONT1, FS_BOLD); $this->caption->SetFont(FF_FONT1, FS_BOLD);
@ -3783,9 +3894,9 @@ class MileStone extends GanttPlotObject
class TextPropertyBelow extends TextProperty class TextPropertyBelow extends TextProperty
{ {
public function TextPropertyBelow($aTxt='') public function __construct($aTxt='')
{ {
parent::TextProperty($aTxt); parent::__construct($aTxt);
} }
public function GetColWidth($aImg, $aMargin=0) public function GetColWidth($aImg, $aMargin=0)
@ -3800,13 +3911,15 @@ class GanttVLine extends GanttPlotObject
{ {
private $iLine; private $iLine;
private $title_margin=3; private $title_margin=3;
private $iDayOffset=1; private $iDayOffset=0.5;
private $iStartRow = -1;
private $iEndRow = -1;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function GanttVLine($aDate, $aTitle="", $aColor="black", $aWeight=3, $aStyle="dashed") public function __construct($aDate, $aTitle="", $aColor="darkred", $aWeight=2, $aStyle="solid")
{ {
GanttPlotObject::GanttPlotObject(); GanttPlotObject::__construct();
$this->iLine = new LineProperty(); $this->iLine = new LineProperty();
$this->iLine->SetColor($aColor); $this->iLine->SetColor($aColor);
$this->iLine->SetWeight($aWeight); $this->iLine->SetWeight($aWeight);
@ -3819,12 +3932,20 @@ class GanttVLine extends GanttPlotObject
//--------------- //---------------
// PUBLIC METHODS // PUBLIC METHODS
// Set start and end rows for the VLine. By default the entire heigh of the
// Gantt chart is used
public function SetRowSpan($aStart, $aEnd=-1)
{
$this->iStartRow = $aStart;
$this->iEndRow = $aEnd;
}
public function SetDayOffset($aOff=0.5) public function SetDayOffset($aOff=0.5)
{ {
if ($aOff < 0.0 || $aOff > 1.0) { if ($aOff < 0.0 || $aOff > 1.0) {
JpGraphError::RaiseL(6029); JpGraphError::RaiseL(6029);
}
//("Offset for vertical line must be in range [0,1]"); //("Offset for vertical line must be in range [0,1]");
}
$this->iDayOffset = $aOff; $this->iDayOffset = $aOff;
} }
@ -3833,6 +3954,11 @@ class GanttVLine extends GanttPlotObject
$this->title_margin = $aMarg; $this->title_margin = $aMarg;
} }
public function SetWeight($aWeight)
{
$this->iLine->SetWeight($aWeight);
}
public function Stroke($aImg, $aScale) public function Stroke($aImg, $aScale)
{ {
$d = $aScale->NormalizeDate($this->iStart); $d = $aScale->NormalizeDate($this->iStart);
@ -3842,9 +3968,20 @@ class GanttVLine extends GanttPlotObject
if ($this->iDayOffset != 0.0) { if ($this->iDayOffset != 0.0) {
$d += 24*60*60*$this->iDayOffset; $d += 24*60*60*$this->iDayOffset;
} }
$x = $aScale->TranslateDate($d); $x = $aScale->TranslateDate($d);//d=1006858800,
if ($this->iStartRow > -1) {
$y1 = $aScale->TranslateVertPos($this->iStartRow, true) ;
} else {
$y1 = $aScale->iVertHeaderSize+$aImg->top_margin; $y1 = $aScale->iVertHeaderSize+$aImg->top_margin;
}
if ($this->iEndRow > -1) {
$y2 = $aScale->TranslateVertPos($this->iEndRow);
} else {
$y2 = $aImg->height - $aImg->bottom_margin; $y2 = $aImg->height - $aImg->bottom_margin;
}
$this->iLine->Stroke($aImg, $x, $y1, $x, $y2); $this->iLine->Stroke($aImg, $x, $y1, $x, $y2);
$this->title->Align("center", "top"); $this->title->Align("center", "top");
$this->title->Stroke($aImg, $x, $y2+$this->title_margin); $this->title->Stroke($aImg, $x, $y2+$this->title_margin);
@ -3866,7 +4003,7 @@ class LinkArrow
private $iSize=ARROW_S2; private $iSize=ARROW_S2;
private $iColor='black'; private $iColor='black';
public function LinkArrow($x, $y, $aDirection, $aType=ARROWT_SOLID, $aSize=ARROW_S2) public function __construct($x, $y, $aDirection, $aType=ARROWT_SOLID, $aSize=ARROW_S2)
{ {
$this->iDirection = $aDirection; $this->iDirection = $aDirection;
$this->iType = $aType; $this->iType = $aType;
@ -3949,7 +4086,7 @@ class GanttLink
private $iArrowSize=ARROW_S2; private $iArrowSize=ARROW_S2;
private $iArrowType=ARROWT_SOLID; private $iArrowType=ARROWT_SOLID;
public function GanttLink($x1=0, $y1=0, $x2=0, $y2=0) public function __construct($x1=0, $y1=0, $x2=0, $y2=0)
{ {
$this->ix1 = $x1; $this->ix1 = $x1;
$this->ix2 = $x2; $this->ix2 = $x2;

View file

@ -1,11 +1,11 @@
<?php <?php
//======================================================================= //=======================================================================
// File: JPGRAPH_GB2312.PHP // File: JPGRAPH_GB2312.PHP
// Description: PHP4 Graph Plotting library. Chinese font conversions // Description: Chinese font conversions
// Created: 2003-05-30 // Created: 2003-05-30
// Ver: $Id: jpgraph_gb2312.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_gb2312.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================

View file

@ -3,25 +3,25 @@
// File: JPGRAPH_GRADIENT.PHP // File: JPGRAPH_GRADIENT.PHP
// Description: Create a color gradient // Description: Create a color gradient
// Created: 2003-02-01 // Created: 2003-02-01
// Ver: $Id: jpgraph_gradient.php 947 2007-10-19 22:14:19Z ljp $ // Ver: $Id: jpgraph_gradient.php 1761 2009-08-01 08:31:28Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
// Styles for gradient color fill // Styles for gradient color fill
DEFINE("GRAD_VER", 1); define("GRAD_VER", 1);
DEFINE("GRAD_VERT", 1); define("GRAD_VERT", 1);
DEFINE("GRAD_HOR", 2); define("GRAD_HOR", 2);
DEFINE("GRAD_MIDHOR", 3); define("GRAD_MIDHOR", 3);
DEFINE("GRAD_MIDVER", 4); define("GRAD_MIDVER", 4);
DEFINE("GRAD_CENTER", 5); define("GRAD_CENTER", 5);
DEFINE("GRAD_WIDE_MIDVER", 6); define("GRAD_WIDE_MIDVER", 6);
DEFINE("GRAD_WIDE_MIDHOR", 7); define("GRAD_WIDE_MIDHOR", 7);
DEFINE("GRAD_LEFT_REFLECTION", 8); define("GRAD_LEFT_REFLECTION", 8);
DEFINE("GRAD_RIGHT_REFLECTION", 9); define("GRAD_RIGHT_REFLECTION", 9);
DEFINE("GRAD_RAISED_PANEL", 10); define("GRAD_RAISED_PANEL", 10);
DEFINE("GRAD_DIAGONAL", 11); define("GRAD_DIAGONAL", 11);
//=================================================== //===================================================
// CLASS Gradient // CLASS Gradient
@ -34,7 +34,7 @@ class Gradient
private $numcolors=100; private $numcolors=100;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function Gradient(&$img) public function __construct(&$img)
{ {
$this->img = $img; $this->img = $img;
} }
@ -55,9 +55,10 @@ class Gradient
// $style Which way is the gradient oriented? // $style Which way is the gradient oriented?
public function FilledRectangle($xl, $yt, $xr, $yb, $from_color, $to_color, $style=1) public function FilledRectangle($xl, $yt, $xr, $yb, $from_color, $to_color, $style=1)
{ {
$this->img->SetLineWeight(1);
switch ($style) { switch ($style) {
case GRAD_VER: case GRAD_VER:
$steps = ceil(abs($xr-$xl)); $steps = ceil(abs($xr-$xl)+1);
$delta = $xr>=$xl ? 1 : -1; $delta = $xr>=$xl ? 1 : -1;
$this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors); $this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors);
for ($i=0, $x=$xl; $i < $steps; ++$i) { for ($i=0, $x=$xl; $i < $steps; ++$i) {
@ -68,7 +69,7 @@ class Gradient
break; break;
case GRAD_HOR: case GRAD_HOR:
$steps = ceil(abs($yb-$yt)); $steps = ceil(abs($yb-$yt)+1);
$delta = $yb >= $yt ? 1 : -1; $delta = $yb >= $yt ? 1 : -1;
$this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors); $this->GetColArray($from_color, $to_color, $steps, $colors, $this->numcolors);
for ($i=0,$y=$yt; $i < $steps; ++$i) { for ($i=0,$y=$yt; $i < $steps; ++$i) {
@ -406,6 +407,7 @@ class Gradient
if ($arr_size==0) { if ($arr_size==0) {
return; return;
} }
// If color is given as text get it's corresponding r,g,b values // If color is given as text get it's corresponding r,g,b values
$from_color = $this->img->rgb->Color($from_color); $from_color = $this->img->rgb->Color($from_color);
$to_color = $this->img->rgb->Color($to_color); $to_color = $this->img->rgb->Color($to_color);
@ -415,8 +417,8 @@ class Gradient
$bdelta=($to_color[2]-$from_color[2])/$numcols; $bdelta=($to_color[2]-$from_color[2])/$numcols;
$colorsperstep = $numcols/$arr_size; $colorsperstep = $numcols/$arr_size;
$prevcolnum = -1; $prevcolnum = -1;
$from_alpha = $from_color[3]; $from_alpha = floatval($from_color[3]);
$to_alpha = $to_color[3]; $to_alpha = floatval($to_color[3]);
$adelta = ($to_alpha - $from_alpha) / $numcols ; $adelta = ($to_alpha - $from_alpha) / $numcols ;
for ($i=0; $i < $arr_size; ++$i) { for ($i=0; $i < $arr_size; ++$i) {
$colnum = floor($colorsperstep*$i); $colnum = floor($colorsperstep*$i);

View file

@ -1,11 +1,11 @@
<?php <?php
//======================================================================= //=======================================================================
// File: JPGRAPH_ICONPLOT.PHP // File: JPGRAPH_ICONPLOT.PHP
// Description: PHP4 Graph Plotting library. Extension module. // Description: Extension module to add icons to plots
// Created: 2004-02-18 // Created: 2004-02-18
// Ver: $Id: jpgraph_iconplot.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_iconplot.php 1404 2009-06-28 15:25:41Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
@ -31,7 +31,7 @@ class IconPlot
private $iImgString=''; private $iImgString='';
public function IconPlot($aFile="", $aX=0, $aY=0, $aScale=1.0, $aMix=100) public function __construct($aFile="", $aX=0, $aY=0, $aScale=1.0, $aMix=100)
{ {
$this->iFile = $aFile; $this->iFile = $aFile;
$this->iX=$aX; $this->iX=$aX;
@ -143,15 +143,15 @@ class IconPlot
return true; return true;
} }
public function Stroke($aImg, $axscale, $ayscale) public function Stroke($aImg, $axscale=null, $ayscale=null)
{ {
$this->StrokeWithScale($aImg, $axscale, $ayscale); $this->StrokeWithScale($aImg, $axscale, $ayscale);
} }
public function StrokeWithScale($aImg, $axscale, $ayscale) public function StrokeWithScale($aImg, $axscale, $ayscale)
{ {
if ($this->iScalePosX === null || if ($this->iScalePosX === null || $this->iScalePosY === null ||
$this->iScalePosY === null) { $axscale === null || $ayscale === null) {
$this->_Stroke($aImg); $this->_Stroke($aImg);
} else { } else {
$this->_Stroke( $this->_Stroke(

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_IMGTRANS.PHP // File: JPGRAPH_IMGTRANS.PHP
// Description: Extension for JpGraph to do some simple img transformations // Description: Extension for JpGraph to do some simple img transformations
// Created: 2003-09-06 // Created: 2003-09-06
// Ver: $Id: jpgraph_imgtrans.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_imgtrans.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@ -16,7 +16,7 @@ class ImgTrans
{ {
private $gdImg=null; private $gdImg=null;
public function ImgTrans($aGdImg) public function __construct($aGdImg)
{ {
// Constructor // Constructor
$this->gdImg = $aGdImg; $this->gdImg = $aGdImg;

View file

@ -3,51 +3,14 @@
// File: JPGRAPH_LED.PHP // File: JPGRAPH_LED.PHP
// Description: Module to generate Dotted LED-like digits // Description: Module to generate Dotted LED-like digits
// Created: 2006-11-26 // Created: 2006-11-26
// Ver: $Id: jpgraph_led.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_led.php 1674 2009-07-22 19:42:23Z ljp $
// //
// Copyright 2006 (c) Aditus Consulting. All rights reserved. // Copyright 2006 (c) Asial Corporation. All rights reserved.
// //
// Changed: 2007-08-06 by Alexander Kurochkin (inspector@list.ru) // Changed: 2007-08-06 by Alexander Kurochkin (inspector@list.ru)
// Added: Decipher 4-bit mask.
// Added: Chars Latin > 'L', Cyrilic, other symbols and special symbols for
// simulation some latin and cyrilic chars.
// Added: New Color schemas.
// Deleted: Some minor bugs (StrokeNumber first parameter may be eq empty string,
// false or null - added check see line 294;
// change color schema check for easy maintenance: 291;
// change check on key exist in chars array: moved from StrokeNumber
// function to _GetLED: 251;
//
//======================================================================== //========================================================================
// Samples for troubled chars: "Ô¡ Ø\r Ù\r Û| ÞÎ Ì\r >\n< W\r" // Constants for color schema
// Ô Ø Ù Û Þ Ì Æ W
//----------------------------------------------------------------------------
// Each character is encoded line by line with the "On"-LEDs corresponding to
// a '1' in the bianry mask of 4 bits.
//
// 4-bit mask:
//
// 0 ____
// 1 ___x
// 2 __x_
// 3 __xx
// 4 _x__
// 5 _x_x
// 6 _xx_
// 7 _xxx
// 8 x___
// 9 x__x
// 10 x_x_
// 11 x_xx
// 12 xx__
// 13 xx_x
// 14 xxx_
// 15 xxxx
//----------------------------------------------------------------------------
// Constants for color schema. See definition of iColorSchema below
DEFINE('LEDC_RED', 0); DEFINE('LEDC_RED', 0);
DEFINE('LEDC_GREEN', 1); DEFINE('LEDC_GREEN', 1);
DEFINE('LEDC_BLUE', 2); DEFINE('LEDC_BLUE', 2);
@ -64,7 +27,13 @@ DEFINE('LEDC_TEAL', 12);
DEFINE('LEDC_STEELBLUE', 13); DEFINE('LEDC_STEELBLUE', 13);
DEFINE('LEDC_NAVY', 14); DEFINE('LEDC_NAVY', 14);
DEFINE('LEDC_INVERTGRAY', 15); DEFINE('LEDC_INVERTGRAY', 15);
// ! It correlate with two-dimensional array $iColorSchema
// Check that mb_strlen() is available
if (! function_exists('mb_strlen')) {
JpGraphError::RaiseL(25500);
//'Multibyte strings must be enabled in the PHP installation in order to run the LED module
// so that the function mb_strlen() is available. See PHP documentation for more information.'
}
//======================================================================== //========================================================================
// CLASS DigitalLED74 // CLASS DigitalLED74
@ -95,10 +64,27 @@ class DigitalLED74
LEDC_NAVY => array('navy:1.3','navy:0.95','navy:0.8'),//14 LEDC_NAVY => array('navy:1.3','navy:0.95','navy:0.8'),//14
LEDC_INVERTGRAY => array('darkgray','lightgray:1.5','white')//15 LEDC_INVERTGRAY => array('darkgray','lightgray:1.5','white')//15
); );
/* Each line of the character is encoded as a 4 bit value
0 ____
1 ___x
2 __x_
3 __xx
4 _x__
5 _x_x
6 _xx_
7 _xxx
8 x___
9 x__x
10 x_x_
11 x_xx
12 xx__
13 xx_x
14 xxx_
15 xxxx
*/
private $iLEDSpec = array( private $iLEDSpec = array(
0 => array(6,9,11,15,13,9,6), 0 => array(6,9,11,15,13,9,6),
//0 => array(6,9,9,9,9,9,6),
//0 => array(15,9,9,9,9,9,15),
1 => array(2,6,10,2,2,2,2), 1 => array(2,6,10,2,2,2,2),
2 => array(6,9,1,2,4,8,15), 2 => array(6,9,1,2,4,8,15),
3 => array(6,9,1,6,1,9,6), 3 => array(6,9,1,6,1,9,6),
@ -116,7 +102,7 @@ class DigitalLED74
'_' => array(0,0,0,0,0,0,15), '_' => array(0,0,0,0,0,0,15),
'=' => array(0,0,15,0,15,0,0), '=' => array(0,0,15,0,15,0,0),
'+' => array(0,0,4,14,4,0,0), '+' => array(0,0,4,14,4,0,0),
'|' => array(4,4,4,4,4,4,4), //vertical line, used for simulate rus 'Û' '|' => array(4,4,4,4,4,4,4), //vertical line, used for simulate rus 'Ы'
',' => array(0,0,0,0,0,12,4), ',' => array(0,0,0,0,0,12,4),
'.' => array(0,0,0,0,0,12,12), '.' => array(0,0,0,0,0,12,12),
':' => array(12,12,0,0,0,12,12), ':' => array(12,12,0,0,0,12,12),
@ -141,19 +127,19 @@ class DigitalLED74
'&' => array(0,4,10,4,11,10,5), '&' => array(0,4,10,4,11,10,5),
'$' => array(2,7,8,6,1,14,4), '$' => array(2,7,8,6,1,14,4),
' ' => array(0,0,0,0,0,0,0), ' ' => array(0,0,0,0,0,0,0),
'•' => array(0,0,6,6,0,0,0), //149 '•' => array(0,0,6,6,0,0,0), //149
'°' => array(14,10,14,0,0,0,0), //176 '°' => array(14,10,14,0,0,0,0), //176
'†' => array(4,4,14,4,4,4,4), //134 '†' => array(4,4,14,4,4,4,4), //134
'‡' => array(4,4,14,4,14,4,4), //135 '‡' => array(4,4,14,4,14,4,4), //135
'±' => array(0,4,14,4,0,14,0), //177 '±' => array(0,4,14,4,0,14,0), //177
'‰' => array(0,4,2,15,2,4,0), //137 show right arrow '‰' => array(0,4,2,15,2,4,0), //137 show right arrow
'™' => array(0,2,4,15,4,2,0), //156 show left arrow '™' => array(0,2,4,15,4,2,0), //156 show left arrow
' => array(0,0,8,8,0,0,0), //159 show small hi-stick - that need for simulate rus 'Ô' ' => array(0,0,8,8,0,0,0), //159 show small hi-stick - that need for simulate rus 'Ф'
"\t" => array(8,8,8,0,0,0,0), //show hi-stick - that need for simulate rus 'Ó' "\t" => array(8,8,8,0,0,0,0), //show hi-stick - that need for simulate rus 'У'
"\r" => array(8,8,8,8,8,8,8), //vertical line - that need for simulate 'M', 'W' and rus 'Ì','Ø' ,'Ù' "\r" => array(8,8,8,8,8,8,8), //vertical line - that need for simulate 'M', 'W' and rus 'М','Ш' ,'Щ'
"\n" => array(15,15,15,15,15,15,15), //fill up - that need for simulate rus 'Æ' "\n" => array(15,15,15,15,15,15,15), //fill up - that need for simulate rus 'Ж'
"¥" => array(10,5,10,5,10,5,10), //chess "Ґ" => array(10,5,10,5,10,5,10), //chess
"µ" => array(15,0,15,0,15,0,15), //4 horizontal lines "µ" => array(15,0,15,0,15,0,15), //4 horizontal lines
// latin // latin
'A' => array(6,9,9,15,9,9,9), 'A' => array(6,9,9,15,9,9,9),
'B' => array(14,9,9,14,9,9,14), 'B' => array(14,9,9,14,9,9,14),
@ -169,7 +155,6 @@ class DigitalLED74
'L' => array(8,8,8,8,8,8,15), 'L' => array(8,8,8,8,8,8,15),
'M' => array(8,13,10,8,8,8,8),// need to add \r 'M' => array(8,13,10,8,8,8,8),// need to add \r
'N' => array(9,9,13,11,9,9,9), 'N' => array(9,9,13,11,9,9,9),
//'O' => array(0,6,9,9,9,9,6),
'O' => array(6,9,9,9,9,9,6), 'O' => array(6,9,9,9,9,9,6),
'P' => array(14,9,9,14,8,8,8), 'P' => array(14,9,9,14,8,8,8),
'Q' => array(6,9,9,9,13,11,6), 'Q' => array(6,9,9,9,13,11,6),
@ -180,49 +165,48 @@ class DigitalLED74
'V' => array(0,0,0,10,10,10,4), 'V' => array(0,0,0,10,10,10,4),
'W' => array(8,8,8,8,10,13,8),// need to add \r 'W' => array(8,8,8,8,10,13,8),// need to add \r
'X' => array(9,9,6,6,6,9,9), 'X' => array(9,9,6,6,6,9,9),
//'Y' => array(9,9,9,9,6,6,6),
'Y' => array(10,10,10,10,4,4,4), 'Y' => array(10,10,10,10,4,4,4),
'Z' => array(15,1,2,6,4,8,15), 'Z' => array(15,1,2,6,4,8,15),
// russian cp1251 // russian utf-8
' => array(6,9,9,15,9,9,9), 'А' => array(6,9,9,15,9,9,9),
' => array(14,8,8,14,9,9,14), ' => array(14,8,8,14,9,9,14),
' => array(14,9,9,14,9,9,14), 'В' => array(14,9,9,14,9,9,14),
' => array(15,8,8,8,8,8,8), ' => array(15,8,8,8,8,8,8),
' => array(14,9,9,9,9,9,14), ' => array(14,9,9,9,9,9,14),
' => array(15,8,8,14,8,8,15), 'Е' => array(15,8,8,14,8,8,15),
' => array(6,15,8,14,8,8,15), ' => array(6,15,8,14,8,8,15),
//Æ is combine: >\n< //Ж is combine: >\n<
' => array(6,9,1,2,1,9,6), 'З' => array(6,9,1,2,1,9,6),
' => array(9,9,9,11,13,9,9), ' => array(9,9,9,11,13,9,9),
' => array(13,9,9,11,13,9,9), ' => array(13,9,9,11,13,9,9),
' => array(9,10,12,10,9,9,9), 'К' => array(9,10,12,10,9,9,9),
' => array(7,9,9,9,9,9,9), ' => array(7,9,9,9,9,9,9),
' => array(8,13,10,8,8,8,8),// need to add \r 'М' => array(8,13,10,8,8,8,8),// need to add \r
' => array(9,9,9,15,9,9,9), 'Н' => array(9,9,9,15,9,9,9),
' => array(6,9,9,9,9,9,6), 'О' => array(6,9,9,9,9,9,6),
' => array(15,9,9,9,9,9,9), ' => array(15,9,9,9,9,9,9),
' => array(14,9,9,14,8,8,8), 'Р' => array(14,9,9,14,8,8,8),
' => array(6,9,8,8,8,9,6), 'С' => array(6,9,8,8,8,9,6),
' => array(14,4,4,4,4,4,4), 'Т' => array(14,4,4,4,4,4,4),
' => array(9,9,9,7,1,9,6), 'У' => array(9,9,9,7,1,9,6),
' => array(2,7,10,10,7,2,2),// need to add ¡ ' => array(2,7,10,10,7,2,2),// need to add Ў
' => array(9,9,6,6,6,9,9), 'Х' => array(9,9,6,6,6,9,9),
' => array(10,10,10,10,10,15,1), ' => array(10,10,10,10,10,15,1),
'×' => array(9,9,9,7,1,1,1), ' => array(9,9,9,7,1,1,1),
' => array(10,10,10,10,10,10,15),// \r ' => array(10,10,10,10,10,10,15),// \r
' => array(10,10,10,10,10,15,0),// need to add \r ' => array(10,10,10,10,10,15,0),// need to add \r
' => array(12,4,4,6,5,5,6), ' => array(12,4,4,6,5,5,6),
' => array(8,8,8,14,9,9,14),// need to add | ' => array(8,8,8,14,9,9,14),// need to add |
' => array(8,8,8,14,9,9,14), 'Ь' => array(8,8,8,14,9,9,14),
' => array(6,9,1,7,1,9,6), ' => array(6,9,1,7,1,9,6),
' => array(2,2,2,3,2,2,2),// need to add O ' => array(2,2,2,3,2,2,2),// need to add O
' => array(7,9,9,7,3,5,9) ' => array(7,9,9,7,3,5,9)
); );
private $iSuperSampling = 3; private $iSuperSampling = 3;
private $iMarg = 1; private $iMarg = 1;
private $iRad = 4; private $iRad = 4;
public function DigitalLED74($aRadius = 2, $aMargin= 0.6) public function __construct($aRadius = 2, $aMargin= 0.6)
{ {
$this->iRad = $aRadius; $this->iRad = $aRadius;
$this->iMarg = $aMargin; $this->iMarg = $aMargin;
@ -281,20 +265,27 @@ class DigitalLED74
return $img; return $img;
} }
public function StrokeNumber($aValStr, $aColor = 0)
public function Stroke($aValStr, $aColor = 0, $aFileName = '')
{
$this->StrokeNumber($aValStr, $aColor, $aFileName);
}
public function StrokeNumber($aValStr, $aColor = 0, $aFileName = '')
{ {
if ($aColor < 0 || $aColor >= sizeof($this->iColorSchema)) { if ($aColor < 0 || $aColor >= sizeof($this->iColorSchema)) {
$aColor = 0; $aColor = 0;
} }
if (($n = strlen($aValStr)) == 0) { if (($n = mb_strlen($aValStr, 'utf8')) == 0) {
$aValStr = ' '; $aValStr = ' ';
$n = 1; $n = 1;
} }
for ($i = 0; $i < $n; ++$i) { for ($i = 0; $i < $n; ++$i) {
$d = substr($aValStr, $i, 1); $d = mb_substr($aValStr, $i, 1, 'utf8');
if ($d >= '0' && $d <= '9') { if (ctype_digit($d)) {
$d = (int)$d; $d = (int)$d;
} else { } else {
$d = strtoupper($d); $d = strtoupper($d);
@ -311,7 +302,11 @@ class DigitalLED74
$number_img->Copy($digit_img[$i]->img, $i*$w, 0, 0, 0, $w, $h, $w, $h); $number_img->Copy($digit_img[$i]->img, $i*$w, 0, 0, 0, $w, $h, $w, $h);
} }
if ($aFileName != '') {
$number_img->Stream($aFileName);
} else {
$number_img->Headers(); $number_img->Headers();
$number_img->Stream(); $number_img->Stream();
} }
} }
}

View file

@ -0,0 +1,557 @@
<?php
//=======================================================================
// File: JPGRAPH_LEGEND.INC.PHP
// Description: Class to handle the legend box in the graph that gives
// names on the data series. The number of rows and columns
// in the legend are user specifyable.
// Created: 2001-01-08 (Refactored to separate file 2008-08-01)
// Ver: $Id: jpgraph_legend.inc.php 1926 2010-01-11 16:33:07Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
DEFINE('_DEFAULT_LPM_SIZE', 8); // Default Legend Plot Mark size
//===================================================
// CLASS Legend
// Description: Responsible for drawing the box containing
// all the legend text for the graph
//===================================================
class Legend
{
public $txtcol=array();
public $font_family=FF_DEFAULT;
public $font_style=FS_NORMAL;
public $font_size=8; // old. 12
private $color=array(120,120,120); // Default frame color
private $fill_color=array(245,245,245); // Default fill color
private $shadow=false; // Shadow around legend "box"
private $shadow_color='darkgray';
private $mark_abs_hsize=_DEFAULT_LPM_SIZE;
private $mark_abs_vsize=_DEFAULT_LPM_SIZE;
private $xmargin=10;
private $ymargin=0;
private $shadow_width=2;
private $xlmargin=4;
private $ylinespacing=5;
// We need a separate margin since the baseline of the last text would coincide with the bottom otherwise
private $ybottom_margin = 8;
private $xpos=0.05;
private $ypos=0.15;
private $xabspos=-1;
private $yabspos=-1;
private $halign="right";
private $valign="top";
private $font_color='black';
private $hide=false;
private $layout_n=1;
private $weight=1;
private $frameweight=1;
private $csimareas='';
private $reverse = false ;
private $bkg_gradtype=-1;
private $bkg_gradfrom='lightgray';
private $bkg_gradto='gray';
//---------------
// CONSTRUCTOR
public function __construct()
{
// Empty
}
//---------------
// PUBLIC METHODS
public function Hide($aHide=true)
{
$this->hide=$aHide;
}
public function SetHColMargin($aXMarg)
{
$this->xmargin = $aXMarg;
}
public function SetVColMargin($aSpacing)
{
$this->ylinespacing = $aSpacing ;
}
public function SetLeftMargin($aXMarg)
{
$this->xlmargin = $aXMarg;
}
// Synonym
public function SetLineSpacing($aSpacing)
{
$this->ylinespacing = $aSpacing ;
}
public function SetShadow($aShow='gray', $aWidth=4)
{
if (is_string($aShow)) {
$this->shadow_color = $aShow;
$this->shadow=true;
} else {
$this->shadow = $aShow;
}
$this->shadow_width = $aWidth;
}
public function SetMarkAbsSize($aSize)
{
$this->mark_abs_vsize = $aSize ;
$this->mark_abs_hsize = $aSize ;
}
public function SetMarkAbsVSize($aSize)
{
$this->mark_abs_vsize = $aSize ;
}
public function SetMarkAbsHSize($aSize)
{
$this->mark_abs_hsize = $aSize ;
}
public function SetLineWeight($aWeight)
{
$this->weight = $aWeight;
}
public function SetFrameWeight($aWeight)
{
$this->frameweight = $aWeight;
}
public function SetLayout($aDirection=LEGEND_VERT)
{
$this->layout_n = $aDirection==LEGEND_VERT ? 1 : 99 ;
}
public function SetColumns($aCols)
{
$this->layout_n = $aCols ;
}
public function SetReverse($f=true)
{
$this->reverse = $f ;
}
// Set color on frame around box
public function SetColor($aFontColor, $aColor='black')
{
$this->font_color=$aFontColor;
$this->color=$aColor;
}
public function SetFont($aFamily, $aStyle=FS_NORMAL, $aSize=10)
{
$this->font_family = $aFamily;
$this->font_style = $aStyle;
$this->font_size = $aSize;
}
public function SetPos($aX, $aY, $aHAlign='right', $aVAlign='top')
{
$this->Pos($aX, $aY, $aHAlign, $aVAlign);
}
public function SetAbsPos($aX, $aY, $aHAlign='right', $aVAlign='top')
{
$this->xabspos=$aX;
$this->yabspos=$aY;
$this->halign=$aHAlign;
$this->valign=$aVAlign;
}
public function Pos($aX, $aY, $aHAlign='right', $aVAlign='top')
{
if (!($aX<1 && $aY<1)) {
JpGraphError::RaiseL(25120);//(" Position for legend must be given as percentage in range 0-1");
}
$this->xpos=$aX;
$this->ypos=$aY;
$this->halign=$aHAlign;
$this->valign=$aVAlign;
}
public function SetFillColor($aColor)
{
$this->fill_color=$aColor;
}
public function Clear()
{
$this->txtcol = array();
}
public function Add($aTxt, $aColor, $aPlotmark='', $aLinestyle=0, $csimtarget='', $csimalt='', $csimwintarget='')
{
$this->txtcol[]=array($aTxt,$aColor,$aPlotmark,$aLinestyle,$csimtarget,$csimalt,$csimwintarget);
}
public function GetCSIMAreas()
{
return $this->csimareas;
}
public function SetBackgroundGradient($aFrom='navy', $aTo='silver', $aGradType=2)
{
$this->bkg_gradtype=$aGradType;
$this->bkg_gradfrom = $aFrom;
$this->bkg_gradto = $aTo;
}
public function HasItems()
{
return (boolean)(count($this->txtcol));
}
public function Stroke($aImg)
{
// Constant
$fillBoxFrameWeight=1;
if ($this->hide) {
return;
}
$aImg->SetFont($this->font_family, $this->font_style, $this->font_size);
if ($this->reverse) {
$this->txtcol = array_reverse($this->txtcol);
}
$n=count($this->txtcol);
if ($n == 0) {
return;
}
// Find out the max width and height of each column to be able
// to size the legend box.
$numcolumns = ($n > $this->layout_n ? $this->layout_n : $n);
for ($i=0; $i < $numcolumns; ++$i) {
$colwidth[$i] = $aImg->GetTextWidth($this->txtcol[$i][0]) +
2*$this->xmargin + 2*$this->mark_abs_hsize;
$colheight[$i] = 0;
}
// Find our maximum height in each row
$rows = 0 ;
$rowheight[0] = 0;
for ($i=0; $i < $n; ++$i) {
$h = max($this->mark_abs_vsize, $aImg->GetTextHeight($this->txtcol[$i][0]))+$this->ylinespacing;
// Makes sure we always have a minimum of 1/4 (1/2 on each side) of the mark as space
// between two vertical legend entries
//$h = round(max($h,$this->mark_abs_vsize+$this->ymargin));
//echo "Textheight #$i: tetxheight=".$aImg->GetTextHeight($this->txtcol[$i][0]).', ';
//echo "h=$h ({$this->mark_abs_vsize},{$this->ymargin})<br>";
if ($i % $numcolumns == 0) {
$rows++;
$rowheight[$rows-1] = 0;
}
$rowheight[$rows-1] = max($rowheight[$rows-1], $h)+1;
}
$abs_height = 0;
for ($i=0; $i < $rows; ++$i) {
$abs_height += $rowheight[$i] ;
}
// Make sure that the height is at least as high as mark size + ymargin
$abs_height = max($abs_height, $this->mark_abs_vsize);
$abs_height += $this->ybottom_margin;
// Find out the maximum width in each column
for ($i=$numcolumns; $i < $n; ++$i) {
$colwidth[$i % $numcolumns] = max(
$aImg->GetTextWidth($this->txtcol[$i][0])+2*$this->xmargin+2*$this->mark_abs_hsize,
$colwidth[$i % $numcolumns]
);
}
// Get the total width
$mtw = 0;
for ($i=0; $i < $numcolumns; ++$i) {
$mtw += $colwidth[$i] ;
}
// remove the last rows interpace margin (since there is no next row)
$abs_height -= $this->ylinespacing;
// Find out maximum width we need for legend box
$abs_width = $mtw+$this->xlmargin+($numcolumns-1)*$this->mark_abs_hsize;
if ($this->xabspos === -1 && $this->yabspos === -1) {
$this->xabspos = $this->xpos*$aImg->width ;
$this->yabspos = $this->ypos*$aImg->height ;
}
// Positioning of the legend box
if ($this->halign == 'left') {
$xp = $this->xabspos;
} elseif ($this->halign == 'center') {
$xp = $this->xabspos - $abs_width/2;
} else {
$xp = $aImg->width - $this->xabspos - $abs_width;
}
$yp=$this->yabspos;
if ($this->valign == 'center') {
$yp-=$abs_height/2;
} elseif ($this->valign == 'bottom') {
$yp-=$abs_height;
}
// Stroke legend box
$aImg->SetColor($this->color);
$aImg->SetLineWeight($this->frameweight);
$aImg->SetLineStyle('solid');
if ($this->shadow) {
$aImg->ShadowRectangle(
$xp,
$yp,
$xp+$abs_width+$this->shadow_width+2,
$yp+$abs_height+$this->shadow_width+2,
$this->fill_color,
$this->shadow_width+2,
$this->shadow_color
);
} else {
$aImg->SetColor($this->fill_color);
$aImg->FilledRectangle($xp, $yp, $xp+$abs_width, $yp+$abs_height);
$aImg->SetColor($this->color);
$aImg->Rectangle($xp, $yp, $xp+$abs_width, $yp+$abs_height);
}
if ($this->bkg_gradtype >= 0) {
$grad = new Gradient($aImg);
$grad->FilledRectangle(
$xp+1,
$yp+1,
$xp+$abs_width-3,
$yp+$abs_height-3,
$this->bkg_gradfrom,
$this->bkg_gradto,
$this->bkg_gradtype
);
}
// x1,y1 is the position for the legend marker + text
// The vertical position is the baseline position for the text
// and every marker is adjusted acording to that.
// For multiline texts this get more complicated.
$x1 = $xp + $this->xlmargin;
$y1 = $yp + $rowheight[0] - $this->ylinespacing + 2 ; // The ymargin is included in rowheight
// Now, y1 is the bottom vertical position of the first legend, i.e if
// the legend has multiple lines it is the bottom line.
$grad = new Gradient($aImg);
$patternFactory = null;
// Now stroke each legend in turn
// Each plot has added the following information to the legend
// p[0] = Legend text
// p[1] = Color,
// p[2] = For markers a reference to the PlotMark object
// p[3] = For lines the line style, for gradient the negative gradient style
// p[4] = CSIM target
// p[5] = CSIM Alt text
$i = 1 ;
$row = 0;
foreach ($this->txtcol as $p) {
// STROKE DEBUG BOX
if (_JPG_DEBUG) {
$aImg->SetLineWeight(1);
$aImg->SetColor('red');
$aImg->SetLineStyle('solid');
$aImg->Rectangle($x1, $y1, $xp+$abs_width-1, $y1-$rowheight[$row]);
}
$aImg->SetLineWeight($this->weight);
$x1 = round($x1)+1; // We add one to not collide with the border
$y1=round($y1);
// This is the center offset up from the baseline which is
// considered the "center" of the marks. This gets slightly complicated since
// we need to consider if the text is a multiline paragraph or if it is only
// a single line. The reason is that for single line the y1 corresponds to the baseline
// and that is fine. However for a multiline paragraph there is no single baseline
// and in that case the y1 corresponds to the lowest y for the bounding box. In that
// case we center the mark in the middle of the paragraph
if (!preg_match('/\n/', $p[0])) {
// Single line
$marky = ceil($y1-$this->mark_abs_vsize/2)-1;
} else {
// Paragraph
$marky = $y1 - $aImg->GetTextHeight($p[0])/2;
// echo "y1=$y1, p[o]={$p[0]}, marky=$marky<br>";
}
//echo "<br>Mark #$i: marky=$marky<br>";
$x1 += $this->mark_abs_hsize;
if (!empty($p[2]) && $p[2]->GetType() > -1) {
// Make a plot mark legend. This is constructed with a mark which
// is run through with a line
// First construct a bit of the line that looks exactly like the
// line in the plot
$aImg->SetColor($p[1]);
if (is_string($p[3]) || $p[3]>0) {
$aImg->SetLineStyle($p[3]);
$aImg->StyleLine($x1-$this->mark_abs_hsize, $marky, $x1+$this->mark_abs_hsize, $marky);
}
// Stroke a mark using image
if ($p[2]->GetType() == MARK_IMG) {
$p[2]->Stroke($aImg, $x1, $marky);
}
// Stroke a mark with the standard size
// (As long as it is not an image mark )
if ($p[2]->GetType() != MARK_IMG) {
// Clear any user callbacks since we ont want them called for
// the legend marks
$p[2]->iFormatCallback = '';
$p[2]->iFormatCallback2 = '';
// Since size for circles is specified as the radius
// this means that we must half the size to make the total
// width behave as the other marks
if ($p[2]->GetType() == MARK_FILLEDCIRCLE || $p[2]->GetType() == MARK_CIRCLE) {
$p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize)/2);
$p[2]->Stroke($aImg, $x1, $marky);
} else {
$p[2]->SetSize(min($this->mark_abs_vsize, $this->mark_abs_hsize));
$p[2]->Stroke($aImg, $x1, $marky);
}
}
} elseif (!empty($p[2]) && (is_string($p[3]) || $p[3]>0)) {
// Draw a styled line
$aImg->SetColor($p[1]);
$aImg->SetLineStyle($p[3]);
$aImg->StyleLine($x1-$this->mark_abs_hsize, $marky, $x1+$this->mark_abs_hsize, $marky);
$aImg->StyleLine($x1-$this->mark_abs_hsize, $marky+1, $x1+$this->mark_abs_hsize, $marky+1);
} else {
// Draw a colored box
$color = $p[1] ;
// We make boxes slightly larger to better show
$boxsize = max($this->mark_abs_vsize, $this->mark_abs_hsize) + 2 ;
$ym = $marky-ceil($boxsize/2) ; // Marker y-coordinate
// We either need to plot a gradient or a
// pattern. To differentiate we use a kludge.
// Patterns have a p[3] value of < -100
if ($p[3] < -100) {
// p[1][0] == iPattern, p[1][1] == iPatternColor, p[1][2] == iPatternDensity
if ($patternFactory == null) {
$patternFactory = new RectPatternFactory();
}
$prect = $patternFactory->Create($p[1][0], $p[1][1], 1);
$prect->SetBackground($p[1][3]);
$prect->SetDensity($p[1][2]+1);
$prect->SetPos(new Rectangle($x1, $ym, $boxsize, $boxsize));
$prect->Stroke($aImg);
$prect=null;
} else {
if (is_array($color) && count($color)==2) {
// The client want a gradient color
$grad->FilledRectangle(
$x1-$boxsize/2,
$ym,
$x1+$boxsize/2,
$ym+$boxsize,
$color[0],
$color[1],
-$p[3]
);
} else {
$aImg->SetColor($p[1]);
$aImg->FilledRectangle($x1-$boxsize/2, $ym, $x1+$boxsize/2, $ym+$boxsize);
}
// Draw a plot frame line
$aImg->SetColor($this->color);
$aImg->SetLineWeight($fillBoxFrameWeight);
$aImg->Rectangle(
$x1-$boxsize/2,
$ym,
$x1+$boxsize/2,
$ym+$boxsize
);
}
}
$aImg->SetColor($this->font_color);
$aImg->SetFont($this->font_family, $this->font_style, $this->font_size);
$aImg->SetTextAlign('left', 'baseline');
$debug=false;
$aImg->StrokeText(
$x1+$this->mark_abs_hsize+$this->xmargin,
$y1,
$p[0],
0,
'left',
$debug
);
// Add CSIM for Legend if defined
if (!empty($p[4])) {
$xs = $x1 - $this->mark_abs_hsize ;
$ys = $y1 + 1 ;
$xe = $x1 + $aImg->GetTextWidth($p[0]) + $this->mark_abs_hsize + $this->xmargin ;
$ye = $y1-$rowheight[$row]+1;
$coords = "$xs,$ys,$xe,$y1,$xe,$ye,$xs,$ye";
if (! empty($p[4])) {
$this->csimareas .= "<area shape=\"poly\" coords=\"$coords\" href=\"".htmlentities($p[4])."\"";
if (!empty($p[6])) {
$this->csimareas .= " target=\"".$p[6]."\"";
}
if (!empty($p[5])) {
$tmp=sprintf($p[5], $p[0]);
$this->csimareas .= " title=\"$tmp\" alt=\"$tmp\" ";
}
$this->csimareas .= " />\n";
}
}
if ($i >= $this->layout_n) {
$x1 = $xp+$this->xlmargin;
$row++;
if (!empty($rowheight[$row])) {
$y1 += $rowheight[$row];
}
$i = 1;
} else {
$x1 += $colwidth[($i-1) % $numcolumns] ;
++$i;
}
}
}
} // Class

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_LINE.PHP // File: JPGRAPH_LINE.PHP
// Description: Line plot extension for JpGraph // Description: Line plot extension for JpGraph
// Created: 2001-01-08 // Created: 2001-01-08
// Ver: $Id: jpgraph_line.php 981 2008-03-24 11:51:12Z ljp $ // Ver: $Id: jpgraph_line.php 1921 2009-12-11 11:46:39Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -32,6 +32,7 @@ class LinePlot extends Plot
protected $filledAreas = array(); // array of arrays(with min,max,col,filled in them) protected $filledAreas = array(); // array of arrays(with min,max,col,filled in them)
public $barcenter=false; // When we mix line and bar. Should we center the line in the bar. public $barcenter=false; // When we mix line and bar. Should we center the line in the bar.
protected $fillFromMin = false; protected $fillFromMin = false;
protected $fillFromMax = false;
protected $fillgrad=false; protected $fillgrad=false;
protected $fillgrad_fromcolor='navy'; protected $fillgrad_fromcolor='navy';
protected $fillgrad_tocolor='silver'; protected $fillgrad_tocolor='silver';
@ -40,18 +41,19 @@ class LinePlot extends Plot
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function LinePlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
$this->Plot($datay, $datax); parent::__construct($datay, $datax);
$this->mark = new PlotMark() ; $this->mark = new PlotMark() ;
$this->color = ColorFactory::getColor();
$this->fill_color = $this->color;
} }
//--------------- //---------------
// PUBLIC METHODS // PUBLIC METHODS
// Set style, filled or open public function SetFilled($aFlg=true)
public function SetFilled($aFlag=true)
{ {
JpGraphError::RaiseL(10001);//('LinePlot::SetFilled() is deprecated. Use SetFillColor()'); $this->filled = $aFlg;
} }
public function SetBarCenter($aFlag=true) public function SetBarCenter($aFlag=true)
@ -79,8 +81,14 @@ class LinePlot extends Plot
$this->fillFromMin = $f ; $this->fillFromMin = $f ;
} }
public function SetFillFromYMax($f=true)
{
$this->fillFromMax = $f ;
}
public function SetFillColor($aColor, $aFilled=true) public function SetFillColor($aColor, $aFilled=true)
{ {
//$this->color = $aColor;
$this->fill_color=$aColor; $this->fill_color=$aColor;
$this->filled=$aFilled; $this->filled=$aFilled;
} }
@ -152,8 +160,7 @@ class LinePlot extends Plot
// offset we don't touch it. // offset we don't touch it.
// (We check for empty in case the scale is a log scale // (We check for empty in case the scale is a log scale
// and hence doesn't contain any xlabel_offset) // and hence doesn't contain any xlabel_offset)
if (empty($graph->xaxis->scale->ticks->xlabel_offset) || if (empty($graph->xaxis->scale->ticks->xlabel_offset) || $graph->xaxis->scale->ticks->xlabel_offset == 0) {
$graph->xaxis->scale->ticks->xlabel_offset == 0) {
if ($this->center) { if ($this->center) {
++$this->numpoints; ++$this->numpoints;
$a=0.5; $a=0.5;
@ -218,9 +225,8 @@ class LinePlot extends Plot
if (isset($this->coords[1])) { if (isset($this->coords[1])) {
if (count($this->coords[1])!=$numpoints) { if (count($this->coords[1])!=$numpoints) {
JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints); JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints);
}
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints"); //("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
else { } else {
$exist_x = true; $exist_x = true;
} }
} else { } else {
@ -260,19 +266,23 @@ class LinePlot extends Plot
$yscale->Translate($this->coords[0][$startpoint]) $yscale->Translate($this->coords[0][$startpoint])
); );
if ($this->filled) { if ($this->filled) {
if ($this->fillFromMax) {
//$max = $yscale->GetMaxVal();
$cord[$idx++] = $xscale->Translate($xs);
$cord[$idx++] = $yscale->scale_abs[1];
} else {
$min = $yscale->GetMinVal(); $min = $yscale->GetMinVal();
if ($min > 0 || $this->fillFromMin) { if ($min > 0 || $this->fillFromMin) {
$fillmin = $yscale->scale_abs[0]; $fillmin = $yscale->scale_abs[0];//Translate($min);
}//Translate($min); } else {
else {
$fillmin = $yscale->Translate(0); $fillmin = $yscale->Translate(0);
} }
$cord[$idx++] = $xscale->Translate($xs); $cord[$idx++] = $xscale->Translate($xs);
$cord[$idx++] = $fillmin; $cord[$idx++] = $fillmin;
} }
}
$xt = $xscale->Translate($xs); $xt = $xscale->Translate($xs);
$yt = $yscale->Translate($this->coords[0][$startpoint]); $yt = $yscale->Translate($this->coords[0][$startpoint]);
$cord[$idx++] = $xt; $cord[$idx++] = $xt;
@ -373,11 +383,15 @@ class LinePlot extends Plot
if ($this->filled) { if ($this->filled) {
$cord[$idx++] = $xt; $cord[$idx++] = $xt;
if ($this->fillFromMax) {
$cord[$idx++] = $yscale->scale_abs[1];
} else {
if ($min > 0 || $this->fillFromMin) { if ($min > 0 || $this->fillFromMin) {
$cord[$idx++] = $yscale->Translate($min); $cord[$idx++] = $yscale->Translate($min);
} else { } else {
$cord[$idx++] = $yscale->Translate(0); $cord[$idx++] = $yscale->Translate(0);
} }
}
if ($this->fillgrad) { if ($this->fillgrad) {
$img->SetLineWeight(1); $img->SetLineWeight(1);
$grad = new Gradient($img); $grad = new Gradient($img);
@ -388,9 +402,13 @@ class LinePlot extends Plot
$img->SetColor($this->fill_color); $img->SetColor($this->fill_color);
$img->FilledPolygon($cord); $img->FilledPolygon($cord);
} }
if ($this->line_weight > 0) { if ($this->weight > 0) {
$img->SetLineWeight($this->weight);
$img->SetColor($this->color); $img->SetColor($this->color);
$img->Polygon($cord); // Remove first and last coordinate before drawing the line
// sine we otherwise get the vertical start and end lines which
// doesn't look appropriate
$img->Polygon(array_slice($cord, 2, count($cord)-4));
} }
} }
@ -425,8 +443,6 @@ class LinePlot extends Plot
// If not we still re-draw the line since it might have been // If not we still re-draw the line since it might have been
// partially overwritten by the filled area and it doesn't look // partially overwritten by the filled area and it doesn't look
// very good. // very good.
// TODO: The behaviour is undefined if the line does not have
// any line at the position of the area.
if ($this->filledAreas[$i][4]) { if ($this->filledAreas[$i][4]) {
$img->Polygon($areaCoords); $img->Polygon($areaCoords);
} else { } else {
@ -484,7 +500,7 @@ class AccLinePlot extends Plot
private $iStartEndZero=true; private $iStartEndZero=true;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function AccLinePlot($plots) public function __construct($plots)
{ {
$this->plots = $plots; $this->plots = $plots;
$this->nbrplots = count($plots); $this->nbrplots = count($plots);
@ -661,8 +677,6 @@ class AccLinePlot extends Plot
return true; return true;
} }
// To avoid duplicate of line drawing code here we just // To avoid duplicate of line drawing code here we just
// change the y-values for each plot and then restore it // change the y-values for each plot and then restore it
// after we have made the stroke. We must do this copy since // after we have made the stroke. We must do this copy since

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_LOG.PHP // File: JPGRAPH_LOG.PHP
// Description: Log scale plot extension for JpGraph // Description: Log scale plot extension for JpGraph
// Created: 2001-01-08 // Created: 2001-01-08
// Ver: $Id: jpgraph_log.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_log.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -22,9 +22,9 @@ class LogScale extends LinearScale
// CONSTRUCTOR // CONSTRUCTOR
// Log scale is specified using the log of min and max // 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->ticks = new LogTicks();
$this->name = 'log'; $this->name = 'log';
} }
@ -38,8 +38,8 @@ class LogScale extends LinearScale
if (!is_numeric($a)) { if (!is_numeric($a)) {
if ($a != '' && $a != '-' && $a != 'x') { if ($a != '' && $a != '-' && $a != 'x') {
JpGraphError::RaiseL(11001); JpGraphError::RaiseL(11001);
}
// ('Your data contains non-numeric values.'); // ('Your data contains non-numeric values.');
}
return 1; return 1;
} }
if ($a < 0) { if ($a < 0) {
@ -61,8 +61,8 @@ class LogScale extends LinearScale
if (!is_numeric($a)) { if (!is_numeric($a)) {
if ($a != '' && $a != '-' && $a != 'x') { if ($a != '' && $a != '-' && $a != 'x') {
JpGraphError::RaiseL(11001); JpGraphError::RaiseL(11001);
}
//('Your data contains non-numeric values.'); //('Your data contains non-numeric values.');
}
return 1; return 1;
} }
if ($a==0) { if ($a==0) {
@ -140,7 +140,7 @@ class LogTicks extends Ticks
private $ticklabels_pos = array(); private $ticklabels_pos = array();
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function LogTicks() public function __construct()
{ {
} }
//--------------- //---------------

View file

@ -0,0 +1,108 @@
<?php
/*=======================================================================
// File: JPGRAPH_MESHINTERPOLATE.INC.PHP
// Description: Utility class to do mesh linear interpolation of a matrix
// Created: 2009-03-09
// Ver: $Id: jpgraph_meshinterpolate.inc.php 1709 2009-07-30 08:00:08Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
/**
* Utility function to do linear mesh interpolation
* @param $aDat Matrix to interpolate
* @param $aFactor Interpolation factor
*/
function doMeshInterpolate(&$aData, $aFactor)
{
$m = new MeshInterpolate();
$aData = $m->Linear($aData, $aFactor);
}
/**
* Utility class to interpolate a given data matrix
*
*/
class MeshInterpolate
{
private $data = array();
/**
* Calculate the mid points of the given rectangle which has its top left
* corner at $row,$col. The $aFactordecides how many spliots should be done.
* i.e. how many more divisions should be done recursively
*
* @param $row Top left corner of square to work with
* @param $col Top left corner of square to work with
* $param $aFactor In how many subsquare should we split this square. A value of 1 indicates that no action
*/
public function IntSquare($aRow, $aCol, $aFactor)
{
if ($aFactor <= 1) {
return;
}
$step = pow(2, $aFactor-1);
$v0 = $this->data[$aRow][$aCol];
$v1 = $this->data[$aRow][$aCol + $step];
$v2 = $this->data[$aRow + $step][$aCol];
$v3 = $this->data[$aRow + $step][$aCol + $step];
$this->data[$aRow][$aCol + $step / 2] = ($v0 + $v1) / 2;
$this->data[$aRow + $step / 2][$aCol] = ($v0 + $v2) / 2;
$this->data[$aRow + $step][$aCol + $step / 2] = ($v2 + $v3) / 2;
$this->data[$aRow + $step / 2][$aCol + $step] = ($v1 + $v3) / 2;
$this->data[$aRow + $step / 2][$aCol + $step / 2] = ($v0 + $v1 + $v2 + $v3) / 4;
$this->IntSquare($aRow, $aCol, $aFactor-1);
$this->IntSquare($aRow, $aCol + $step / 2, $aFactor-1);
$this->IntSquare($aRow + $step / 2, $aCol, $aFactor-1);
$this->IntSquare($aRow + $step / 2, $aCol + $step / 2, $aFactor-1);
}
/**
* Interpolate values in a matrice so that the total number of data points
* in vert and horizontal axis are $aIntNbr more. For example $aIntNbr=2 will
* make the data matrice have tiwce as many vertical and horizontal dta points.
*
* Note: This will blow up the matrcide in memory size in the order of $aInNbr^2
*
* @param $ &$aData The original data matricde
* @param $aInNbr Interpolation factor
* @return the interpolated matrice
*/
public function Linear(&$aData, $aIntFactor)
{
$step = pow(2, $aIntFactor-1);
$orig_cols = count($aData[0]);
$orig_rows = count($aData);
// Number of new columns/rows
// N = (a-1) * 2^(f-1) + 1
$p = pow(2, $aIntFactor-1);
$new_cols = $p * ($orig_cols - 1) + 1;
$new_rows = $p * ($orig_rows - 1) + 1;
$this->data = array_fill(0, $new_rows, array_fill(0, $new_cols, 0));
// Initialize the new matrix with the values that we know
for ($i = 0; $i < $new_rows; $i++) {
for ($j = 0; $j < $new_cols; $j++) {
$v = 0 ;
if (($i % $step == 0) && ($j % $step == 0)) {
$v = $aData[$i / $step][$j / $step];
}
$this->data[$i][$j] = $v;
}
}
for ($i = 0; $i < $new_rows-1; $i += $step) {
for ($j = 0; $j < $new_cols-1; $j += $step) {
$this->IntSquare($i, $j, $aIntFactor);
}
}
return $this->data;
}
}

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_MGRAPH.PHP // File: JPGRAPH_MGRAPH.PHP
// Description: Class to handle multiple graphs in the same image // Description: Class to handle multiple graphs in the same image
// Created: 2006-01-15 // Created: 2006-01-15
// Ver: $Id: jpgraph_mgraph.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_mgraph.php 1770 2009-08-17 06:10:22Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -15,21 +15,28 @@
//============================================================================= //=============================================================================
class MGraph class MGraph
{ {
public $title = null;
public $subtitle = null;
public $subsubtitle = null;
protected $img=null; protected $img=null;
protected $iCnt=0; protected $iCnt=0;
protected $iGraphs = array(); // image_handle, x, y, fx, fy, sizex, sizey protected $iGraphs = array(); // image_handle, x, y, fx, fy, sizex, sizey
protected $iFillColor='white'; protected $iFillColor='white';
protected $iCurrentColor=0; protected $iCurrentColor=0;
protected $lm=0; protected $lm=4;
protected $rm=0; protected $rm=4;
protected $tm=0; protected $tm=4;
protected $bm=0; protected $bm=4;
protected $iDoFrame = false; protected $iDoFrame = false;
protected $iFrameColor = 'black'; protected $iFrameColor = 'black';
protected $iFrameWeight = 1; protected $iFrameWeight = 1;
protected $iLineWeight = 1; protected $iLineWeight = 1;
protected $expired=false; protected $expired=false;
protected $img_format='png'; protected $cache=null;
protected $cache_name = '';
protected $inline=true;
protected $image_format='png';
protected $image_quality=75; protected $image_quality=75;
protected $iWidth=null; protected $iWidth=null;
protected $iHeight=null; protected $iHeight=null;
@ -39,12 +46,50 @@ class MGraph
protected $background_image_mix=100; protected $background_image_mix=100;
protected $background_image_y=null; protected $background_image_y=null;
protected $background_image_x=null; protected $background_image_x=null;
private $doshadow=false;
private $shadow_width=4;
private $shadow_color='gray@0.5';
public $footer;
// Create a new instane of the combined graph // Create a new instane of the combined graph
public function MGraph($aWidth=null, $aHeight=null) public function __construct($aWidth=null, $aHeight=null, $aCachedName='', $aTimeOut=0, $aInline=true)
{ {
$this->iWidth = $aWidth; $this->iWidth = $aWidth;
$this->iHeight = $aHeight; $this->iHeight = $aHeight;
// If the cached version exist just read it directly from the
// cache, stream it back to browser and exit
if ($aCachedName!='' && READ_CACHE && $aInline) {
$this->cache = new ImgStreamCache();
$this->cache->SetTimeOut($aTimeOut);
$image = new Image();
if ($this->cache->GetAndStream($image, $aCachedName)) {
exit();
}
}
$this->inline = $aInline;
$this->cache_name = $aCachedName;
$this->title = new Text();
$this->title->ParagraphAlign('center');
$this->title->SetFont(FF_FONT2, FS_BOLD);
$this->title->SetMargin(3);
$this->title->SetAlign('center');
$this->subtitle = new Text();
$this->subtitle->ParagraphAlign('center');
$this->subtitle->SetFont(FF_FONT1, FS_BOLD);
$this->subtitle->SetMargin(3);
$this->subtitle->SetAlign('center');
$this->subsubtitle = new Text();
$this->subsubtitle->ParagraphAlign('center');
$this->subsubtitle->SetFont(FF_FONT1, FS_NORMAL);
$this->subsubtitle->SetMargin(3);
$this->subsubtitle->SetAlign('center');
$this->footer = new Footer();
} }
// Specify background fill color for the combined graph // Specify background fill color for the combined graph
@ -75,10 +120,6 @@ class MGraph
$aCenter=true; $aCenter=true;
$aX=null; $aX=null;
if ($GLOBALS['gd2'] && !USE_TRUECOLOR) {
JpGraphError::RaiseL(12001);
//("You are using GD 2.x and are trying to use a background images on a non truecolor image. To use background images with GD 2.x you <b>must</b> enable truecolor by setting the USE_TRUECOLOR constant to TRUE. Due to a bug in GD 2.0.1 using any truetype fonts with truecolor images will result in very poor quality fonts.");
}
if (is_numeric($aCenter_aX)) { if (is_numeric($aCenter_aX)) {
$aX=$aCenter_aX; $aX=$aCenter_aX;
} }
@ -106,62 +147,27 @@ class MGraph
$this->background_image_y = $aY; $this->background_image_y = $aY;
} }
// Private helper function for backgound image
public function _loadBkgImage($aFile='')
{
if ($aFile == '') {
$aFile = $this->background_image;
}
// Remove case sensitivity and setup appropriate function to create image
// Get file extension. This should be the LAST '.' separated part of the filename
$e = explode('.', $aFile);
$ext = strtolower($e[count($e)-1]);
if ($ext == "jpeg") {
$ext = "jpg";
}
if (trim($ext) == '') {
$ext = 'png';
} // Assume PNG if no extension specified
$supported = imagetypes();
if (($ext == 'jpg' && !($supported & IMG_JPG)) ||
($ext == 'gif' && !($supported & IMG_GIF)) ||
($ext == 'png' && !($supported & IMG_PNG))) {
JpGraphError::RaiseL(12004, $aFile);//('The image format of your background image ('.$aFile.') is not supported in your system configuration. ');
}
if ($ext == "jpg" || $ext == "jpeg") {
$f = "imagecreatefromjpeg";
$ext = "jpg";
} else {
$f = "imagecreatefrom".$ext;
}
$img = @$f($aFile);
if (!$img) {
JpGraphError::RaiseL(12005, $aFile);
//(" Can't read background image: '".$aFile."'");
}
return $img;
}
public function _strokeBackgroundImage() public function _strokeBackgroundImage()
{ {
if ($this->background_image == '') { if ($this->background_image == '') {
return; return;
} }
$bkgimg = $this->_loadBkgImage(); $bkgimg = Graph::LoadBkgImage('', $this->background_image);
// Background width & Heoght // Background width & Heoght
$bw = imagesx($bkgimg); $bw = imagesx($bkgimg);
$bh = imagesy($bkgimg); $bh = imagesy($bkgimg);
// Canvas width and height // Canvas width and height
$cw = imagesx($this->img); $cw = imagesx($this->img);
$ch = imagesy($this->img); $ch = imagesy($this->img);
if ($this->doshadow) {
$cw -= $this->shadow_width;
$ch -= $this->shadow_width;
}
if ($this->background_image_x === null || $this->background_image_y === null) { if ($this->background_image_x === null || $this->background_image_y === null) {
if ($this->background_image_center) { if ($this->background_image_center) {
// Center original image in the plot area // Center original image in the plot area
@ -176,80 +182,7 @@ class MGraph
$x = $this->background_image_x; $x = $this->background_image_x;
$y = $this->background_image_y; $y = $this->background_image_y;
} }
$this->_imageCp($bkgimg, $x, $y, 0, 0, $bw, $bh, $this->background_image_mix); imagecopymerge($this->img, $bkgimg, $x, $y, 0, 0, $bw, $bh, $this->background_image_mix);
}
public function _imageCp($aSrcImg, $x, $y, $fx, $fy, $w, $h, $mix=100)
{
imagecopymerge($this->img, $aSrcImg, $x, $y, $fx, $fy, $w, $h, $mix);
}
public function _imageCreate($aWidth, $aHeight)
{
if ($aWidth <= 1 || $aHeight <= 1) {
JpGraphError::RaiseL(12006, $aWidth, $aHeight);
//("Illegal sizes specified for width or height when creating an image, (width=$aWidth, height=$aHeight)");
}
if (@$GLOBALS['gd2']==true && USE_TRUECOLOR) {
$this->img = @imagecreatetruecolor($aWidth, $aHeight);
if ($this->img < 1) {
JpGraphError::RaiseL(12011);
// die("<b>JpGraph Error:</b> Can't create truecolor image. Check that you really have GD2 library installed.");
}
ImageAlphaBlending($this->img, true);
} else {
$this->img = @imagecreate($aWidth, $aHeight);
if ($this->img < 1) {
JpGraphError::RaiseL(12012);
// die("<b>JpGraph Error:</b> Can't create image. Check that you really have the GD library installed.");
}
}
}
public function _polygon($p, $closed=false)
{
if ($this->iLineWeight==0) {
return;
}
$n=count($p);
$oldx = $p[0];
$oldy = $p[1];
for ($i=2; $i < $n; $i+=2) {
imageline($this->img, $oldx, $oldy, $p[$i], $p[$i+1], $this->iCurrentColor);
$oldx = $p[$i];
$oldy = $p[$i+1];
}
if ($closed) {
imageline($this->img, $p[$n*2-2], $p[$n*2-1], $p[0], $p[1], $this->iCurrentColor);
}
}
public function _filledPolygon($pts)
{
$n=count($pts);
for ($i=0; $i < $n; ++$i) {
$pts[$i] = round($pts[$i]);
}
imagefilledpolygon($this->img, $pts, count($pts)/2, $this->iCurrentColor);
}
public function _rectangle($xl, $yu, $xr, $yl)
{
for ($i=0; $i < $this->iLineWeight; ++$i) {
$this->_polygon(array($xl+$i,$yu+$i,$xr-$i,$yu+$i,
$xr-$i,$yl-$i,$xl+$i,$yl-$i,
$xl+$i,$yu+$i));
}
}
public function _filledRectangle($xl, $yu, $xr, $yl)
{
$this->_filledPolygon(array($xl,$yu,$xr,$yu,$xr,$yl,$xl,$yl));
}
public function _setColor($aColor)
{
$this->iCurrentColor = $this->iRGB->Allocate($aColor);
} }
public function AddMix($aGraph, $x=0, $y=0, $mix=100, $fx=0, $fy=0, $w=0, $h=0) public function AddMix($aGraph, $x=0, $y=0, $mix=100, $fx=0, $fy=0, $w=0, $h=0)
@ -291,90 +224,72 @@ class MGraph
$this->expired = $aFlg; $this->expired = $aFlg;
} }
// Generate image header
public function Headers()
{
// In case we are running from the command line with the client version of
// PHP we can't send any headers.
$sapi = php_sapi_name();
if ($sapi == 'cli') {
return;
}
if (headers_sent()) {
echo "<table border=1><tr><td><font color=darkred size=4><b>JpGraph Error:</b>
HTTP headers have already been sent.</font></td></tr><tr><td><b>Explanation:</b><br>HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).<p>Most likely you have some text in your script before the call to <i>Graph::Stroke()</i>. If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser. <p>For example it is a common mistake to leave a blank line before the opening \"<b>&lt;?php</b>\".</td></tr></table>";
die();
}
if ($this->expired) {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
header("Content-type: image/$this->img_format");
}
public function SetImgFormat($aFormat, $aQuality=75) public function SetImgFormat($aFormat, $aQuality=75)
{ {
$this->image_format = $aFormat;
$this->image_quality = $aQuality; $this->image_quality = $aQuality;
$aFormat = strtolower($aFormat);
$tst = true;
$supported = imagetypes();
if ($aFormat=="auto") {
if ($supported & IMG_PNG) {
$this->img_format="png";
} elseif ($supported & IMG_JPG) {
$this->img_format="jpeg";
} elseif ($supported & IMG_GIF) {
$this->img_format="gif";
} else {
JpGraphError::RaiseL(12008);
}
//(" Your PHP (and GD-lib) installation does not appear to support any known graphic formats.".
return true;
} else {
if ($aFormat=="jpeg" || $aFormat=="png" || $aFormat=="gif") {
if ($aFormat=="jpeg" && !($supported & IMG_JPG)) {
$tst=false;
} elseif ($aFormat=="png" && !($supported & IMG_PNG)) {
$tst=false;
} elseif ($aFormat=="gif" && !($supported & IMG_GIF)) {
$tst=false;
} else {
$this->img_format=$aFormat;
return true;
}
} else {
$tst=false;
}
if (!$tst) {
JpGraphError::RaiseL(12009, $aFormat);
}
//(" Your PHP installation does not support the chosen graphic format: $aFormat");
}
} }
// Stream image to browser or to file // Set the shadow around the whole image
public function Stream($aFile="") public function SetShadow($aShowShadow=true, $aShadowWidth=4, $aShadowColor='gray@0.3')
{ {
$func="image".$this->img_format; $this->doshadow = $aShowShadow;
if ($this->img_format=="jpeg" && $this->image_quality != null) { $this->shadow_color = $aShadowColor;
$res = @$func($this->img, $aFile, $this->image_quality); $this->shadow_width = $aShadowWidth;
} else { $this->footer->iBottomMargin += $aShadowWidth;
if ($aFile != "") { $this->footer->iRightMargin += $aShadowWidth;
$res = @$func($this->img, $aFile);
} else {
$res = @$func($this->img);
} }
public function StrokeTitle($image, $w, $h)
{
// Stroke title
if ($this->title->t !== '') {
$margin = 3;
$y = $this->title->margin;
if ($this->title->halign == 'center') {
$this->title->Center(0, $w, $y);
} elseif ($this->title->halign == 'left') {
$this->title->SetPos($this->title->margin+2, $y);
} elseif ($this->title->halign == 'right') {
$indent = 0;
if ($this->doshadow) {
$indent = $this->shadow_width+2;
} }
if (!$res) { $this->title->SetPos($w-$this->title->margin-$indent, $y, 'right');
JpGraphError::RaiseL(12010, $aFile); }
$this->title->Stroke($image);
// ... and subtitle
$y += $this->title->GetTextHeight($image) + $margin + $this->subtitle->margin;
if ($this->subtitle->halign == 'center') {
$this->subtitle->Center(0, $w, $y);
} elseif ($this->subtitle->halign == 'left') {
$this->subtitle->SetPos($this->subtitle->margin+2, $y);
} elseif ($this->subtitle->halign == 'right') {
$indent = 0;
if ($this->doshadow) {
$indent = $this->shadow_width+2;
}
$this->subtitle->SetPos($this->img->width-$this->subtitle->margin-$indent, $y, 'right');
}
$this->subtitle->Stroke($image);
// ... and subsubtitle
$y += $this->subtitle->GetTextHeight($image) + $margin + $this->subsubtitle->margin;
if ($this->subsubtitle->halign == 'center') {
$this->subsubtitle->Center(0, $w, $y);
} elseif ($this->subsubtitle->halign == 'left') {
$this->subsubtitle->SetPos($this->subsubtitle->margin+2, $y);
} elseif ($this->subsubtitle->halign == 'right') {
$indent = 0;
if ($this->doshadow) {
$indent = $this->shadow_width+2;
}
$this->subsubtitle->SetPos($w-$this->subsubtitle->margin-$indent, $y, 'right');
}
$this->subsubtitle->Stroke($image);
} }
//("Can't create or stream image to file $aFile Check that PHP has enough permission to write a file to the current directory.");
} }
public function Stroke($aFileName='') public function Stroke($aFileName='')
@ -392,30 +307,44 @@ HTTP headers have already been sent.</font></td></tr><tr><td><b>Explanation:</b>
$h += $this->tm+$this->bm; $h += $this->tm+$this->bm;
// User specified width,height overrides // User specified width,height overrides
if ($this->iWidth !== null) { if ($this->iWidth !== null && $this->iWidth !== 0) {
$w = $this->iWidth; $w = $this->iWidth;
} }
if ($this->iHeight!== null) { if ($this->iHeight!== null && $this->iHeight !== 0) {
$h = $this->iHeight; $h = $this->iHeight;
} }
$this->_imageCreate($w, $h); if ($this->doshadow) {
$this->iRGB = new RGB($this->img); $w += $this->shadow_width;
$h += $this->shadow_width;
}
$this->_setcolor($this->iFillColor); $image = new Image($w, $h);
$this->_filledRectangle(0, 0, $w-1, $h-1); $image->SetImgFormat($this->image_format, $this->image_quality);
if ($this->doshadow) {
$image->SetColor($this->iFrameColor);
$image->ShadowRectangle(0, 0, $w-1, $h-1, $this->iFillColor, $this->shadow_width, $this->shadow_color);
$w -= $this->shadow_width;
$h -= $this->shadow_width;
} else {
$image->SetColor($this->iFillColor);
$image->FilledRectangle(0, 0, $w-1, $h-1);
}
$image->SetExpired($this->expired);
$this->img = $image->img;
$this->_strokeBackgroundImage(); $this->_strokeBackgroundImage();
if ($this->iDoFrame) { if ($this->iDoFrame && ! $this->doshadow) {
$this->_setColor($this->iFrameColor); $image->SetColor($this->iFrameColor);
$this->iLineWeight=$this->iFrameWeight; $image->SetLineWeight($this->iFrameWeight);
$this->_rectangle(0, 0, $w-1, $h-1); $image->Rectangle(0, 0, $w-1, $h-1);
} }
// Copy all sub graphs to the container // Copy all sub graphs to the container
for ($i=0; $i < $this->iCnt; ++$i) { for ($i=0; $i < $this->iCnt; ++$i) {
$this->_imageCp( $image->CopyMerge(
$this->iGraphs[$i][0], $this->iGraphs[$i][0],
$this->iGraphs[$i][1]+$this->lm, $this->iGraphs[$i][1]+$this->lm,
$this->iGraphs[$i][2]+$this->tm, $this->iGraphs[$i][2]+$this->tm,
@ -423,16 +352,24 @@ HTTP headers have already been sent.</font></td></tr><tr><td><b>Explanation:</b>
$this->iGraphs[$i][4], $this->iGraphs[$i][4],
$this->iGraphs[$i][5], $this->iGraphs[$i][5],
$this->iGraphs[$i][6], $this->iGraphs[$i][6],
-1,
-1, /* Full from width and height */
$this->iGraphs[$i][7] $this->iGraphs[$i][7]
); );
} }
$this->StrokeTitle($image, $w, $h);
$this->footer->Stroke($image);
// Output image // Output image
if ($aFileName == _IMG_HANDLER) { if ($aFileName == _IMG_HANDLER) {
return $this->img; return $image->img;
} else { } else {
$this->Headers(); //Finally stream the generated picture
$this->Stream($aFileName); $this->cache = new ImgStreamCache();
$this->cache->PutAndStream($image, $this->cache_name, $this->inline, $aFileName);
} }
} }
} }
// EOF

View file

@ -3,19 +3,19 @@
// File: JPGRAPH_PIE.PHP // File: JPGRAPH_PIE.PHP
// Description: Pie plot extension for JpGraph // Description: Pie plot extension for JpGraph
// Created: 2001-02-14 // Created: 2001-02-14
// Ver: $Id: jpgraph_pie.php 1006 2008-06-09 22:32:05Z ljp $ // Ver: $Id: jpgraph_pie.php 1926 2010-01-11 16:33:07Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
// Defines for PiePlot::SetLabelType() // Defines for PiePlot::SetLabelType()
DEFINE("PIE_VALUE_ABS", 1); define("PIE_VALUE_ABS", 1);
DEFINE("PIE_VALUE_PER", 0); define("PIE_VALUE_PER", 0);
DEFINE("PIE_VALUE_PERCENTAGE", 0); define("PIE_VALUE_PERCENTAGE", 0);
DEFINE("PIE_VALUE_ADJPERCENTAGE", 2); define("PIE_VALUE_ADJPERCENTAGE", 2);
DEFINE("PIE_VALUE_ADJPER", 2); define("PIE_VALUE_ADJPER", 2);
//=================================================== //===================================================
// CLASS PiePlot // CLASS PiePlot
@ -25,6 +25,9 @@ class PiePlot
{ {
public $posx=0.5; public $posx=0.5;
public $posy=0.5; public $posy=0.5;
public $is_using_plot_theme = false;
public $theme="earth";
protected $use_plot_theme_colors = false;
protected $radius=0.3; protected $radius=0.3;
protected $explode_radius=array(); protected $explode_radius=array();
protected $explode_all=false; protected $explode_all=false;
@ -47,7 +50,6 @@ class PiePlot
"pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38), "pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38),
"water" => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388), "water" => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388),
"sand" => array(27,168,34,170,19,50,65,72,131,209,46,393)); "sand" => array(27,168,34,170,19,50,65,72,131,209,46,393));
protected $theme="earth";
protected $setslicecolors=array(); protected $setslicecolors=array();
protected $labeltype=0; // Default to percentage protected $labeltype=0; // Default to percentage
protected $pie_border=true; protected $pie_border=true;
@ -70,11 +72,11 @@ class PiePlot
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function PiePlot($data) public function __construct($data)
{ {
$this->data = array_reverse($data); $this->data = array_reverse($data);
$this->title = new Text(""); $this->title = new Text("");
$this->title->SetFont(FF_FONT1, FS_BOLD); $this->title->SetFont(FF_DEFAULT, FS_BOLD);
$this->value = new DisplayValue(); $this->value = new DisplayValue();
$this->value->Show(); $this->value->Show();
$this->value->SetFormat('%.1f%%'); $this->value->SetFormat('%.1f%%');
@ -210,11 +212,15 @@ class PiePlot
public function SetTheme($aTheme) public function SetTheme($aTheme)
{ {
// JpGraphError::RaiseL(15012,$aTheme);
// return;
if (in_array($aTheme, array_keys($this->themearr))) { if (in_array($aTheme, array_keys($this->themearr))) {
$this->theme = $aTheme; $this->theme = $aTheme;
$this->is_using_plot_theme = true;
} else { } else {
JpGraphError::RaiseL(15001, $aTheme); JpGraphError::RaiseL(15001, $aTheme);//("PiePLot::SetTheme() Unknown theme: $aTheme");
}//("PiePLot::SetTheme() Unknown theme: $aTheme"); }
} }
public function ExplodeSlice($e, $radius=20) public function ExplodeSlice($e, $radius=20)
@ -245,13 +251,12 @@ class PiePlot
if ($aStart < 0 || $aStart > 360) { if ($aStart < 0 || $aStart > 360) {
JpGraphError::RaiseL(15004);//('Slice start angle must be between 0 and 360 degrees.'); JpGraphError::RaiseL(15004);//('Slice start angle must be between 0 and 360 degrees.');
} }
if ($aStart == 0) {
$this->startangle = 0;
} else {
$this->startangle = 360-$aStart; $this->startangle = 360-$aStart;
$this->startangle *= M_PI/180; $this->startangle *= M_PI/180;
} }
public function SetFont($family, $style=FS_NORMAL, $size=10)
{
JpGraphError::RaiseL(15005);//('PiePlot::SetFont() is deprecated. Use PiePlot->value->SetFont() instead.');
} }
// Size in percentage // Size in percentage
@ -265,12 +270,6 @@ class PiePlot
//("PiePlot::SetSize() Radius for pie must either be specified as a fraction [0, 0.5] of the size of the image or as an absolute size in pixels in the range [10, 1000]"); //("PiePlot::SetSize() Radius for pie must either be specified as a fraction [0, 0.5] of the size of the image or as an absolute size in pixels in the range [10, 1000]");
} }
public function SetFontColor($aColor)
{
JpGraphError::RaiseL(15007);
//('PiePlot::SetFontColor() is deprecated. Use PiePlot->value->SetColor() instead.');
}
// Set label arrays // Set label arrays
public function SetLegends($aLegend) public function SetLegends($aLegend)
{ {
@ -290,13 +289,13 @@ class PiePlot
} }
// Should we display actual value or percentage? // Should we display actual value or percentage?
public function SetLabelType($t) public function SetLabelType($aType)
{ {
if ($t < 0 || $t > 2) { if ($aType < 0 || $aType > 2) {
JpGraphError::RaiseL(15008, $t); JpGraphError::RaiseL(15008, $aType);
} }
//("PiePlot::SetLabelType() Type for pie plots must be 0 or 1 (not $t)."); //("PiePlot::SetLabelType() Type for pie plots must be 0 or 1 (not $t).");
$this->labeltype=$t; $this->labeltype = $aType;
} }
// Deprecated. // Deprecated.
@ -345,14 +344,16 @@ class PiePlot
// Make sure we don't plot more values than data points // Make sure we don't plot more values than data points
// (in case the user added more legends 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 != "") { if ($this->legends != "") {
$this->legends = array_reverse(array_slice($this->legends, 0, $n)); $this->legends = array_reverse(array_slice($this->legends, 0, $n));
} }
for ($i=$n-1; $i >= 0; --$i) { for ($i=$n-1; $i >= 0; --$i) {
$l = $this->legends[$i]; $l = $this->legends[$i];
// Replace possible format with actual values // 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]; $fmt = $this->csimalts[$i];
} else { } else {
$fmt = "%d"; // Deafult Alt if no other has been specified $fmt = "%d"; // Deafult Alt if no other has been specified
@ -375,9 +376,11 @@ class PiePlot
} }
if ($this->setslicecolors==null) { 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 { } 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);
} }
} }
} }
@ -441,7 +444,7 @@ class PiePlot
// aaoption == 1 just the body // aaoption == 1 just the body
// aaoption == 2 just the values // aaoption == 2 just the values
// Explode scaling. If anti anti alias we scale the image // Explode scaling. If anti alias we scale the image
// twice and we also need to scale the exploding distance // twice and we also need to scale the exploding distance
$expscale = $aaoption === 1 ? 2 : 1; $expscale = $aaoption === 1 ? 2 : 1;
@ -450,6 +453,10 @@ class PiePlot
$this->adjusted_data = $this->AdjPercentage($this->data); $this->adjusted_data = $this->AdjPercentage($this->data);
} }
if ($this->use_plot_theme_colors) {
$this->setslicecolors = null;
}
$colors = array_keys($img->rgb->rgb_table); $colors = array_keys($img->rgb->rgb_table);
sort($colors); sort($colors);
$ta=$this->themearr[$this->theme]; $ta=$this->themearr[$this->theme];
@ -479,8 +486,8 @@ class PiePlot
// Bail out with error if the sum is 0 // Bail out with error if the sum is 0
if ($sum==0) { if ($sum==0) {
JpGraphError::RaiseL(15009); JpGraphError::RaiseL(15009);//("Sum of all data is 0 for Pie.");
}//("Sum of all data is 0 for Pie."); }
// Set up the pie-circle // Set up the pie-circle
if ($this->radius <= 1) { if ($this->radius <= 1) {
@ -550,8 +557,7 @@ class PiePlot
$radius-1, $radius-1,
$angle1*180/M_PI, $angle1*180/M_PI,
$angle2*180/M_PI, $angle2*180/M_PI,
$slicecolor, $this->ishadowcolor
$arccolor
); );
} }
} }
@ -593,19 +599,18 @@ class PiePlot
// We avoid some trouble by not allowing end angle to be 0, in that case // We avoid some trouble by not allowing end angle to be 0, in that case
// we translate to 360 // we translate to 360
// la is used to hold the label angle, which is centered on the slice // la is used to hold the label angle, which is centered on the slice
if ($angle2 < 0.0001 && $angle1 > 0.0001) { if ($angle2 < 0.0001 && $angle1 > 0.0001) {
$this->la[$i] = 2*M_PI - (abs(2*M_PI-$angle1)/2.0+$angle1); $this->la[$i] = 2*M_PI - (abs(2*M_PI-$angle1)/2.0+$angle1);
} elseif ($angle1 > $angle2) {
// The case where the slice crosses the 3 a'clock line
// Remember that the slices are counted clockwise and
// labels are counted counter clockwise so we need to revert with 2 PI
$this->la[$i] = 2*M_PI-$this->NormAngle($angle1 + ((2*M_PI - $angle1)+$angle2)/2);
} else { } else {
$this->la[$i] = 2*M_PI - (abs($angle2-$angle1)/2.0+$angle1); $this->la[$i] = 2*M_PI - (abs($angle2-$angle1)/2.0+$angle1);
} }
$_sa = round($angle1*180/M_PI);
$_ea = round($angle2*180/M_PI);
$_la = round($this->la[$i]*180/M_PI);
//echo "ang1=$_sa , ang2=$_ea - la=$_la<br>";
// Too avoid rounding problems we skip the slice if it is too small // Too avoid rounding problems we skip the slice if it is too small
if ($d < 0.00001) { if ($d < 0.00001) {
continue; continue;
@ -619,6 +624,12 @@ class PiePlot
$slicecolor=$this->setslicecolors[$i%$numcolors]; $slicecolor=$this->setslicecolors[$i%$numcolors];
} }
// $_sa = round($angle1*180/M_PI);
// $_ea = round($angle2*180/M_PI);
// $_la = round($this->la[$i]*180/M_PI);
// echo "Slice#$i: ang1=$_sa , ang2=$_ea, la=$_la, color=$slicecolor<br>";
// If we have enabled antialias then we don't draw any border so // If we have enabled antialias then we don't draw any border so
// make the bordedr color the same as the slice color // make the bordedr color the same as the slice color
if ($this->pie_interior_border && $aaoption===0) { if ($this->pie_interior_border && $aaoption===0) {
@ -642,11 +653,10 @@ class PiePlot
$_la = round($this->la[$i]*180/M_PI); $_la = round($this->la[$i]*180/M_PI);
//echo "[$i] sa=$_sa, ea=$_ea, la[$i]=$_la, (color=$slicecolor)<br>"; //echo "[$i] sa=$_sa, ea=$_ea, la[$i]=$_la, (color=$slicecolor)<br>";
// The CakeSlice method draws a full circle in case of start angle = end angle // The CakeSlice method draws a full circle in case of start angle = end angle
// for pie slices we don't want this behaviour unless we only have one // for pie slices we want this in case the slice have a value larger than 99% of the
// slice in the pie in case it is the wanted behaviour // total sum
if (abs($_ea-$_sa) > 0.1 || $n==1) { if (abs($_ea-$_sa) >= 1 || $d == $sum) {
$img->CakeSlice($xcm, $ycm, $radius-1, $radius-1, $_sa, $_ea, $slicecolor, $arccolor); $img->CakeSlice($xcm, $ycm, $radius-1, $radius-1, $_sa, $_ea, $slicecolor, $arccolor);
} }
} }
@ -1111,6 +1121,11 @@ class PiePlot
$this->value->Stroke($img, $label, $xt-$dx*$w, $yt-$dy*$h); $this->value->Stroke($img, $label, $xt-$dx*$w, $yt-$dy*$h);
} }
} }
public function UsePlotThemeColors($flag = true)
{
$this->use_plot_theme_colors = $flag;
}
} // Class } // Class
@ -1128,9 +1143,9 @@ class PiePlotC extends PiePlot
private $middlecsimwintarget=''; private $middlecsimwintarget='';
private $middlecsimalt=''; private $middlecsimalt='';
public function PiePlotC($data, $aCenterTitle='') public function __construct($data, $aCenterTitle='')
{ {
parent::PiePlot($data); parent::__construct($data);
$this->midtitle = new Text(); $this->midtitle = new Text();
$this->midtitle->ParagraphAlign('center'); $this->midtitle->ParagraphAlign('center');
} }
@ -1343,12 +1358,16 @@ class PieGraph extends Graph
public $pieaa = false ; public $pieaa = false ;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function PieGraph($width=300, $height=200, $cachedName="", $timeout=0, $inline=1) public function __construct($width=300, $height=200, $cachedName="", $timeout=0, $inline=1)
{ {
$this->Graph($width, $height, $cachedName, $timeout, $inline); parent::__construct($width, $height, $cachedName, $timeout, $inline);
$this->posx=$width/2; $this->posx=$width/2;
$this->posy=$height/2; $this->posy=$height/2;
$this->SetColor(array(255,255,255)); $this->SetColor(array(255,255,255));
if ($this->graph_theme) {
$this->graph_theme->ApplyGraph($this);
}
} }
//--------------- //---------------
@ -1369,12 +1388,25 @@ class PieGraph extends Graph
if (is_array($aObj)) { if (is_array($aObj)) {
$n = count($aObj); $n = count($aObj);
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
//if ($aObj[$i]->theme) {
// $this->ClearTheme();
//}
$this->plots[] = $aObj[$i]; $this->plots[] = $aObj[$i];
} }
} else { } else {
//if ($aObj->theme) {
// $this->ClearTheme();
//}
$this->plots[] = $aObj; $this->plots[] = $aObj;
} }
} }
if ($this->graph_theme) {
$this->graph_theme->SetupPlot($aObj);
if ($aObj->is_using_plot_theme) {
$aObj->UsePlotThemeColors();
}
}
} }
public function SetAntiAliasing($aFlg=true) public function SetAntiAliasing($aFlg=true)
@ -1394,7 +1426,8 @@ class PieGraph extends Graph
foreach ($this->plots as $p) { foreach ($this->plots as $p) {
$csim .= $p->GetCSIMareas(); $csim .= $p->GetCSIMareas();
} }
//$csim.= $this->legend->GetCSIMareas();
$csim.= $this->legend->GetCSIMareas();
if (preg_match_all("/area shape=\"(\w+)\" coords=\"([0-9\, ]+)\"/", $csim, $coords)) { if (preg_match_all("/area shape=\"(\w+)\" coords=\"([0-9\, ]+)\"/", $csim, $coords)) {
$this->img->SetColor($this->csimcolor); $this->img->SetColor($this->csimcolor);
$n = count($coords[0]); $n = count($coords[0]);
@ -1421,6 +1454,7 @@ class PieGraph extends Graph
// Method description // Method description
public function Stroke($aStrokeFileName="") public function Stroke($aStrokeFileName="")
{ {
// If the filename is the predefined value = '_csim_special_' // If the filename is the predefined value = '_csim_special_'
// we assume that the call to stroke only needs to do enough // we assume that the call to stroke only needs to do enough
// to correctly generate the CSIM maps. // to correctly generate the CSIM maps.
@ -1430,6 +1464,12 @@ class PieGraph extends Graph
// code below. // code below.
$_csim = ($aStrokeFileName===_CSIM_SPECIALFILE); $_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
// If we are called the second time (perhaps the user has called GetHTMLImageMap()
// himself then the legends have alsready been populated once in order to get the
// CSIM coordinats. Since we do not want the legends to be populated a second time
// we clear the legends
$this->legend->Clear();
// We need to know if we have stroked the plot in the // We need to know if we have stroked the plot in the
// GetCSIMareas. Otherwise the CSIM hasn't been generated // GetCSIMareas. Otherwise the CSIM hasn't been generated
// and in the case of GetCSIM called before stroke to generate // and in the case of GetCSIM called before stroke to generate
@ -1520,6 +1560,7 @@ class PieGraph extends Graph
$this->StrokeFrameBackground(); $this->StrokeFrameBackground();
} else { } else {
$this->StrokeFrame(); $this->StrokeFrame();
$this->StrokeBackgroundGrad();
} }
} }

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_PIE3D.PHP // File: JPGRAPH_PIE3D.PHP
// Description: 3D Pie plot extension for JpGraph // Description: 3D Pie plot extension for JpGraph
// Created: 2001-03-24 // Created: 2001-03-24
// Ver: $Id: jpgraph_pie3d.php 956 2007-11-17 13:19:20Z ljp $ // Ver: $Id: jpgraph_pie3d.php 1329 2009-06-20 19:23:30Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -20,13 +20,12 @@ class PiePlot3D extends PiePlot
private $showlabelhint=true; private $showlabelhint=true;
private $angle=50; private $angle=50;
private $edgecolor=""; private $edgecolor="";
private $edgeweight=1; private $edgeweight=1;
private $iThickness=false; private $iThickness=false;
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function PiePlot3d($data) public function __construct($data)
{ {
$this->radius = 0.5; $this->radius = 0.5;
$this->data = $data; $this->data = $data;
@ -72,22 +71,14 @@ class PiePlot3D extends PiePlot
$this->edgeweight = $aWeight; $this->edgeweight = $aWeight;
} }
// Dummy function to make Pie3D behave in a similair way to 2D
public function ShowBorder($exterior=true, $interior=true)
{
JpGraphError::RaiseL(14001);
//('Pie3D::ShowBorder() . Deprecated function. Use Pie3D::SetEdge() to control the edges around slices.');
}
// Specify projection angle for 3D in degrees // Specify projection angle for 3D in degrees
// Must be between 20 and 70 degrees // Must be between 20 and 70 degrees
public function SetAngle($a) public function SetAngle($a)
{ {
if ($a<5 || $a>90) { if ($a<5 || $a>90) {
JpGraphError::RaiseL(14002); JpGraphError::RaiseL(14002);
}
//("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees."); //("PiePlot3D::SetAngle() 3D Pie projection angle must be between 5 and 85 degrees.");
else { } else {
$this->angle = $a; $this->angle = $a;
} }
} }
@ -433,7 +424,8 @@ class PiePlot3D extends PiePlot
$startangle=0, $startangle=0,
$edgecolor="", $edgecolor="",
$edgeweight=1 $edgeweight=1
) { )
{
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// As usual the algorithm get more complicated than I originally // As usual the algorithm get more complicated than I originally
@ -574,9 +566,7 @@ class PiePlot3D extends PiePlot
// c) If start is > 270 (hence the firstr split is at 90) // c) If start is > 270 (hence the firstr split is at 90)
// and the slice is so large that it goes all the way // and the slice is so large that it goes all the way
// around 270. // around 270.
if (($a < 90 && ($a+$da > 270)) || if (($a < 90 && ($a+$da > 270)) || ($a > 90 && $a<=270 && ($a+$da>360+90)) || ($a > 270 && $this->NormAngle($a+$da)>270)) {
($a > 90 && $a<=270 && ($a+$da>360+90)) ||
($a > 270 && $this->NormAngle($a+$da)>270)) {
$angles[++$idx] = array($split,360-$split); $angles[++$idx] = array($split,360-$split);
$adjcolors[$idx] = $colors[$i % $numcolors]; $adjcolors[$idx] = $colors[$i % $numcolors];
$adjexplode[$idx] = $explode; $adjexplode[$idx] = $explode;
@ -934,6 +924,7 @@ class PiePlot3D extends PiePlot
$thick = $width/12; $thick = $width/12;
} }
$a = $this->angle; $a = $this->angle;
if ($a <= 30) { if ($a <= 30) {
$thick *= 1.6; $thick *= 1.6;
} elseif ($a <= 40) { } elseif ($a <= 40) {
@ -1008,9 +999,11 @@ class PiePlot3D extends PiePlot
} else { } else {
$w=$img->GetTextWidth($label); $w=$img->GetTextWidth($label);
} }
while ($a > 2*M_PI) { while ($a > 2*M_PI) {
$a -= 2*M_PI; $a -= 2*M_PI;
} }
if ($a>=7*M_PI/4 || $a <= M_PI/4) { if ($a>=7*M_PI/4 || $a <= M_PI/4) {
$dx=0; $dx=0;
} }
@ -1043,13 +1036,13 @@ class PiePlot3D extends PiePlot
$x = round($xp-$dx*$w); $x = round($xp-$dx*$w);
$y = round($yp-$dy*$h); $y = round($yp-$dy*$h);
// Mark anchor point for debugging // Mark anchor point for debugging
/* /*
$img->SetColor('red'); $img->SetColor('red');
$img->Line($xp-10,$yp,$xp+10,$yp); $img->Line($xp-10,$yp,$xp+10,$yp);
$img->Line($xp,$yp-10,$xp,$yp+10); $img->Line($xp,$yp-10,$xp,$yp+10);
*/ */
$oldmargin = $this->value->margin; $oldmargin = $this->value->margin;
$this->value->margin=0; $this->value->margin=0;
$this->value->Stroke($img, $label, $x, $y); $this->value->Stroke($img, $label, $x, $y);

View file

@ -3,20 +3,20 @@
// File: JPGRAPH_PLOTBAND.PHP // File: JPGRAPH_PLOTBAND.PHP
// Description: PHP4 Graph Plotting library. Extension module. // Description: PHP4 Graph Plotting library. Extension module.
// Created: 2004-02-18 // Created: 2004-02-18
// Ver: $Id: jpgraph_plotband.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_plotband.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
// Constants for types of static bands in plot area // Constants for types of static bands in plot area
DEFINE("BAND_RDIAG", 1); // Right diagonal lines define("BAND_RDIAG", 1); // Right diagonal lines
DEFINE("BAND_LDIAG", 2); // Left diagonal lines define("BAND_LDIAG", 2); // Left diagonal lines
DEFINE("BAND_SOLID", 3); // Solid one color define("BAND_SOLID", 3); // Solid one color
DEFINE("BAND_VLINE", 4); // Vertical lines define("BAND_VLINE", 4); // Vertical lines
DEFINE("BAND_HLINE", 5); // Horizontal lines define("BAND_HLINE", 5); // Horizontal lines
DEFINE("BAND_3DPLANE", 6); // "3D" Plane define("BAND_3DPLANE", 6); // "3D" Plane
DEFINE("BAND_HVCROSS", 7); // Vertical/Hor crosses define("BAND_HVCROSS", 7); // Vertical/Hor crosses
DEFINE("BAND_DIAGCROSS", 8); // Diagonal crosses define("BAND_DIAGCROSS", 8); // Diagonal crosses
// Utility class to hold coordinates for a rectangle // Utility class to hold coordinates for a rectangle
@ -28,7 +28,7 @@ class Rectangle
public $h; public $h;
public $xe; public $xe;
public $ye; public $ye;
public function Rectangle($aX, $aY, $aWidth, $aHeight) public function __construct($aX, $aY, $aWidth, $aHeight)
{ {
$this->x=$aX; $this->x=$aX;
$this->y=$aY; $this->y=$aY;
@ -55,7 +55,7 @@ class RectPattern
protected $linespacing; // Line spacing in pixels protected $linespacing; // Line spacing in pixels
protected $iBackgroundColor=-1; // Default is no background fill protected $iBackgroundColor=-1; // Default is no background fill
public function RectPattern($aColor, $aWeight=1) public function __construct($aColor, $aWeight=1)
{ {
$this->color = $aColor; $this->color = $aColor;
$this->weight = $aWeight; $this->weight = $aWeight;
@ -119,9 +119,9 @@ class RectPattern
//===================================================================== //=====================================================================
class RectPatternSolid extends RectPattern class RectPatternSolid extends RectPattern
{ {
public function RectPatternSolid($aColor="black", $aWeight=1) public function __construct($aColor="black", $aWeight=1)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
} }
public function DoPattern($aImg) public function DoPattern($aImg)
@ -142,9 +142,9 @@ class RectPatternSolid extends RectPattern
//===================================================================== //=====================================================================
class RectPatternHor extends RectPattern class RectPatternHor extends RectPattern
{ {
public function RectPatternHor($aColor="black", $aWeight=1, $aLineSpacing=7) public function __construct($aColor="black", $aWeight=1, $aLineSpacing=7)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->linespacing = $aLineSpacing; $this->linespacing = $aLineSpacing;
} }
@ -166,9 +166,9 @@ class RectPatternHor extends RectPattern
//===================================================================== //=====================================================================
class RectPatternVert extends RectPattern class RectPatternVert extends RectPattern
{ {
public function RectPatternVert($aColor="black", $aWeight=1, $aLineSpacing=7) public function __construct($aColor="black", $aWeight=1, $aLineSpacing=7)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->linespacing = $aLineSpacing; $this->linespacing = $aLineSpacing;
} }
@ -194,9 +194,9 @@ class RectPatternVert extends RectPattern
//===================================================================== //=====================================================================
class RectPatternRDiag extends RectPattern class RectPatternRDiag extends RectPattern
{ {
public function RectPatternRDiag($aColor="black", $aWeight=1, $aLineSpacing=12) public function __construct($aColor="black", $aWeight=1, $aLineSpacing=12)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->linespacing = $aLineSpacing; $this->linespacing = $aLineSpacing;
} }
@ -264,10 +264,10 @@ class RectPatternRDiag extends RectPattern
//===================================================================== //=====================================================================
class RectPatternLDiag extends RectPattern class RectPatternLDiag extends RectPattern
{ {
public function RectPatternLDiag($aColor="black", $aWeight=1, $aLineSpacing=12) public function __construct($aColor="black", $aWeight=1, $aLineSpacing=12)
{ {
$this->linespacing = $aLineSpacing; $this->linespacing = $aLineSpacing;
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
} }
public function DoPattern($aImg) public function DoPattern($aImg)
@ -335,9 +335,9 @@ class RectPattern3DPlane extends RectPattern
// top of the band. Specifies how fast the lines // top of the band. Specifies how fast the lines
// converge. // converge.
public function RectPattern3DPlane($aColor="black", $aWeight=1) public function __construct($aColor="black", $aWeight=1)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->SetDensity(10); // Slightly larger default $this->SetDensity(10); // Slightly larger default
} }
@ -455,9 +455,9 @@ class RectPatternCross extends RectPattern
{ {
private $vert=null; private $vert=null;
private $hor=null; private $hor=null;
public function RectPatternCross($aColor="black", $aWeight=1) public function __construct($aColor="black", $aWeight=1)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->vert = new RectPatternVert($aColor, $aWeight); $this->vert = new RectPatternVert($aColor, $aWeight);
$this->hor = new RectPatternHor($aColor, $aWeight); $this->hor = new RectPatternHor($aColor, $aWeight);
} }
@ -497,9 +497,9 @@ class RectPatternDiagCross extends RectPattern
{ {
private $left=null; private $left=null;
private $right=null; private $right=null;
public function RectPatternDiagCross($aColor="black", $aWeight=1) public function __construct($aColor="black", $aWeight=1)
{ {
parent::RectPattern($aColor, $aWeight); parent::__construct($aColor, $aWeight);
$this->right = new RectPatternRDiag($aColor, $aWeight); $this->right = new RectPatternRDiag($aColor, $aWeight);
$this->left = new RectPatternLDiag($aColor, $aWeight); $this->left = new RectPatternLDiag($aColor, $aWeight);
} }
@ -536,7 +536,7 @@ class RectPatternDiagCross extends RectPattern
//===================================================================== //=====================================================================
class RectPatternFactory class RectPatternFactory
{ {
public function RectPatternFactory() public function __construct()
{ {
// Empty // Empty
} }
@ -590,7 +590,7 @@ class PlotBand
private $min; private $min;
private $max; private $max;
public function PlotBand($aDir, $aPattern, $aMin, $aMax, $aColor="black", $aWeight=1, $aDepth=DEPTH_BACK) public function __construct($aDir, $aPattern, $aMin, $aMax, $aColor="black", $aWeight=1, $aDepth=DEPTH_BACK)
{ {
$f = new RectPatternFactory(); $f = new RectPatternFactory();
$this->prect = $f->Create($aPattern, $aColor, $aWeight); $this->prect = $f->Create($aPattern, $aColor, $aWeight);

View file

@ -0,0 +1,171 @@
<?php
/*=======================================================================
// File: JPGRAPH_PLOTLINE.PHP
// Description: PlotLine extension for JpGraph
// Created: 2009-03-24
// Ver: $Id: jpgraph_plotline.php 1931 2010-03-22 15:05:48Z ljp $
//
// CLASS PlotLine
// Data container class to hold properties for a static
// line that is drawn directly in the plot area.
// Useful to add static borders inside a plot to show for example set-values
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
*/
class PlotLine
{
public $scaleposition;
public $direction=-1;
protected $weight=1;
protected $color = 'black';
private $legend='';
private $hidelegend=false;
private $legendcsimtarget='';
private $legendcsimalt='';
private $legendcsimwintarget='';
private $iLineStyle='solid';
public $numpoints=0; // Needed since the framework expects this property
public function __construct($aDir=HORIZONTAL, $aPos=0, $aColor='black', $aWeight=1)
{
$this->direction = $aDir;
$this->color=$aColor;
$this->weight=$aWeight;
$this->scaleposition=$aPos;
}
public function SetLegend($aLegend, $aCSIM='', $aCSIMAlt='', $aCSIMWinTarget='')
{
$this->legend = $aLegend;
$this->legendcsimtarget = $aCSIM;
$this->legendcsimwintarget = $aCSIMWinTarget;
$this->legendcsimalt = $aCSIMAlt;
}
public function HideLegend($f=true)
{
$this->hidelegend = $f;
}
public function SetPosition($aScalePosition)
{
$this->scaleposition=$aScalePosition;
}
public function SetDirection($aDir)
{
$this->direction = $aDir;
}
public function SetColor($aColor)
{
$this->color=$aColor;
}
public function SetWeight($aWeight)
{
$this->weight=$aWeight;
}
public function SetLineStyle($aStyle)
{
$this->iLineStyle = $aStyle;
}
public function GetCSIMAreas()
{
return '';
}
//---------------
// PRIVATE METHODS
public function DoLegend($graph)
{
if (!$this->hidelegend) {
$this->Legend($graph);
}
}
// Framework function the chance for each plot class to set a legend
public function Legend($aGraph)
{
if ($this->legend != '') {
$dummyPlotMark = new PlotMark();
$lineStyle = 1;
$aGraph->legend->Add(
$this->legend,
$this->color,
$dummyPlotMark,
$lineStyle,
$this->legendcsimtarget,
$this->legendcsimalt,
$this->legendcsimwintarget
);
}
}
public function PreStrokeAdjust($aGraph)
{
// Nothing to do
}
// Called by framework to allow the object to draw
// optional information in the margin area
public function StrokeMargin($aImg)
{
// Nothing to do
}
// Framework function to allow the object to adjust the scale
public function PrescaleSetup($aGraph)
{
// Nothing to do
}
public function Min()
{
return array(null,null);
}
public function Max()
{
return array(null,null);
}
public function _Stroke($aImg, $aMinX, $aMinY, $aMaxX, $aMaxY, $aXPos, $aYPos)
{
$aImg->SetColor($this->color);
$aImg->SetLineWeight($this->weight);
$oldStyle = $aImg->SetLineStyle($this->iLineStyle);
if ($this->direction == VERTICAL) {
$ymin_abs = $aMinY;
$ymax_abs = $aMaxY;
$xpos_abs = $aXPos;
$aImg->StyleLine($xpos_abs, $ymin_abs, $xpos_abs, $ymax_abs);
} elseif ($this->direction == HORIZONTAL) {
$xmin_abs = $aMinX;
$xmax_abs = $aMaxX;
$ypos_abs = $aYPos;
$aImg->StyleLine($xmin_abs, $ypos_abs, $xmax_abs, $ypos_abs);
} else {
JpGraphError::RaiseL(25125);//(" Illegal direction for static line");
}
$aImg->SetLineStyle($oldStyle);
}
public function Stroke($aImg, $aXScale, $aYScale)
{
$this->_Stroke(
$aImg,
$aImg->left_margin,
$aYScale->Translate($aYScale->GetMinVal()),
$aImg->width-$aImg->right_margin,
$aYScale->Translate($aYScale->GetMaxVal()),
$aXScale->Translate($this->scaleposition),
$aYScale->Translate($this->scaleposition)
);
}
}

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_PLOTMARK.PHP // File: JPGRAPH_PLOTMARK.PHP
// Description: Class file. Handles plotmarks // Description: Class file. Handles plotmarks
// Created: 2003-03-21 // Created: 2003-03-21
// Ver: $Id: jpgraph_plotmark.inc.php 956 2007-11-17 13:19:20Z ljp $ // Ver: $Id: jpgraph_plotmark.inc.php 1106 2009-02-22 20:16:35Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
@ -44,7 +44,7 @@ class PlotMark
//-------------- //--------------
// CONSTRUCTOR // CONSTRUCTOR
public function PlotMark() public function __construct()
{ {
$this->title = new Text(); $this->title = new Text();
$this->title->Hide(); $this->title->Hide();
@ -490,6 +490,12 @@ class ImgData
protected $maxidx = 0 ; // Max color index protected $maxidx = 0 ; // Max color index
protected $anchor_x=0.5; protected $anchor_x=0.5;
protected $anchor_y=0.5 ; // Where is the center of the image protected $anchor_y=0.5 ; // Where is the center of the image
public function __construct()
{
// Empty
}
// Create a GD image from the data and return a GD handle // Create a GD image from the data and return a GD handle
public function GetImg($aMark, $aIdx) public function GetImg($aMark, $aIdx)
{ {
@ -507,6 +513,7 @@ class ImgData
} }
return Image::CreateFromString(base64_decode($this->{$n}[$idx][1])); return Image::CreateFromString(base64_decode($this->{$n}[$idx][1]));
} }
public function GetAnchor() public function GetAnchor()
{ {
return array($this->anchor_x,$this->anchor_y); return array($this->anchor_x,$this->anchor_y);

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_POLAR.PHP // File: JPGRAPH_POLAR.PHP
// Description: Polar plot extension for JpGraph // Description: Polar plot extension for JpGraph
// Created: 2003-02-02 // Created: 2003-02-02
// Ver: $Id: jpgraph_polar.php 869 2007-03-24 11:19:38Z ljp $ // Ver: $Id: jpgraph_polar.php 1796 2009-09-07 09:37:19Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -13,8 +13,8 @@ require_once('jpgraph_plotmark.inc.php');
require_once "jpgraph_log.php"; require_once "jpgraph_log.php";
DEFINE('POLAR_360', 1); define('POLAR_360', 1);
DEFINE('POLAR_180', 2); define('POLAR_180', 2);
// //
// Note. Don't attempt to make sense of this code. // Note. Don't attempt to make sense of this code.
@ -48,7 +48,7 @@ class PolarPlot
private $iLineWeight=1; private $iLineWeight=1;
private $coord=null; private $coord=null;
public function PolarPlot($aData) public function __construct($aData)
{ {
$n = count($aData); $n = count($aData);
if ($n & 1) { if ($n & 1) {
@ -192,9 +192,9 @@ class PolarAxis extends Axis
private $show_angle_tick=true; private $show_angle_tick=true;
private $radius_tick_color='black'; private $radius_tick_color='black';
public function PolarAxis($img, $aScale) public function __construct($img, $aScale)
{ {
parent::Axis($img, $aScale); parent::__construct($img, $aScale);
} }
public function ShowAngleDegreeMark($aFlg=true) public function ShowAngleDegreeMark($aFlg=true)
@ -387,11 +387,14 @@ class PolarAxis extends Axis
$rot90 = $this->img->a == 90 ; $rot90 = $this->img->a == 90 ;
if ($type == POLAR_360) { if ($type == POLAR_360) {
// Corner angles of the four corners
$ca1 = atan($h/$w)/M_PI*180; $ca1 = atan($h/$w)/M_PI*180;
$ca2 = 180-$ca1; $ca2 = 180-$ca1;
$ca3 = $ca1+180; $ca3 = $ca1+180;
$ca4 = 360-$ca1; $ca4 = 360-$ca1;
$end = 360; $end = 360;
while ($a < $end) { while ($a < $end) {
$ca = cos($a/180*M_PI); $ca = cos($a/180*M_PI);
$sa = sin($a/180*M_PI); $sa = sin($a/180*M_PI);
@ -454,15 +457,20 @@ class PolarAxis extends Axis
} }
if ($a != 0 && $a != 180) { if ($a != 0 && $a != 180) {
$t->Align($ha, $va); $t->Align($ha, $va);
if ($this->show_angle_mark) { if ($this->scale->clockwise) {
$a .= '°'; $t->Set(360-$a);
} } else {
$t->Set($a); $t->Set($a);
}
if ($this->show_angle_mark && $t->font_family > 4) {
$a .= SymChar::Get('degree');
}
$t->Stroke($this->img, $xt, $yt); $t->Stroke($this->img, $xt, $yt);
if ($this->show_angle_tick) { if ($this->show_angle_tick) {
$this->img->Line($x1, $y1, $x2, $y2); $this->img->Line($x1, $y1, $x2, $y2);
} }
} }
$a = (int) $a;
$a += $this->angle_step; $a += $this->angle_step;
} }
} else { } else {
@ -516,14 +524,15 @@ class PolarAxis extends Axis
$y1=$y2=$yt; $y1=$y2=$yt;
} }
$t->Align($ha, $va); $t->Align($ha, $va);
if ($this->show_angle_mark) { if ($this->show_angle_mark && $t->font_family > 4) {
$a .= '°'; $a .= SymChar::Get('degree');
} }
$t->Set($a); $t->Set($a);
$t->Stroke($this->img, $xt, $yt); $t->Stroke($this->img, $xt, $yt);
if ($this->show_angle_tick) { if ($this->show_angle_tick) {
$this->img->Line($x1, $y1, $x2, $y2); $this->img->Line($x1, $y1, $x2, $y2);
} }
$a = (int) $a;
$a += $this->angle_step; $a += $this->angle_step;
} }
} }
@ -547,8 +556,7 @@ class PolarAxis extends Axis
$this->title->SetPos($this->img->width-$this->img->right_margin, $y, "right", "top"); $this->title->SetPos($this->img->width-$this->img->right_margin, $y, "right", "top");
} elseif ($this->title_adjust=="middle" || $this->title_adjust=="center") { } elseif ($this->title_adjust=="middle" || $this->title_adjust=="center") {
$this->title->SetPos( $this->title->SetPos(
($this->img->width-$this->img->left_margin- ($this->img->width-$this->img->left_margin-$this->img->right_margin)/2+$this->img->left_margin,
$this->img->right_margin)/2+$this->img->left_margin,
$y, $y,
"center", "center",
"top" "top"
@ -633,11 +641,18 @@ class PolarAxis extends Axis
class PolarScale extends LinearScale class PolarScale extends LinearScale
{ {
private $graph; private $graph;
public $clockwise=false;
public function PolarScale($aMax=0, $graph) public function __construct($aMax, $graph, $aClockwise)
{ {
parent::LinearScale(0, $aMax, 'x'); parent::__construct(0, $aMax, 'x');
$this->graph = $graph; $this->graph = $graph;
$this->clockwise = $aClockwise;
}
public function SetClockwise($aFlg)
{
$this->clockwise = $aFlg;
} }
public function _Translate($v) public function _Translate($v)
@ -651,8 +666,13 @@ class PolarScale extends LinearScale
$w = $this->graph->img->plotwidth/2; $w = $this->graph->img->plotwidth/2;
$aRad = $aRad/$m*$w; $aRad = $aRad/$m*$w;
$x = cos($aAngle/180 * M_PI) * $aRad; $a = $aAngle/180 * M_PI;
$y = sin($aAngle/180 * M_PI) * $aRad; if ($this->clockwise) {
$a = 2*M_PI-$a;
}
$x = cos($a) * $aRad;
$y = sin($a) * $aRad;
$x += $this->_Translate(0); $x += $this->_Translate(0);
@ -668,11 +688,19 @@ class PolarScale extends LinearScale
class PolarLogScale extends LogScale class PolarLogScale extends LogScale
{ {
private $graph; private $graph;
public function PolarLogScale($aMax=1, $graph) public $clockwise=false;
public function __construct($aMax, $graph, $aClockwise=false)
{ {
parent::LogScale(0, $aMax, 'x'); parent::__construct(0, $aMax, 'x');
$this->graph = $graph; $this->graph = $graph;
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE); $this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
$this->clockwise = $aClockwise;
}
public function SetClockwise($aFlg)
{
$this->clockwise = $aFlg;
} }
public function PTranslate($aAngle, $aRad) public function PTranslate($aAngle, $aRad)
@ -685,8 +713,13 @@ class PolarLogScale extends LogScale
$w = $this->graph->img->plotwidth/2; $w = $this->graph->img->plotwidth/2;
$aRad = $aRad/$m*$w; $aRad = $aRad/$m*$w;
$x = cos($aAngle/180 * M_PI) * $aRad; $a = $aAngle/180 * M_PI;
$y = sin($aAngle/180 * M_PI) * $aRad; if ($this->clockwise) {
$a = 2*M_PI-$a;
}
$x = cos($a) * $aRad;
$y = sin($a) * $aRad;
$x += $w+$this->graph->img->left_margin;//$this->_Translate(0); $x += $w+$this->graph->img->left_margin;//$this->_Translate(0);
if ($this->graph->iType == POLAR_360) { if ($this->graph->iType == POLAR_360) {
@ -703,10 +736,11 @@ class PolarGraph extends Graph
public $scale; public $scale;
public $axis; public $axis;
public $iType=POLAR_360; public $iType=POLAR_360;
private $iClockwise=false;
public function PolarGraph($aWidth=300, $aHeight=200, $aCachedName="", $aTimeOut=0, $aInline=true) public function __construct($aWidth=300, $aHeight=200, $aCachedName="", $aTimeOut=0, $aInline=true)
{ {
parent::Graph($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline) ; parent::__construct($aWidth, $aHeight, $aCachedName, $aTimeOut, $aInline) ;
$this->SetDensity(TICKD_DENSE); $this->SetDensity(TICKD_DENSE);
$this->SetBox(); $this->SetBox();
$this->SetMarginColor('white'); $this->SetMarginColor('white');
@ -717,22 +751,29 @@ class PolarGraph extends Graph
$this->SetTickDensity(TICKD_NORMAL, $aDense); $this->SetTickDensity(TICKD_NORMAL, $aDense);
} }
public function SetClockwise($aFlg)
{
$this->scale->SetClockwise($aFlg);
}
public function Set90AndMargin($lm=0, $rm=0, $tm=0, $bm=0) public function Set90AndMargin($lm=0, $rm=0, $tm=0, $bm=0)
{ {
$adj = ($this->img->height - $this->img->width)/2; $adj = ($this->img->height - $this->img->width)/2;
$this->SetAngle(90); $this->SetAngle(90);
$this->img->SetMargin($lm-$adj, $rm-$adj, $tm+$adj, $bm+$adj); $lm2 = -$adj + ($lm-$rm+$tm+$bm)/2;
$this->img->SetCenter(floor($this->img->width/2), floor($this->img->height/2)); $rm2 = -$adj + (-$lm+$rm+$tm+$bm)/2;
$tm2 = $adj + ($tm-$bm+$lm+$rm)/2;
$bm2 = $adj + (-$tm+$bm+$lm+$rm)/2;
$this->SetMargin($lm2, $rm2, $tm2, $bm2);
$this->axis->SetLabelAlign('right', 'center'); $this->axis->SetLabelAlign('right', 'center');
//JpGraphError::Raise('Set90AndMargin() is not supported for polar graphs.');
} }
public function SetScale($aScale, $rmax=0, $dummy1=1, $dummy2=1, $dummy3=1) public function SetScale($aScale, $rmax=0, $dummy1=1, $dummy2=1, $dummy3=1)
{ {
if ($aScale == 'lin') { if ($aScale == 'lin') {
$this->scale = new PolarScale($rmax, $this); $this->scale = new PolarScale($rmax, $this, $this->iClockwise);
} elseif ($aScale == 'log') { } elseif ($aScale == 'log') {
$this->scale = new PolarLogScale($rmax, $this); $this->scale = new PolarLogScale($rmax, $this, $this->iClockwise);
} else { } else {
JpGraphError::RaiseL(17004);//('Unknown scale type for polar graph. Must be "lin" or "log"'); JpGraphError::RaiseL(17004);//('Unknown scale type for polar graph. Must be "lin" or "log"');
} }
@ -833,7 +874,6 @@ class PolarGraph extends Graph
$pos = $this->img->plotheight/2 + $this->img->top_margin; $pos = $this->img->plotheight/2 + $this->img->top_margin;
} }
if (!$_csim) { if (!$_csim) {
$this->StrokePlotArea(); $this->StrokePlotArea();
} }
@ -868,16 +908,21 @@ class PolarGraph extends Graph
$this->img->plotheight+1 $this->img->plotheight+1
); );
} elseif ($this->img->a == 90) { } elseif ($this->img->a == 90) {
$adj = round(($this->img->height - $this->img->width)/2); $adj1 = round(($this->img->height - $this->img->width)/2);
$adj2 = round(($this->img->width - $this->img->height)/2);
$lm = $this->img->left_margin;
$rm = $this->img->right_margin;
$tm = $this->img->top_margin;
$bm = $this->img->bottom_margin;
$this->img->CopyCanvasH( $this->img->CopyCanvasH(
$oldimage, $oldimage,
$this->img->img, $this->img->img,
$this->img->bottom_margin-$adj, $adj2 + round(($lm-$rm+$tm+$bm)/2),
$this->img->left_margin+$adj, $adj1 + round(($tm-$bm+$lm+$rm)/2),
$this->img->bottom_margin-$adj, $adj2 + round(($lm-$rm+$tm+$bm)/2),
$this->img->left_margin+$adj, $adj1 + round(($tm-$bm+$lm+$rm)/2),
$this->img->plotheight, $this->img->plotheight+1,
$this->img->plotwidth $this->img->plotwidth+1
); );
} }
$this->img->Destroy(); $this->img->Destroy();
@ -921,12 +966,7 @@ class PolarGraph extends Graph
return $this->img->img; return $this->img->img;
} else { } else {
// Finally stream the generated picture // Finally stream the generated picture
$this->cache->PutAndStream( $this->cache->PutAndStream($this->img, $this->cache_name, $this->inline, $aStrokeFileName);
$this->img,
$this->cache_name,
$this->inline,
$aStrokeFileName
);
} }
} }
} }

View file

@ -3,25 +3,25 @@
// File: JPGRAPH_RADAR.PHP // File: JPGRAPH_RADAR.PHP
// Description: Radar plot extension for JpGraph // Description: Radar plot extension for JpGraph
// Created: 2001-02-04 // Created: 2001-02-04
// Ver: $Id: jpgraph_radar.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_radar.php 1783 2009-08-25 11:41:01Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
require_once('jpgraph_plotmark.inc.php'); require_once('jpgraph_plotmark.inc.php');
//===================================================
// CLASS RadarLogTicks
// Description: Logarithmic ticks
//===================================================
class RadarLogTicks extends Ticks class RadarLogTicks extends Ticks
{ {
//--------------- public function __construct()
// CONSTRUCTOR
public function RadarLogTicks()
{ {
// Empty
} }
//---------------
// PUBLIC METHODS
// TODO: Add Argument grid
public function Stroke($aImg, &$grid, $aPos, $aAxisAngle, $aScale, &$aMajPos, &$aMajLabel) public function Stroke($aImg, &$grid, $aPos, $aAxisAngle, $aScale, &$aMajPos, &$aMajLabel)
{ {
$start = $aScale->GetMinVal(); $start = $aScale->GetMinVal();
@ -41,10 +41,11 @@ class RadarLogTicks extends Ticks
$aMajLabel=array(); $aMajLabel=array();
if ($this->supress_first) { if ($this->supress_first) {
$aMajLabel[]=""; $aMajLabel[] = '';
} else { } else {
$aMajLabel[]=$start; $aMajLabel[]=$start;
} }
$yr=$aScale->RelTranslate($start); $yr=$aScale->RelTranslate($start);
$xt=round($yr*cos($aAxisAngle))+$aScale->scale_abs[0]; $xt=round($yr*cos($aAxisAngle))+$aScale->scale_abs[0];
$yt=$aPos-round($yr*sin($aAxisAngle)); $yt=$aPos-round($yr*sin($aAxisAngle));
@ -65,15 +66,15 @@ class RadarLogTicks extends Ticks
$aMajPos[]=$xt+2*$dx_maj; $aMajPos[]=$xt+2*$dx_maj;
$aMajPos[]=$yt-$aImg->GetFontheight()/2; $aMajPos[]=$yt-$aImg->GetFontheight()/2;
if (!$this->supress_tickmarks) { if (!$this->supress_tickmarks) {
if ($this->majcolor!="") { if ($this->majcolor != '') {
$aImg->PushColor($this->majcolor); $aImg->PushColor($this->majcolor);
} }
$aImg->Line($xt+$dx_maj, $yt+$dy_maj, $xt-$dx_maj, $yt-$dy_maj); $aImg->Line($xt+$dx_maj, $yt+$dy_maj, $xt-$dx_maj, $yt-$dy_maj);
if ($this->majcolor!="") { if ($this->majcolor != '') {
$aImg->PopColor(); $aImg->PopColor();
} }
} }
if ($this->label_formfunc != "") { if ($this->label_formfunc != '') {
$f=$this->label_formfunc; $f=$this->label_formfunc;
$l = call_user_func($f, $nextMajor); $l = call_user_func($f, $nextMajor);
} else { } else {
@ -84,39 +85,37 @@ class RadarLogTicks extends Ticks
$nextMajor *= 10; $nextMajor *= 10;
$step *= 10; $step *= 10;
$count=1; $count=1;
} elseif (!$this->supress_minor_tickmarks) { } else {
if ($this->mincolor!="") { if (!$this->supress_minor_tickmarks) {
if ($this->mincolor != '') {
$aImg->PushColor($this->mincolor); $aImg->PushColor($this->mincolor);
} }
$aImg->Line($xt+$dx_min, $yt+$dy_min, $xt-$dx_min, $yt-$dy_min); $aImg->Line($xt+$dx_min, $yt+$dy_min, $xt-$dx_min, $yt-$dy_min);
if ($this->mincolor!="") { if ($this->mincolor != '') {
$aImg->PopColor(); $aImg->PopColor();
} }
} }
} }
} }
} }
}
//===================================================
// CLASS RadarLinear
// Description: Linear ticks
//===================================================
class RadarLinearTicks extends Ticks class RadarLinearTicks extends Ticks
{ {
private $minor_step=1; private $minor_step=1;
private $major_step=2; private $major_step=2;
private $xlabel_offset=0; private $xlabel_offset=0;
private $xtick_offset=0; private $xtick_offset=0;
//--------------- public function __construct()
// CONSTRUCTOR
public function RadarLinearTicks()
{ {
// Empty // Empty
} }
//---------------
// PUBLIC METHODS
// Return major step size in world coordinates // Return major step size in world coordinates
public function GetMajor() public function GetMajor()
{ {
@ -137,11 +136,8 @@ class RadarLinearTicks extends Ticks
} }
if ($aMajStep <= 0 || $aMinStep <= 0) { if ($aMajStep <= 0 || $aMinStep <= 0) {
JpGraphError::Raise(" Minor or major step size is 0. Check that you haven't JpGraphError::RaiseL(25064);
got an accidental SetTextTicks(0) in your code.<p> //JpGraphError::Raise(" Minor or major step size is 0. Check that you haven't got an accidental SetTextTicks(0) in your code. If this is not the case you might have stumbled upon a bug in JpGraph. Please report this and if possible include the data that caused the problem.");
If this is not the case you might have stumbled upon a bug in JpGraph.
Please report this and if possible include the data that caused the
problem.");
} }
$this->major_step=$aMajStep; $this->major_step=$aMajStep;
@ -154,8 +150,8 @@ class RadarLinearTicks extends Ticks
// Prepare to draw linear ticks // Prepare to draw linear ticks
$maj_step_abs = abs($aScale->scale_factor*$this->major_step); $maj_step_abs = abs($aScale->scale_factor*$this->major_step);
$min_step_abs = abs($aScale->scale_factor*$this->minor_step); $min_step_abs = abs($aScale->scale_factor*$this->minor_step);
$nbrmaj = floor(($aScale->world_abs_size)/$maj_step_abs); $nbrmaj = round($aScale->world_abs_size/$maj_step_abs);
$nbrmin = floor(($aScale->world_abs_size)/$min_step_abs); $nbrmin = round($aScale->world_abs_size/$min_step_abs);
$skip = round($nbrmin/$nbrmaj); // Don't draw minor on top of major $skip = round($nbrmin/$nbrmaj); // Don't draw minor on top of major
// Draw major ticks // Draw major ticks
@ -165,14 +161,15 @@ class RadarLinearTicks extends Ticks
$label=$aScale->scale[0]+$this->major_step; $label=$aScale->scale[0]+$this->major_step;
$aImg->SetLineWeight($this->weight); $aImg->SetLineWeight($this->weight);
// NEW
$aMajPos = array(); $aMajPos = array();
$aMajLabel = array(); $aMajLabel = array();
for ($i=1; $i<=$nbrmaj; ++$i) { for ($i=1; $i<=$nbrmaj; ++$i) {
$xt=round($i*$maj_step_abs*cos($aAxisAngle))+$aScale->scale_abs[0]; $xt=round($i*$maj_step_abs*cos($aAxisAngle))+$aScale->scale_abs[0];
$yt=$aPos-round($i*$maj_step_abs*sin($aAxisAngle)); $yt=$aPos-round($i*$maj_step_abs*sin($aAxisAngle));
if ($this->label_formfunc != "") { if ($this->label_formfunc != '') {
$f=$this->label_formfunc; $f=$this->label_formfunc;
$l = call_user_func($f, $label); $l = call_user_func($f, $label);
} else { } else {
@ -186,11 +183,11 @@ class RadarLinearTicks extends Ticks
$aMajPos[($i-1)*2]=$xt+2*$dx; $aMajPos[($i-1)*2]=$xt+2*$dx;
$aMajPos[($i-1)*2+1]=$yt-$aImg->GetFontheight()/2; $aMajPos[($i-1)*2+1]=$yt-$aImg->GetFontheight()/2;
if (!$this->supress_tickmarks) { if (!$this->supress_tickmarks) {
if ($this->majcolor!="") { if ($this->majcolor != '') {
$aImg->PushColor($this->majcolor); $aImg->PushColor($this->majcolor);
} }
$aImg->Line($xt+$dx, $yt+$dy, $xt-$dx, $yt-$dy); $aImg->Line($xt+$dx, $yt+$dy, $xt-$dx, $yt-$dy);
if ($this->majcolor!="") { if ($this->majcolor != '') {
$aImg->PopColor(); $aImg->PopColor();
} }
} }
@ -201,7 +198,7 @@ class RadarLinearTicks extends Ticks
$dx=round(sin($aAxisAngle)*$ticklen2); $dx=round(sin($aAxisAngle)*$ticklen2);
$dy=round(cos($aAxisAngle)*$ticklen2); $dy=round(cos($aAxisAngle)*$ticklen2);
if (!$this->supress_tickmarks && !$this->supress_minor_tickmarks) { if (!$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
if ($this->mincolor!="") { if ($this->mincolor != '') {
$aImg->PushColor($this->mincolor); $aImg->PushColor($this->mincolor);
} }
for ($i=1; $i<=$nbrmin; ++$i) { for ($i=1; $i<=$nbrmin; ++$i) {
@ -212,7 +209,7 @@ class RadarLinearTicks extends Ticks
$yt=$aPos-round($i*$min_step_abs*sin($aAxisAngle)); $yt=$aPos-round($i*$min_step_abs*sin($aAxisAngle));
$aImg->Line($xt+$dx, $yt+$dy, $xt-$dx, $yt-$dy); $aImg->Line($xt+$dx, $yt+$dy, $xt-$dx, $yt-$dy);
} }
if ($this->mincolor!="") { if ($this->mincolor != '') {
$aImg->PopColor(); $aImg->PopColor();
} }
} }
@ -220,7 +217,6 @@ class RadarLinearTicks extends Ticks
} }
//=================================================== //===================================================
// CLASS RadarAxis // CLASS RadarAxis
// Description: Implements axis for the radar graph // Description: Implements axis for the radar graph
@ -228,26 +224,17 @@ class RadarLinearTicks extends Ticks
class RadarAxis extends AxisPrototype class RadarAxis extends AxisPrototype
{ {
public $title=null; public $title=null;
private $title_color="navy"; private $title_color='navy';
private $len=0; private $len=0;
//---------------
// CONSTRUCTOR public function __construct($img, $aScale, $color=array(0,0,0))
public function RadarAxis($img, $aScale, $color=array(0,0,0))
{ {
parent::Axis($img, $aScale, $color); parent::__construct($img, $aScale, $color);
$this->len = $img->plotheight; $this->len = $img->plotheight;
$this->title = new Text(); $this->title = new Text();
$this->title->SetFont(FF_FONT1, FS_BOLD); $this->title->SetFont(FF_FONT1, FS_BOLD);
$this->color = array(0,0,0); $this->color = array(0,0,0);
} }
//---------------
// PUBLIC METHODS
public function SetTickLabels($aLabelArray, $aLabelColorArray=null)
{
$this->ticks_label = $aLabelArray;
$this->ticks_label_colors = $aLabelColorArray;
}
// Stroke the axis // Stroke the axis
// $pos = Vertical position of axis // $pos = Vertical position of axis
@ -278,7 +265,7 @@ class RadarAxis extends AxisPrototype
// Draw labels // Draw labels
if ($lf && !$this->hide) { if ($lf && !$this->hide) {
$this->img->SetFont($this->font_family, $this->font_style, $this->font_size); $this->img->SetFont($this->font_family, $this->font_style, $this->font_size);
$this->img->SetTextAlign("left", "top"); $this->img->SetTextAlign('left', 'top');
$this->img->SetColor($this->label_color); $this->img->SetColor($this->label_color);
// majpos contains (x,y) coordinates for labels // majpos contains (x,y) coordinates for labels
@ -300,8 +287,6 @@ class RadarAxis extends AxisPrototype
} }
$this->_StrokeAxisTitle($pos, $aAxisAngle, $title); $this->_StrokeAxisTitle($pos, $aAxisAngle, $title);
} }
//---------------
// PRIVATE METHODS
public function _StrokeAxisTitle($pos, $aAxisAngle, $title) public function _StrokeAxisTitle($pos, $aAxisAngle, $title)
{ {
@ -330,14 +315,17 @@ class RadarAxis extends AxisPrototype
if ($aAxisAngle>=7*M_PI/4 || $aAxisAngle <= M_PI/4) { if ($aAxisAngle>=7*M_PI/4 || $aAxisAngle <= M_PI/4) {
$dx=-0.15; $dx=-0.15;
} // Small trimming to make the dist to the axis more even } // Small trimming to make the dist to the axis more even
// Around 12 a'clock // Around 12 a'clock
if ($aAxisAngle>=M_PI/4 && $aAxisAngle <= 3*M_PI/4) { if ($aAxisAngle>=M_PI/4 && $aAxisAngle <= 3*M_PI/4) {
$dx=($aAxisAngle-M_PI/4)*2/M_PI; $dx=($aAxisAngle-M_PI/4)*2/M_PI;
} }
// Around 9 a'clock // Around 9 a'clock
if ($aAxisAngle>=3*M_PI/4 && $aAxisAngle <= 5*M_PI/4) { if ($aAxisAngle>=3*M_PI/4 && $aAxisAngle <= 5*M_PI/4) {
$dx=1; $dx=1;
} }
// Around 6 a'clock // Around 6 a'clock
if ($aAxisAngle>=5*M_PI/4 && $aAxisAngle <= 7*M_PI/4) { if ($aAxisAngle>=5*M_PI/4 && $aAxisAngle <= 7*M_PI/4) {
$dx=(1-($aAxisAngle-M_PI*5/4)*2/M_PI); $dx=(1-($aAxisAngle-M_PI*5/4)*2/M_PI);
@ -380,13 +368,11 @@ class RadarGrid
private $show=false; private $show=false;
private $weight=1; private $weight=1;
//------------ public function __construct()
// CONSTRUCTOR
public function RadarGrid()
{ {
// Empty
} }
// PUBLIC METHODS
public function SetColor($aMajColor) public function SetColor($aMajColor)
{ {
$this->grid_color = $aMajColor; $this->grid_color = $aMajColor;
@ -409,17 +395,17 @@ class RadarGrid
$this->show=$aShowMajor; $this->show=$aShowMajor;
} }
//----------------
// PRIVATE METHODS
public function Stroke($img, $grid) public function Stroke($img, $grid)
{ {
if (!$this->show) { if (!$this->show) {
return; return;
} }
$nbrticks = count($grid[0])/2; $nbrticks = count($grid[0])/2;
$nbrpnts = count($grid); $nbrpnts = count($grid);
$img->SetColor($this->grid_color); $img->SetColor($this->grid_color);
$img->SetLineWeight($this->weight); $img->SetLineWeight($this->weight);
for ($i=0; $i<$nbrticks; ++$i) { for ($i=0; $i<$nbrticks; ++$i) {
for ($j=0; $j<$nbrpnts; ++$j) { for ($j=0; $j<$nbrpnts; ++$j) {
$pnts[$j*2]=$grid[$j][$i*2]; $pnts[$j*2]=$grid[$j][$i*2];
@ -427,13 +413,13 @@ class RadarGrid
} }
for ($k=0; $k<$nbrpnts; ++$k) { for ($k=0; $k<$nbrpnts; ++$k) {
$l=($k+1)%$nbrpnts; $l=($k+1)%$nbrpnts;
if ($this->type == "solid") { if ($this->type == 'solid') {
$img->Line($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1]); $img->Line($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1]);
} elseif ($this->type == "dotted") { } elseif ($this->type == 'dotted') {
$img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 1, 6); $img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 1, 6);
} elseif ($this->type == "dashed") { } elseif ($this->type == 'dashed') {
$img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 2, 4); $img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 2, 4);
} elseif ($this->type == "longdashed") { } elseif ($this->type == 'longdashed') {
$img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 8, 6); $img->DashedLine($pnts[$k*2], $pnts[$k*2+1], $pnts[$l*2], $pnts[$l*2+1], 8, 6);
} }
} }
@ -450,23 +436,27 @@ class RadarGrid
class RadarPlot class RadarPlot
{ {
public $mark=null; public $mark=null;
public $legend=""; public $legend='';
public $legendcsimtarget='';
public $legendcsimalt='';
public $csimtargets=array(); // Array of targets for CSIM
public $csimareas=""; // Resultant CSIM area tags
public $csimalts=null; // ALT:s for corresponding target
private $data=array(); private $data=array();
private $fill=false; private $fill=false;
private $fill_color=array(200,170,180); private $fill_color=array(200,170,180);
private $color=array(0,0,0); private $color=array(0,0,0);
private $weight=1; private $weight=1;
private $linestyle='solid'; private $linestyle='solid';
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function RadarPlot($data) public function __construct($data)
{ {
$this->data = $data; $this->data = $data;
$this->mark = new PlotMark(); $this->mark = new PlotMark();
} }
//---------------
// PUBLIC METHODS
public function Min() public function Min()
{ {
return Min($this->data); return Min($this->data);
@ -512,10 +502,17 @@ class RadarPlot
} }
} }
// Set href targets for CSIM
public function SetCSIMTargets($aTargets, $aAlts=null)
{
$this->csimtargets=$aTargets;
$this->csimalts=$aAlts;
}
// Get all created areas
public function GetCSIMareas() public function GetCSIMareas()
{ {
JpGraphError::RaiseL(18001); return $this->csimareas;
//("Client side image maps not supported for RadarPlots.");
} }
public function Stroke($img, $pos, $scale, $startangle) public function Stroke($img, $pos, $scale, $startangle)
@ -524,26 +521,40 @@ class RadarPlot
$astep=2*M_PI/$nbrpnts; $astep=2*M_PI/$nbrpnts;
$a=$startangle; $a=$startangle;
// Rotate each point to the correct axis-angle
// TODO: Update for LogScale
for ($i=0; $i<$nbrpnts; ++$i) { for ($i=0; $i<$nbrpnts; ++$i) {
//$c=$this->data[$i];
// Rotate each non null point to the correct axis-angle
$cs=$scale->RelTranslate($this->data[$i]); $cs=$scale->RelTranslate($this->data[$i]);
$x=round($cs*cos($a)+$scale->scale_abs[0]); $x=round($cs*cos($a)+$scale->scale_abs[0]);
$y=round($pos-$cs*sin($a)); $y=round($pos-$cs*sin($a));
/*
$c=log10($c); $pnts[$i*2]=$x;
$x=round(($c-$scale->scale[0])*$scale->scale_factor*cos($a)+$scale->scale_abs[0]); $pnts[$i*2+1]=$y;
$y=round($pos-($c-$scale->scale[0])*$scale->scale_factor*sin($a));
*/ // If the next point is null then we draw this polygon segment
// to the center, skip the next and draw the next segment from
// the center up to the point on the axis with the first non-null
// value and continues from that point. Some additoinal logic is necessary
// to handle the boundary conditions
if ($i < $nbrpnts-1) {
if (is_null($this->data[$i+1])) {
$cs = 0;
$x=round($cs*cos($a)+$scale->scale_abs[0]);
$y=round($pos-$cs*sin($a));
$pnts[$i*2]=$x; $pnts[$i*2]=$x;
$pnts[$i*2+1]=$y; $pnts[$i*2+1]=$y;
$a += $astep; $a += $astep;
} }
}
$a += $astep;
}
if ($this->fill) { if ($this->fill) {
$img->SetColor($this->fill_color); $img->SetColor($this->fill_color);
$img->FilledPolygon($pnts); $img->FilledPolygon($pnts);
} }
$img->SetLineWeight($this->weight); $img->SetLineWeight($this->weight);
$img->SetColor($this->color); $img->SetColor($this->color);
$img->SetLineStyle($this->linestyle); $img->SetLineStyle($this->linestyle);
@ -551,16 +562,23 @@ class RadarPlot
$pnts[] = $pnts[1]; $pnts[] = $pnts[1];
$img->Polygon($pnts); $img->Polygon($pnts);
$img->SetLineStyle('solid'); // Reset line style to default $img->SetLineStyle('solid'); // Reset line style to default
// Add plotmarks on top // Add plotmarks on top
if ($this->mark->show) { if ($this->mark->show) {
for ($i=0; $i < $nbrpnts; ++$i) { for ($i=0; $i < $nbrpnts; ++$i) {
if (isset($this->csimtargets[$i])) {
$this->mark->SetCSIMTarget($this->csimtargets[$i]);
$this->mark->SetCSIMAlt($this->csimalts[$i]);
$this->mark->SetCSIMAltVal($pnts[$i*2], $pnts[$i*2+1]);
$this->mark->Stroke($img, $pnts[$i*2], $pnts[$i*2+1]);
$this->csimareas .= $this->mark->GetCSIMAreas();
} else {
$this->mark->Stroke($img, $pnts[$i*2], $pnts[$i*2+1]); $this->mark->Stroke($img, $pnts[$i*2], $pnts[$i*2+1]);
} }
} }
} }
}
//---------------
// PRIVATE METHODS
public function GetCount() public function GetCount()
{ {
return count($this->data); return count($this->data);
@ -568,7 +586,7 @@ class RadarPlot
public function Legend($graph) public function Legend($graph)
{ {
if ($this->legend=="") { if ($this->legend == '') {
return; return;
} }
if ($this->fill) { if ($this->fill) {
@ -591,31 +609,19 @@ class RadarGraph extends Graph
private $posy; private $posy;
private $len; private $len;
private $axis_title=null; private $axis_title=null;
//---------------
// CONSTRUCTOR public function __construct($width=300, $height=200, $cachedName="", $timeout=0, $inline=1)
public function RadarGraph($width=300, $height=200, $cachedName="", $timeout=0, $inline=1)
{ {
$this->Graph($width, $height, $cachedName, $timeout, $inline); parent::__construct($width, $height, $cachedName, $timeout, $inline);
$this->posx = $width/2; $this->posx = $width/2;
$this->posy = $height/2; $this->posy = $height/2;
$this->len = min($width, $height)*0.35; $this->len = min($width, $height)*0.35;
$this->SetColor(array(255,255,255)); $this->SetColor(array(255,255,255));
$this->SetTickDensity(TICKD_NORMAL); $this->SetTickDensity(TICKD_NORMAL);
$this->SetScale("lin"); $this->SetScale('lin');
$this->SetGridDepth(DEPTH_FRONT); $this->SetGridDepth(DEPTH_FRONT);
} }
//---------------
// PUBLIC METHODS
public function SupressTickMarks($f=true)
{
if (ERR_DEPRECATED) {
JpGraphError::RaiseL(18002);
}
//('RadarGraph::SupressTickMarks() is deprecated. Use HideTickMarks() instead.');
$this->axis->scale->ticks->SupressTickMarks($f);
}
public function HideTickMarks($aFlag=true) public function HideTickMarks($aFlag=true)
{ {
$this->axis->scale->ticks->SupressTickMarks($aFlag); $this->axis->scale->ticks->SupressTickMarks($aFlag);
@ -628,15 +634,15 @@ class RadarGraph extends Graph
public function SetScale($axtype, $ymin=1, $ymax=1, $dummy1=null, $dumy2=null) public function SetScale($axtype, $ymin=1, $ymax=1, $dummy1=null, $dumy2=null)
{ {
if ($axtype != "lin" && $axtype != "log") { if ($axtype != 'lin' && $axtype != 'log') {
JpGraphError::RaiseL(18003, $axtype); JpGraphError::RaiseL(18003, $axtype);
//("Illegal scale for radarplot ($axtype). Must be \"lin\" or \"log\""); //("Illegal scale for radarplot ($axtype). Must be \"lin\" or \"log\"");
} }
if ($axtype=="lin") { if ($axtype == 'lin') {
$this->yscale = new LinearScale($ymin, $ymax); $this->yscale = new LinearScale($ymin, $ymax);
$this->yscale->ticks = new RadarLinearTicks(); $this->yscale->ticks = new RadarLinearTicks();
$this->yscale->ticks->SupressMinorTickMarks(); $this->yscale->ticks->SupressMinorTickMarks();
} elseif ($axtype=="log") { } elseif ($axtype == 'log') {
$this->yscale = new LogScale($ymin, $ymax); $this->yscale = new LogScale($ymin, $ymax);
$this->yscale->ticks = new RadarLogTicks(); $this->yscale->ticks = new RadarLogTicks();
} }
@ -649,8 +655,8 @@ class RadarGraph extends Graph
{ {
if ($aSize < 0.1 || $aSize>1) { if ($aSize < 0.1 || $aSize>1) {
JpGraphError::RaiseL(18004, $aSize); JpGraphError::RaiseL(18004, $aSize);
}
//("Radar Plot size must be between 0.1 and 1. (Your value=$s)"); //("Radar Plot size must be between 0.1 and 1. (Your value=$s)");
}
$this->len=min($this->img->width, $this->img->height)*$aSize/2; $this->len=min($this->img->width, $this->img->height)*$aSize/2;
} }
@ -688,24 +694,46 @@ class RadarGraph extends Graph
public function SetCenter($px, $py=0.5) public function SetCenter($px, $py=0.5)
{ {
assert($px > 0 && $py > 0); if ($px >= 0 && $px <= 1) {
$this->posx = $this->img->width*$px; $this->posx = $this->img->width*$px;
} else {
$this->posx = $px;
}
if ($py >= 0 && $py <= 1) {
$this->posy = $this->img->height*$py; $this->posy = $this->img->height*$py;
} else {
$this->posy = $py;
}
} }
public function SetColor($c) public function SetColor($aColor)
{ {
$this->SetMarginColor($c); $this->SetMarginColor($aColor);
} }
public function SetTitles($title) public function SetTitles($aTitleArray)
{ {
$this->axis_title = $title; $this->axis_title = $aTitleArray;
} }
public function Add($splot) public function Add($aPlot)
{ {
$this->plots[]=$splot; if ($aPlot == null) {
JpGraphError::RaiseL(25010);//("Graph::Add() You tried to add a null plot to the graph.");
}
if (is_array($aPlot) && count($aPlot) > 0) {
$cl = $aPlot[0];
} else {
$cl = $aPlot;
}
if ($cl instanceof Text) {
$this->AddText($aPlot);
} elseif (class_exists('IconPlot', false) && ($cl instanceof IconPlot)) {
$this->AddIcon($aPlot);
} else {
$this->plots[] = $aPlot;
}
} }
public function GetPlotsYMinMax($aPlots) public function GetPlotsYMinMax($aPlots)
@ -718,21 +746,59 @@ class RadarGraph extends Graph
} }
if ($min < 0) { if ($min < 0) {
JpGraphError::RaiseL(18006, $min); JpGraphError::RaiseL(18006, $min);
}
//("Minimum data $min (Radar plots should only be used when all data points > 0)"); //("Minimum data $min (Radar plots should only be used when all data points > 0)");
}
return array($min,$max); return array($min,$max);
} }
// Stroke the Radar graph public function StrokeIcons()
public function Stroke($aStrokeFileName="")
{ {
if ($this->iIcons != null) {
$n = count($this->iIcons);
for ($i=0; $i < $n; ++$i) {
$this->iIcons[$i]->Stroke($this->img);
}
}
}
public function StrokeTexts()
{
if ($this->texts != null) {
$n = count($this->texts);
for ($i=0; $i < $n; ++$i) {
$this->texts[$i]->Stroke($this->img);
}
}
}
// Stroke the Radar graph
public function Stroke($aStrokeFileName='')
{
// If the filename is the predefined value = '_csim_special_'
// we assume that the call to stroke only needs to do enough
// to correctly generate the CSIM maps.
// We use this variable to skip things we don't strictly need
// to do to generate the image map to improve performance
// a best we can. Therefor you will see a lot of tests !$_csim in the
// code below.
$_csim = ($aStrokeFileName === _CSIM_SPECIALFILE);
// We need to know if we have stroked the plot in the
// GetCSIMareas. Otherwise the CSIM hasn't been generated
// and in the case of GetCSIM called before stroke to generate
// CSIM without storing an image to disk GetCSIM must call Stroke.
$this->iHasStroked = true;
$n = count($this->plots); $n = count($this->plots);
// Set Y-scale // Set Y-scale
if (!$this->yscale->IsSpecified() && count($this->plots) > 0) { if (!$this->yscale->IsSpecified() && count($this->plots) > 0) {
list($min, $max) = $this->GetPlotsYMinMax($this->plots); list($min, $max) = $this->GetPlotsYMinMax($this->plots);
$this->yscale->AutoScale($this->img, 0, $max, $this->len/$this->ytick_factor); $this->yscale->AutoScale($this->img, 0, $max, $this->len/$this->ytick_factor);
} elseif ($this->yscale->IsSpecified() && } elseif ($this->yscale->IsSpecified() &&
($this->yscale->auto_ticks || !$this->yscale->ticks->IsSpecified())) { ($this->yscale->auto_ticks || !$this->yscale->ticks->IsSpecified())) {
// The tick calculation will use the user suplied min/max values to determine // The tick calculation will use the user suplied min/max values to determine
// the ticks. If auto_ticks is false the exact user specifed min and max // the ticks. If auto_ticks is false the exact user specifed min and max
// values will be used for the scale. // values will be used for the scale.
@ -762,34 +828,50 @@ class RadarGraph extends Graph
} }
} elseif (count($this->axis_title) < $nbrpnts) { } elseif (count($this->axis_title) < $nbrpnts) {
JpGraphError::RaiseL(18007); JpGraphError::RaiseL(18007);
}
// ("Number of titles does not match number of points in plot."); // ("Number of titles does not match number of points in plot.");
}
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
if ($nbrpnts != $this->plots[$i]->GetCount()) { if ($nbrpnts != $this->plots[$i]->GetCount()) {
JpGraphError::RaiseL(18008); JpGraphError::RaiseL(18008);
}
}
//("Each radar plot must have the same number of data points."); //("Each radar plot must have the same number of data points.");
}
}
if ($this->background_image != "") { if (!$_csim) {
if ($this->background_image != '') {
$this->StrokeFrameBackground(); $this->StrokeFrameBackground();
} else { } else {
$this->StrokeFrame(); $this->StrokeFrame();
$this->StrokeBackgroundGrad();
}
} }
$astep=2*M_PI/$nbrpnts; $astep=2*M_PI/$nbrpnts;
if (!$_csim) {
if ($this->iIconDepth == DEPTH_BACK) {
$this->StrokeIcons();
}
// Prepare legends // Prepare legends
for ($i=0; $i < $n; ++$i) { for ($i=0; $i < $n; ++$i) {
$this->plots[$i]->Legend($this); $this->plots[$i]->Legend($this);
} }
$this->legend->Stroke($this->img); $this->legend->Stroke($this->img);
$this->footer->Stroke($this->img); $this->footer->Stroke($this->img);
}
if (!$_csim) {
if ($this->grid_depth == DEPTH_BACK) { if ($this->grid_depth == DEPTH_BACK) {
// Draw axis and grid // Draw axis and grid
for ($i=0,$a=M_PI/2; $i < $nbrpnts; ++$i, $a += $astep) { for ($i=0,$a=M_PI/2; $i < $nbrpnts; ++$i, $a += $astep) {
$this->axis->Stroke($this->posy, $a, $grid[$i], $this->axis_title[$i], $i==0); $this->axis->Stroke($this->posy, $a, $grid[$i], $this->axis_title[$i], $i==0);
} }
$this->grid->Stroke($this->img, $grid);
}
if ($this->iIconDepth == DEPTH_BACK) {
$this->StrokeIcons();
}
} }
// Plot points // Plot points
@ -798,24 +880,24 @@ class RadarGraph extends Graph
$this->plots[$i]->Stroke($this->img, $this->posy, $this->yscale, $a); $this->plots[$i]->Stroke($this->img, $this->posy, $this->yscale, $a);
} }
if (!$_csim) {
if ($this->grid_depth != DEPTH_BACK) { if ($this->grid_depth != DEPTH_BACK) {
// Draw axis and grid // Draw axis and grid
for ($i=0,$a=M_PI/2; $i < $nbrpnts; ++$i, $a += $astep) { for ($i=0,$a=M_PI/2; $i < $nbrpnts; ++$i, $a += $astep) {
$this->axis->Stroke($this->posy, $a, $grid[$i], $this->axis_title[$i], $i==0); $this->axis->Stroke($this->posy, $a, $grid[$i], $this->axis_title[$i], $i==0);
} }
}
$this->grid->Stroke($this->img, $grid); $this->grid->Stroke($this->img, $grid);
$this->StrokeTitles(); }
// Stroke texts $this->StrokeTitles();
if ($this->texts != null) { $this->StrokeTexts();
foreach ($this->texts as $t) { if ($this->iIconDepth == DEPTH_FRONT) {
$t->Stroke($this->img); $this->StrokeIcons();
} }
} }
// Should we do any final image transformation // Should we do any final image transformation
if ($this->iImgTrans) { if ($this->iImgTrans && !$_csim) {
if (!class_exists('ImgTrans', false)) { if (!class_exists('ImgTrans', false)) {
require_once('jpgraph_imgtrans.php'); require_once('jpgraph_imgtrans.php');
} }
@ -832,6 +914,7 @@ class RadarGraph extends Graph
); );
} }
if (!$_csim) {
// If the filename is given as the special "__handle" // If the filename is given as the special "__handle"
// then the image handler is returned and the image is NOT // then the image handler is returned and the image is NOT
// streamed back // streamed back
@ -839,12 +922,8 @@ class RadarGraph extends Graph
return $this->img->img; return $this->img->img;
} else { } else {
// Finally stream the generated picture // Finally stream the generated picture
$this->cache->PutAndStream( $this->cache->PutAndStream($this->img, $this->cache_name, $this->inline, $aStrokeFileName);
$this->img, }
$this->cache_name,
$this->inline,
$aStrokeFileName
);
} }
} }
} // Class } // Class

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_REGSTAT.PHP // File: JPGRAPH_REGSTAT.PHP
// Description: Regression and statistical analysis helper classes // Description: Regression and statistical analysis helper classes
// Created: 2002-12-01 // Created: 2002-12-01
// Ver: $Id: jpgraph_regstat.php 781 2006-10-08 08:07:47Z ljp $ // Ver: $Id: jpgraph_regstat.php 1131 2009-03-11 20:08:24Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -23,7 +23,7 @@ class Spline
private $y2; // 2:nd derivate of ydata private $y2; // 2:nd derivate of ydata
private $n=0; private $n=0;
public function Spline($xdata, $ydata) public function __construct($xdata, $ydata)
{ {
$this->y2 = array(); $this->y2 = array();
$this->xdata = $xdata; $this->xdata = $xdata;
@ -121,13 +121,13 @@ class Bezier
* @license released under QPL * @license released under QPL
* @abstract Bezier interoplated point generation, * @abstract Bezier interoplated point generation,
* computed from control points data sets, based on Paul Bourke algorithm : * computed from control points data sets, based on Paul Bourke algorithm :
* http://astronomy.swin.edu.au/~pbourke/curves/bezier/ * http://local.wasp.uwa.edu.au/~pbourke/geometry/bezier/index2.html
*/ */
private $datax = array(); private $datax = array();
private $datay = array(); private $datay = array();
private $n=0; private $n=0;
public function Bezier($datax, $datay, $attraction_factor = 1) public function __construct($datax, $datay, $attraction_factor = 1)
{ {
// Adding control point multiple time will raise their attraction power over the curve // Adding control point multiple time will raise their attraction power over the curve
$this->n = count($datax); $this->n = count($datax);
@ -150,14 +150,19 @@ class Bezier
$this->n *= $attraction_factor; $this->n *= $attraction_factor;
} }
/**
* Return a set of data points that specifies the bezier curve with $steps points
* @param $steps Number of new points to return
* @return array($datax, $datay)
*/
public function Get($steps) public function Get($steps)
{ {
$datax = array(); $datax = array();
$datay = array(); $datay = array();
for ($i = 0; $i < $steps; $i++) { for ($i = 0; $i < $steps; $i++) {
list($datumx, $datumy) = $this->GetPoint((double) $i / (double) $steps); list($datumx, $datumy) = $this->GetPoint((double) $i / (double) $steps);
$datax[] = $datumx; $datax[$i] = $datumx;
$datay[] = $datumy; $datay[$i] = $datumy;
} }
$datax[] = end($this->datax); $datax[] = end($this->datax);
@ -166,6 +171,14 @@ class Bezier
return array($datax, $datay); return array($datax, $datay);
} }
/**
* Return one point on the bezier curve. $mu is the position on the curve where $mu is in the
* range 0 $mu < 1 where 0 is tha start point and 1 is the end point. Note that every newly computed
* point depends on all the existing points
*
* @param $mu Position on the bezier curve
* @return array($x, $y)
*/
public function GetPoint($mu) public function GetPoint($mu)
{ {
$n = $this->n - 1; $n = $this->n - 1;

View file

@ -0,0 +1,615 @@
<?php
//=======================================================================
// File: JPGRAPH_RGB.INC.PHP
// Description: Class to handle RGb color space specification and
// named colors
// Created: 2001-01-08 (Refactored to separate file 2008-08-01)
// Ver: $Id: jpgraph_rgb.inc.php 1893 2009-10-02 23:15:25Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
/*===================================================
// CLASS RGB
// Description: Color definitions as RGB triples
//===================================================
*/
class RGB
{
public $rgb_table;
public $img;
public function __construct($aImg=null)
{
$this->img = $aImg;
// Conversion array between color names and RGB
$this->rgb_table = array(
'aqua'=> array(0,255,255),
'lime'=> array(0,255,0),
'teal'=> array(0,128,128),
'whitesmoke'=>array(245,245,245),
'gainsboro'=>array(220,220,220),
'oldlace'=>array(253,245,230),
'linen'=>array(250,240,230),
'antiquewhite'=>array(250,235,215),
'papayawhip'=>array(255,239,213),
'blanchedalmond'=>array(255,235,205),
'bisque'=>array(255,228,196),
'peachpuff'=>array(255,218,185),
'navajowhite'=>array(255,222,173),
'moccasin'=>array(255,228,181),
'cornsilk'=>array(255,248,220),
'ivory'=>array(255,255,240),
'lemonchiffon'=>array(255,250,205),
'seashell'=>array(255,245,238),
'mintcream'=>array(245,255,250),
'azure'=>array(240,255,255),
'aliceblue'=>array(240,248,255),
'lavender'=>array(230,230,250),
'lavenderblush'=>array(255,240,245),
'mistyrose'=>array(255,228,225),
'white'=>array(255,255,255),
'black'=>array(0,0,0),
'darkslategray'=>array(47,79,79),
'dimgray'=>array(105,105,105),
'slategray'=>array(112,128,144),
'lightslategray'=>array(119,136,153),
'gray'=>array(190,190,190),
'lightgray'=>array(211,211,211),
'midnightblue'=>array(25,25,112),
'navy'=>array(0,0,128),
'indigo'=>array(75,0,130),
'electricindigo'=>array(102,0,255),
'deepindigo'=>array(138,43,226),
'pigmentindigo'=>array(75,0,130),
'indigodye'=>array(0,65,106),
'cornflowerblue'=>array(100,149,237),
'darkslateblue'=>array(72,61,139),
'slateblue'=>array(106,90,205),
'mediumslateblue'=>array(123,104,238),
'lightslateblue'=>array(132,112,255),
'mediumblue'=>array(0,0,205),
'royalblue'=>array(65,105,225),
'blue'=>array(0,0,255),
'dodgerblue'=>array(30,144,255),
'deepskyblue'=>array(0,191,255),
'skyblue'=>array(135,206,235),
'lightskyblue'=>array(135,206,250),
'steelblue'=>array(70,130,180),
'lightred'=>array(211,167,168),
'lightsteelblue'=>array(176,196,222),
'lightblue'=>array(173,216,230),
'powderblue'=>array(176,224,230),
'paleturquoise'=>array(175,238,238),
'darkturquoise'=>array(0,206,209),
'mediumturquoise'=>array(72,209,204),
'turquoise'=>array(64,224,208),
'cyan'=>array(0,255,255),
'lightcyan'=>array(224,255,255),
'cadetblue'=>array(95,158,160),
'mediumaquamarine'=>array(102,205,170),
'aquamarine'=>array(127,255,212),
'darkgreen'=>array(0,100,0),
'darkolivegreen'=>array(85,107,47),
'darkseagreen'=>array(143,188,143),
'seagreen'=>array(46,139,87),
'mediumseagreen'=>array(60,179,113),
'lightseagreen'=>array(32,178,170),
'palegreen'=>array(152,251,152),
'springgreen'=>array(0,255,127),
'lawngreen'=>array(124,252,0),
'green'=>array(0,255,0),
'chartreuse'=>array(127,255,0),
'mediumspringgreen'=>array(0,250,154),
'greenyellow'=>array(173,255,47),
'limegreen'=>array(50,205,50),
'yellowgreen'=>array(154,205,50),
'forestgreen'=>array(34,139,34),
'olivedrab'=>array(107,142,35),
'darkkhaki'=>array(189,183,107),
'khaki'=>array(240,230,140),
'palegoldenrod'=>array(238,232,170),
'lightgoldenrodyellow'=>array(250,250,210),
'lightyellow'=>array(255,255,200),
'yellow'=>array(255,255,0),
'gold'=>array(255,215,0),
'lightgoldenrod'=>array(238,221,130),
'goldenrod'=>array(218,165,32),
'darkgoldenrod'=>array(184,134,11),
'rosybrown'=>array(188,143,143),
'indianred'=>array(205,92,92),
'saddlebrown'=>array(139,69,19),
'sienna'=>array(160,82,45),
'peru'=>array(205,133,63),
'burlywood'=>array(222,184,135),
'beige'=>array(245,245,220),
'wheat'=>array(245,222,179),
'sandybrown'=>array(244,164,96),
'tan'=>array(210,180,140),
'chocolate'=>array(210,105,30),
'firebrick'=>array(178,34,34),
'brown'=>array(165,42,42),
'darksalmon'=>array(233,150,122),
'salmon'=>array(250,128,114),
'lightsalmon'=>array(255,160,122),
'orange'=>array(255,165,0),
'darkorange'=>array(255,140,0),
'coral'=>array(255,127,80),
'lightcoral'=>array(240,128,128),
'tomato'=>array(255,99,71),
'orangered'=>array(255,69,0),
'red'=>array(255,0,0),
'hotpink'=>array(255,105,180),
'deeppink'=>array(255,20,147),
'pink'=>array(255,192,203),
'lightpink'=>array(255,182,193),
'palevioletred'=>array(219,112,147),
'maroon'=>array(176,48,96),
'mediumvioletred'=>array(199,21,133),
'violetred'=>array(208,32,144),
'magenta'=>array(255,0,255),
'violet'=>array(238,130,238),
'plum'=>array(221,160,221),
'orchid'=>array(218,112,214),
'mediumorchid'=>array(186,85,211),
'darkorchid'=>array(153,50,204),
'darkviolet'=>array(148,0,211),
'blueviolet'=>array(138,43,226),
'purple'=>array(160,32,240),
'mediumpurple'=>array(147,112,219),
'thistle'=>array(216,191,216),
'snow1'=>array(255,250,250),
'snow2'=>array(238,233,233),
'snow3'=>array(205,201,201),
'snow4'=>array(139,137,137),
'seashell1'=>array(255,245,238),
'seashell2'=>array(238,229,222),
'seashell3'=>array(205,197,191),
'seashell4'=>array(139,134,130),
'AntiqueWhite1'=>array(255,239,219),
'AntiqueWhite2'=>array(238,223,204),
'AntiqueWhite3'=>array(205,192,176),
'AntiqueWhite4'=>array(139,131,120),
'bisque1'=>array(255,228,196),
'bisque2'=>array(238,213,183),
'bisque3'=>array(205,183,158),
'bisque4'=>array(139,125,107),
'peachPuff1'=>array(255,218,185),
'peachpuff2'=>array(238,203,173),
'peachpuff3'=>array(205,175,149),
'peachpuff4'=>array(139,119,101),
'navajowhite1'=>array(255,222,173),
'navajowhite2'=>array(238,207,161),
'navajowhite3'=>array(205,179,139),
'navajowhite4'=>array(139,121,94),
'lemonchiffon1'=>array(255,250,205),
'lemonchiffon2'=>array(238,233,191),
'lemonchiffon3'=>array(205,201,165),
'lemonchiffon4'=>array(139,137,112),
'ivory1'=>array(255,255,240),
'ivory2'=>array(238,238,224),
'ivory3'=>array(205,205,193),
'ivory4'=>array(139,139,131),
'honeydew'=>array(193,205,193),
'lavenderblush1'=>array(255,240,245),
'lavenderblush2'=>array(238,224,229),
'lavenderblush3'=>array(205,193,197),
'lavenderblush4'=>array(139,131,134),
'mistyrose1'=>array(255,228,225),
'mistyrose2'=>array(238,213,210),
'mistyrose3'=>array(205,183,181),
'mistyrose4'=>array(139,125,123),
'azure1'=>array(240,255,255),
'azure2'=>array(224,238,238),
'azure3'=>array(193,205,205),
'azure4'=>array(131,139,139),
'slateblue1'=>array(131,111,255),
'slateblue2'=>array(122,103,238),
'slateblue3'=>array(105,89,205),
'slateblue4'=>array(71,60,139),
'royalblue1'=>array(72,118,255),
'royalblue2'=>array(67,110,238),
'royalblue3'=>array(58,95,205),
'royalblue4'=>array(39,64,139),
'dodgerblue1'=>array(30,144,255),
'dodgerblue2'=>array(28,134,238),
'dodgerblue3'=>array(24,116,205),
'dodgerblue4'=>array(16,78,139),
'steelblue1'=>array(99,184,255),
'steelblue2'=>array(92,172,238),
'steelblue3'=>array(79,148,205),
'steelblue4'=>array(54,100,139),
'deepskyblue1'=>array(0,191,255),
'deepskyblue2'=>array(0,178,238),
'deepskyblue3'=>array(0,154,205),
'deepskyblue4'=>array(0,104,139),
'skyblue1'=>array(135,206,255),
'skyblue2'=>array(126,192,238),
'skyblue3'=>array(108,166,205),
'skyblue4'=>array(74,112,139),
'lightskyblue1'=>array(176,226,255),
'lightskyblue2'=>array(164,211,238),
'lightskyblue3'=>array(141,182,205),
'lightskyblue4'=>array(96,123,139),
'slategray1'=>array(198,226,255),
'slategray2'=>array(185,211,238),
'slategray3'=>array(159,182,205),
'slategray4'=>array(108,123,139),
'lightsteelblue1'=>array(202,225,255),
'lightsteelblue2'=>array(188,210,238),
'lightsteelblue3'=>array(162,181,205),
'lightsteelblue4'=>array(110,123,139),
'lightblue1'=>array(191,239,255),
'lightblue2'=>array(178,223,238),
'lightblue3'=>array(154,192,205),
'lightblue4'=>array(104,131,139),
'lightcyan1'=>array(224,255,255),
'lightcyan2'=>array(209,238,238),
'lightcyan3'=>array(180,205,205),
'lightcyan4'=>array(122,139,139),
'paleturquoise1'=>array(187,255,255),
'paleturquoise2'=>array(174,238,238),
'paleturquoise3'=>array(150,205,205),
'paleturquoise4'=>array(102,139,139),
'cadetblue1'=>array(152,245,255),
'cadetblue2'=>array(142,229,238),
'cadetblue3'=>array(122,197,205),
'cadetblue4'=>array(83,134,139),
'turquoise1'=>array(0,245,255),
'turquoise2'=>array(0,229,238),
'turquoise3'=>array(0,197,205),
'turquoise4'=>array(0,134,139),
'cyan1'=>array(0,255,255),
'cyan2'=>array(0,238,238),
'cyan3'=>array(0,205,205),
'cyan4'=>array(0,139,139),
'darkslategray1'=>array(151,255,255),
'darkslategray2'=>array(141,238,238),
'darkslategray3'=>array(121,205,205),
'darkslategray4'=>array(82,139,139),
'aquamarine1'=>array(127,255,212),
'aquamarine2'=>array(118,238,198),
'aquamarine3'=>array(102,205,170),
'aquamarine4'=>array(69,139,116),
'darkseagreen1'=>array(193,255,193),
'darkseagreen2'=>array(180,238,180),
'darkseagreen3'=>array(155,205,155),
'darkseagreen4'=>array(105,139,105),
'seagreen1'=>array(84,255,159),
'seagreen2'=>array(78,238,148),
'seagreen3'=>array(67,205,128),
'seagreen4'=>array(46,139,87),
'palegreen1'=>array(154,255,154),
'palegreen2'=>array(144,238,144),
'palegreen3'=>array(124,205,124),
'palegreen4'=>array(84,139,84),
'springgreen1'=>array(0,255,127),
'springgreen2'=>array(0,238,118),
'springgreen3'=>array(0,205,102),
'springgreen4'=>array(0,139,69),
'chartreuse1'=>array(127,255,0),
'chartreuse2'=>array(118,238,0),
'chartreuse3'=>array(102,205,0),
'chartreuse4'=>array(69,139,0),
'olivedrab1'=>array(192,255,62),
'olivedrab2'=>array(179,238,58),
'olivedrab3'=>array(154,205,50),
'olivedrab4'=>array(105,139,34),
'darkolivegreen1'=>array(202,255,112),
'darkolivegreen2'=>array(188,238,104),
'darkolivegreen3'=>array(162,205,90),
'darkolivegreen4'=>array(110,139,61),
'khaki1'=>array(255,246,143),
'khaki2'=>array(238,230,133),
'khaki3'=>array(205,198,115),
'khaki4'=>array(139,134,78),
'lightgoldenrod1'=>array(255,236,139),
'lightgoldenrod2'=>array(238,220,130),
'lightgoldenrod3'=>array(205,190,112),
'lightgoldenrod4'=>array(139,129,76),
'yellow1'=>array(255,255,0),
'yellow2'=>array(238,238,0),
'yellow3'=>array(205,205,0),
'yellow4'=>array(139,139,0),
'gold1'=>array(255,215,0),
'gold2'=>array(238,201,0),
'gold3'=>array(205,173,0),
'gold4'=>array(139,117,0),
'goldenrod1'=>array(255,193,37),
'goldenrod2'=>array(238,180,34),
'goldenrod3'=>array(205,155,29),
'goldenrod4'=>array(139,105,20),
'darkgoldenrod1'=>array(255,185,15),
'darkgoldenrod2'=>array(238,173,14),
'darkgoldenrod3'=>array(205,149,12),
'darkgoldenrod4'=>array(139,101,8),
'rosybrown1'=>array(255,193,193),
'rosybrown2'=>array(238,180,180),
'rosybrown3'=>array(205,155,155),
'rosybrown4'=>array(139,105,105),
'indianred1'=>array(255,106,106),
'indianred2'=>array(238,99,99),
'indianred3'=>array(205,85,85),
'indianred4'=>array(139,58,58),
'sienna1'=>array(255,130,71),
'sienna2'=>array(238,121,66),
'sienna3'=>array(205,104,57),
'sienna4'=>array(139,71,38),
'burlywood1'=>array(255,211,155),
'burlywood2'=>array(238,197,145),
'burlywood3'=>array(205,170,125),
'burlywood4'=>array(139,115,85),
'wheat1'=>array(255,231,186),
'wheat2'=>array(238,216,174),
'wheat3'=>array(205,186,150),
'wheat4'=>array(139,126,102),
'tan1'=>array(255,165,79),
'tan2'=>array(238,154,73),
'tan3'=>array(205,133,63),
'tan4'=>array(139,90,43),
'chocolate1'=>array(255,127,36),
'chocolate2'=>array(238,118,33),
'chocolate3'=>array(205,102,29),
'chocolate4'=>array(139,69,19),
'firebrick1'=>array(255,48,48),
'firebrick2'=>array(238,44,44),
'firebrick3'=>array(205,38,38),
'firebrick4'=>array(139,26,26),
'brown1'=>array(255,64,64),
'brown2'=>array(238,59,59),
'brown3'=>array(205,51,51),
'brown4'=>array(139,35,35),
'salmon1'=>array(255,140,105),
'salmon2'=>array(238,130,98),
'salmon3'=>array(205,112,84),
'salmon4'=>array(139,76,57),
'lightsalmon1'=>array(255,160,122),
'lightsalmon2'=>array(238,149,114),
'lightsalmon3'=>array(205,129,98),
'lightsalmon4'=>array(139,87,66),
'orange1'=>array(255,165,0),
'orange2'=>array(238,154,0),
'orange3'=>array(205,133,0),
'orange4'=>array(139,90,0),
'darkorange1'=>array(255,127,0),
'darkorange2'=>array(238,118,0),
'darkorange3'=>array(205,102,0),
'darkorange4'=>array(139,69,0),
'coral1'=>array(255,114,86),
'coral2'=>array(238,106,80),
'coral3'=>array(205,91,69),
'coral4'=>array(139,62,47),
'tomato1'=>array(255,99,71),
'tomato2'=>array(238,92,66),
'tomato3'=>array(205,79,57),
'tomato4'=>array(139,54,38),
'orangered1'=>array(255,69,0),
'orangered2'=>array(238,64,0),
'orangered3'=>array(205,55,0),
'orangered4'=>array(139,37,0),
'deeppink1'=>array(255,20,147),
'deeppink2'=>array(238,18,137),
'deeppink3'=>array(205,16,118),
'deeppink4'=>array(139,10,80),
'hotpink1'=>array(255,110,180),
'hotpink2'=>array(238,106,167),
'hotpink3'=>array(205,96,144),
'hotpink4'=>array(139,58,98),
'pink1'=>array(255,181,197),
'pink2'=>array(238,169,184),
'pink3'=>array(205,145,158),
'pink4'=>array(139,99,108),
'lightpink1'=>array(255,174,185),
'lightpink2'=>array(238,162,173),
'lightpink3'=>array(205,140,149),
'lightpink4'=>array(139,95,101),
'palevioletred1'=>array(255,130,171),
'palevioletred2'=>array(238,121,159),
'palevioletred3'=>array(205,104,137),
'palevioletred4'=>array(139,71,93),
'maroon1'=>array(255,52,179),
'maroon2'=>array(238,48,167),
'maroon3'=>array(205,41,144),
'maroon4'=>array(139,28,98),
'violetred1'=>array(255,62,150),
'violetred2'=>array(238,58,140),
'violetred3'=>array(205,50,120),
'violetred4'=>array(139,34,82),
'magenta1'=>array(255,0,255),
'magenta2'=>array(238,0,238),
'magenta3'=>array(205,0,205),
'magenta4'=>array(139,0,139),
'mediumred'=>array(140,34,34),
'orchid1'=>array(255,131,250),
'orchid2'=>array(238,122,233),
'orchid3'=>array(205,105,201),
'orchid4'=>array(139,71,137),
'plum1'=>array(255,187,255),
'plum2'=>array(238,174,238),
'plum3'=>array(205,150,205),
'plum4'=>array(139,102,139),
'mediumorchid1'=>array(224,102,255),
'mediumorchid2'=>array(209,95,238),
'mediumorchid3'=>array(180,82,205),
'mediumorchid4'=>array(122,55,139),
'darkorchid1'=>array(191,62,255),
'darkorchid2'=>array(178,58,238),
'darkorchid3'=>array(154,50,205),
'darkorchid4'=>array(104,34,139),
'purple1'=>array(155,48,255),
'purple2'=>array(145,44,238),
'purple3'=>array(125,38,205),
'purple4'=>array(85,26,139),
'mediumpurple1'=>array(171,130,255),
'mediumpurple2'=>array(159,121,238),
'mediumpurple3'=>array(137,104,205),
'mediumpurple4'=>array(93,71,139),
'thistle1'=>array(255,225,255),
'thistle2'=>array(238,210,238),
'thistle3'=>array(205,181,205),
'thistle4'=>array(139,123,139),
'gray1'=>array(10,10,10),
'gray2'=>array(40,40,30),
'gray3'=>array(70,70,70),
'gray4'=>array(100,100,100),
'gray5'=>array(130,130,130),
'gray6'=>array(160,160,160),
'gray7'=>array(190,190,190),
'gray8'=>array(210,210,210),
'gray9'=>array(240,240,240),
'darkgray'=>array(100,100,100),
'darkblue'=>array(0,0,139),
'darkcyan'=>array(0,139,139),
'darkmagenta'=>array(139,0,139),
'darkred'=>array(139,0,0),
'silver'=>array(192, 192, 192),
'eggplant'=>array(144,176,168),
'lightgreen'=>array(144,238,144));
}
//----------------
// PUBLIC METHODS
// Colors can be specified as either
// 1. #xxxxxx HTML style
// 2. "colorname" as a named color
// 3. array(r,g,b) RGB triple
// This function translates this to a native RGB format and returns an
// RGB triple.
public function Color($aColor)
{
if (is_string($aColor)) {
$matches = array();
// this regex will parse a color string and fill the $matches array as such:
// 0: the full match if any
// 1: a hex string preceded by a hash, can be 3 characters (#fff) or 6 (#ffffff) (4 or 5 also accepted but...)
// 2,3,4: r,g,b values in hex if the first character of the string is #
// 5: all alpha-numeric characters at the beginning of the string if string does not start with #
// 6: alpha value prefixed by @ if supplied
// 7: alpha value with @ stripped
// 8: adjust value prefixed with : if supplied
// 9: adjust value with : stripped
$regex = '/(#([0-9a-fA-F]{1,2})([0-9a-fA-F]{1,2})([0-9a-fA-F]{1,2}))?([\w]+)?(@([\d\.,]+))?(:([\d\.,]+))?/';
if (!preg_match($regex, $aColor, $matches)) {
JpGraphError::RaiseL(25078, $aColor);//(" Unknown color: $aColor");
}
if (empty($matches[5])) {
$r = strlen($matches[2]) == 1 ? $matches[2].$matches[2] : $matches[2];
$g = strlen($matches[3]) == 1 ? $matches[3].$matches[3] : $matches[3];
$b = strlen($matches[4]) == 1 ? $matches[4].$matches[4] : $matches[4];
$r = hexdec($r);
$g = hexdec($g);
$b = hexdec($b);
} else {
if (!isset($this->rgb_table[$matches[5]])) {
JpGraphError::RaiseL(25078, $aColor);//(" Unknown color: $aColor");
}
$r = $this->rgb_table[$matches[5]][0];
$g = $this->rgb_table[$matches[5]][1];
$b = $this->rgb_table[$matches[5]][2];
}
$alpha = isset($matches[7]) ? str_replace(',', '.', $matches[7]) : 0;
$adj = isset($matches[9]) ? str_replace(',', '.', $matches[9]) : 1.0;
if ($adj < 0) {
JpGraphError::RaiseL(25077);//('Adjustment factor for color must be > 0');
}
// Scale adj so that an adj=2 always
// makes the color 100% white (i.e. 255,255,255.
// and adj=1 neutral and adj=0 black.
if ($adj == 1) {
return array($r,$g,$b,$alpha);
} elseif ($adj > 1) {
$m = ($adj-1.0)*(255-min(255, min($r, min($g, $b))));
return array(min(255, $r+$m), min(255, $g+$m), min(255, $b+$m),$alpha);
} elseif ($adj < 1) {
$m = ($adj-1.0)*max(255, max($r, max($g, $b)));
return array(max(0, $r+$m), max(0, $g+$m), max(0, $b+$m),$alpha);
}
} elseif (is_array($aColor)) {
if (!isset($aColor[3])) {
$aColor[3] = 0;
}
return $aColor;
} else {
JpGraphError::RaiseL(25079, $aColor, count($aColor));//(" Unknown color specification: $aColor , size=".count($aColor));
}
}
// Compare two colors
// return true if equal
public function Equal($aCol1, $aCol2)
{
$c1 = $this->Color($aCol1);
$c2 = $this->Color($aCol2);
return $c1[0]==$c2[0] && $c1[1]==$c2[1] && $c1[2]==$c2[2] ;
}
// Allocate a new color in the current image
// Return new color index, -1 if no more colors could be allocated
public function Allocate($aColor, $aAlpha=0.0)
{
list($r, $g, $b, $a) = $this->color($aColor);
// If alpha is specified in the color string then this
// takes precedence over the second argument
if ($a > 0) {
$aAlpha = $a;
}
if ($aAlpha < 0 || $aAlpha > 1) {
JpGraphError::RaiseL(25080);//('Alpha parameter for color must be between 0.0 and 1.0');
}
return imagecolorresolvealpha($this->img, $r, $g, $b, round($aAlpha * 127));
}
// Try to convert an array with three valid numbers to the corresponding hex array
// This is currenly only used in processing the colors for barplots in order to be able
// to handle the case where the color might be specified as an array of colros as well.
// In that case we must be able to find out if an array of values should be interpretated as
// a single color (specifeid as an RGB triple)
public static function tryHexConversion($aColor)
{
if (is_array($aColor)) {
if (count($aColor) == 3) {
if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
if (($aColor[0] >= 0 && $aColor[0] <= 255) &&
($aColor[1] >= 0 && $aColor[1] <= 255) &&
($aColor[2] >= 0 && $aColor[2] <= 255)) {
return sprintf('#%02x%02x%02x', $aColor[0], $aColor[1], $aColor[2]);
}
}
}
}
return $aColor;
}
// Return a RGB tripple corresponding to a position in the normal light spectrum
// The argumen values is in the range [0, 1] where a value of 0 correponds to blue and
// a value of 1 corresponds to red. Values in betwen is mapped to a linear interpolation
// of the constituting colors in the visible color spectra.
// The $aDynamicRange specified how much of the dynamic range we shold use
// a value of 1.0 give the full dyanmic range and a lower value give more dark
// colors. In the extreme of 0.0 then all colors will be black.
public static function GetSpectrum($aVal, $aDynamicRange=1.0)
{
if ($aVal < 0 || $aVal > 1.0001) {
return array(0,0,0); // Invalid case - just return black
}
$sat = round(255*$aDynamicRange);
$a = 0.25;
if ($aVal <= 0.25) {
return array(0, round($sat*$aVal/$a), $sat);
} elseif ($aVal <= 0.5) {
return array(0, $sat, round($sat-$sat*($aVal-0.25)/$a));
} elseif ($aVal <= 0.75) {
return array(round($sat*($aVal-0.5)/$a), $sat, 0);
} else {
return array($sat, round($sat-$sat*($aVal-0.75)/$a), 0);
}
}
} // Class

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_SCATTER.PHP // File: JPGRAPH_SCATTER.PHP
// Description: Scatter (and impuls) plot extension for JpGraph // Description: Scatter (and impuls) plot extension for JpGraph
// Created: 2001-02-11 // Created: 2001-02-11
// Ver: $Id: jpgraph_scatter.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_scatter.php 1397 2009-06-27 21:34:14Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
require_once('jpgraph_plotmark.inc.php'); require_once('jpgraph_plotmark.inc.php');
@ -20,9 +20,11 @@ class FieldArrow
public $iSize=10; // Length in pixels for arrow public $iSize=10; // Length in pixels for arrow
public $iArrowSize = 2; public $iArrowSize = 2;
private $isizespec = array( 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)); 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() );
public function __construct()
{ {
// Empty
} }
public function SetSize($aSize, $aArrowSize=2) public function SetSize($aSize, $aArrowSize=2)
@ -71,7 +73,7 @@ class FieldPlot extends Plot
private $iAngles = array(); private $iAngles = array();
private $iCallback = ''; private $iCallback = '';
public function FieldPlot($datay, $datax, $angles) public function __construct($datay, $datax, $angles)
{ {
if ((count($datax) != count($datay))) { if ((count($datax) != count($datay))) {
JpGraphError::RaiseL(20001); JpGraphError::RaiseL(20001);
@ -82,7 +84,7 @@ class FieldPlot extends Plot
$this->iAngles = $angles; $this->iAngles = $angles;
$this->Plot($datay, $datax); parent::__construct($datay, $datax);
$this->value->SetAlign('center', 'center'); $this->value->SetAlign('center', 'center');
$this->value->SetMargin(15); $this->value->SetMargin(15);
@ -156,24 +158,24 @@ class FieldPlot extends Plot
//=================================================== //===================================================
class ScatterPlot extends Plot class ScatterPlot extends Plot
{ {
public $mark = ''; public $mark;
public $link;
private $impuls = false; private $impuls = false;
private $linkpoints = false;
private $linkpointweight=1;
private $linkpointcolor="black";
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function ScatterPlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
if ((count($datax) != count($datay)) && is_array($datax)) { if (is_array($datax) && (count($datax) != count($datay))) {
JpGraphError::RaiseL(20003); JpGraphError::RaiseL(20003);//("Scatterplot must have equal number of X and Y points.");
}//("Scatterplot must have equal number of X and Y points."); }
$this->Plot($datay, $datax); parent::__construct($datay, $datax);
$this->mark = new PlotMark(); $this->mark = new PlotMark();
$this->mark->SetType(MARK_SQUARE); $this->mark->SetType(MARK_SQUARE);
$this->mark->SetColor($this->color); $this->mark->SetColor($this->color);
$this->value->SetAlign('center', 'center'); $this->value->SetAlign('center', 'center');
$this->value->SetMargin(0); $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; $this->impuls = $f;
} }
// Combine the scatter plot points with a line public function SetStem($f=true)
public function SetLinkPoints($aFlag=true, $aColor="black", $aWeight=1)
{ {
$this->linkpoints=$aFlag; $this->impuls = $f;
$this->linkpointcolor=$aColor; }
$this->linkpointweight=$aWeight;
// 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) public function Stroke($img, $xscale, $yscale)
@ -216,10 +224,12 @@ class ScatterPlot extends Plot
$yt = $yscale->Translate($this->coords[0][$i]); $yt = $yscale->Translate($this->coords[0][$i]);
if ($this->linkpoints && isset($yt_old)) { if ($this->link->iShow && isset($yt_old)) {
$img->SetColor($this->linkpointcolor); $img->SetColor($this->link->iColor);
$img->SetLineWeight($this->linkpointweight); $img->SetLineWeight($this->link->iWeight);
$img->Line($xt_old, $yt_old, $xt, $yt); $old = $img->SetLineStyle($this->link->iStyle);
$img->StyleLine($xt_old, $yt_old, $xt, $yt);
$img->SetLineStyle($old);
} }
if ($this->impuls) { if ($this->impuls) {

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_STOCK.PHP // File: JPGRAPH_STOCK.PHP
// Description: Stock plot extension for JpGraph // Description: Stock plot extension for JpGraph
// Created: 2003-01-27 // Created: 2003-01-27
// Ver: $Id: jpgraph_stock.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_stock.php 1364 2009-06-24 07:07:44Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -22,13 +22,13 @@ class StockPlot extends Plot
private $iStockColor3='darkred'; private $iStockColor3='darkred';
//--------------- //---------------
// CONSTRUCTOR // CONSTRUCTOR
public function StockPlot($datay, $datax=false) public function __construct($datay, $datax=false)
{ {
if (count($datay) % $this->iTupleSize) { if (count($datay) % $this->iTupleSize) {
JpGraphError::RaiseL(21001, $this->iTupleSize); JpGraphError::RaiseL(21001, $this->iTupleSize);
//('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.'); //('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; $this->numpoints /= $this->iTupleSize;
} }
//--------------- //---------------
@ -78,9 +78,8 @@ class StockPlot extends Plot
if (isset($this->coords[1])) { if (isset($this->coords[1])) {
if (count($this->coords[1])!=$n) { if (count($this->coords[1])!=$n) {
JpGraphError::RaiseL(2003, 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"); // ("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
else { } else {
$exist_x = true; $exist_x = true;
} }
} else { } else {
@ -98,12 +97,15 @@ class StockPlot extends Plot
for ($i=0; $i<$n; ++$i) { for ($i=0; $i<$n; ++$i) {
//If value is NULL, then don't draw a bar at all //If value is NULL, then don't draw a bar at all
if ($this->coords[0][$i] === null) { if ($this->coords[0][$i*$ts] === null) {
continue; continue;
} }
if ($exist_x) { if ($exist_x) {
$x=$this->coords[1][$i]; $x=$this->coords[1][$i];
if ($x === null) {
continue;
}
} else { } else {
$x=$i; $x=$i;
} }
@ -183,10 +185,11 @@ class BoxPlot extends StockPlot
{ {
private $iPColor='black'; private $iPColor='black';
private $iNColor='white'; private $iNColor='white';
public function BoxPlot($datay, $datax=false)
public function __construct($datay, $datax=false)
{ {
$this->iTupleSize=5; $this->iTupleSize=5;
parent::StockPlot($datay, $datax); parent::__construct($datay, $datax);
} }
public function SetMedianColor($aPos, $aNeg) public function SetMedianColor($aPos, $aNeg)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,387 @@
<?php
//=======================================================================
// File: JPGRAPH_TEXT.INC.PHP
// Description: Class to handle text as object in the graph.
// The low level text layout engine is handled by the GD class
// Created: 2001-01-08 (Refactored to separate file 2008-08-01)
// Ver: $Id: jpgraph_text.inc.php 1844 2009-09-26 17:05:31Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
//===================================================
// CLASS Text
// Description: Arbitrary text object that can be added to the graph
//===================================================
class Text
{
public $t;
public $x=0;
public $y=0;
public $halign="left";
public $valign="top";
public $color=array(0,0,0);
public $hide=false;
public $dir=0;
public $iScalePosY=null;
public $iScalePosX=null;
public $iWordwrap=0;
public $font_family=FF_DEFAULT;
public $font_style=FS_NORMAL; // old. FF_FONT1
protected $boxed=false; // Should the text be boxed
protected $paragraph_align="left";
protected $icornerradius=0;
protected $ishadowwidth=3;
protected $fcolor='white';
protected $bcolor='black';
protected $shadow=false;
protected $iCSIMarea='';
protected $iCSIMalt='';
protected $iCSIMtarget='';
protected $iCSIMWinTarget='';
private $iBoxType = 1; // Which variant of filled box around text we want
// for __get, __set
private $_margin;
private $_font_size=8; // old. 12
//---------------
// CONSTRUCTOR
// Create new text at absolute pixel coordinates
public function __construct($aTxt="", $aXAbsPos=0, $aYAbsPos=0)
{
if (! is_string($aTxt)) {
JpGraphError::RaiseL(25050);//('First argument to Text::Text() must be s atring.');
}
$this->t = $aTxt;
$this->x = round($aXAbsPos);
$this->y = round($aYAbsPos);
$this->margin = 0;
}
//---------------
// PUBLIC METHODS
// Set the string in the text object
public function Set($aTxt)
{
$this->t = $aTxt;
}
// Alias for Pos()
public function SetPos($aXAbsPos=0, $aYAbsPos=0, $aHAlign="left", $aVAlign="top")
{
//$this->Pos($aXAbsPos,$aYAbsPos,$aHAlign,$aVAlign);
$this->x = $aXAbsPos;
$this->y = $aYAbsPos;
$this->halign = $aHAlign;
$this->valign = $aVAlign;
}
public function SetScalePos($aX, $aY)
{
$this->iScalePosX = $aX;
$this->iScalePosY = $aY;
}
// Specify alignment for the text
public function Align($aHAlign, $aVAlign="top", $aParagraphAlign="")
{
$this->halign = $aHAlign;
$this->valign = $aVAlign;
if ($aParagraphAlign != "") {
$this->paragraph_align = $aParagraphAlign;
}
}
// Alias
public function SetAlign($aHAlign, $aVAlign="top", $aParagraphAlign="")
{
$this->Align($aHAlign, $aVAlign, $aParagraphAlign);
}
// Specifies the alignment for a multi line text
public function ParagraphAlign($aAlign)
{
$this->paragraph_align = $aAlign;
}
// Specifies the alignment for a multi line text
public function SetParagraphAlign($aAlign)
{
$this->paragraph_align = $aAlign;
}
public function SetShadow($aShadowColor='gray', $aShadowWidth=3)
{
$this->ishadowwidth=$aShadowWidth;
$this->shadow=$aShadowColor;
$this->boxed=true;
}
public function SetWordWrap($aCol)
{
$this->iWordwrap = $aCol ;
}
// Specify that the text should be boxed. fcolor=frame color, bcolor=border color,
// $shadow=drop shadow should be added around the text.
public function SetBox($aFrameColor=array(255,255,255), $aBorderColor=array(0,0,0), $aShadowColor=false, $aCornerRadius=4, $aShadowWidth=3)
{
if ($aFrameColor === false) {
$this->boxed=false;
} else {
$this->boxed=true;
}
$this->fcolor=$aFrameColor;
$this->bcolor=$aBorderColor;
// For backwards compatibility when shadow was just true or false
if ($aShadowColor === true) {
$aShadowColor = 'gray';
}
$this->shadow=$aShadowColor;
$this->icornerradius=$aCornerRadius;
$this->ishadowwidth=$aShadowWidth;
}
public function SetBox2($aFrameColor=array(255,255,255), $aBorderColor=array(0,0,0), $aShadowColor=false, $aCornerRadius=4, $aShadowWidth=3)
{
$this->iBoxType=2;
$this->SetBox($aFrameColor, $aBorderColor, $aShadowColor, $aCornerRadius, $aShadowWidth);
}
// Hide the text
public function Hide($aHide=true)
{
$this->hide=$aHide;
}
// This looks ugly since it's not a very orthogonal design
// but I added this "inverse" of Hide() to harmonize
// with some classes which I designed more recently (especially)
// jpgraph_gantt
public function Show($aShow=true)
{
$this->hide=!$aShow;
}
// Specify font
public function SetFont($aFamily, $aStyle=FS_NORMAL, $aSize=10)
{
$this->font_family=$aFamily;
$this->font_style=$aStyle;
$this->font_size=$aSize;
}
// Center the text between $left and $right coordinates
public function Center($aLeft, $aRight, $aYAbsPos=false)
{
$this->x = $aLeft + ($aRight-$aLeft)/2;
$this->halign = "center";
if (is_numeric($aYAbsPos)) {
$this->y = $aYAbsPos;
}
}
// Set text color
public function SetColor($aColor)
{
$this->color = $aColor;
}
public function SetAngle($aAngle)
{
$this->SetOrientation($aAngle);
}
// Orientation of text. Note only TTF fonts can have an arbitrary angle
public function SetOrientation($aDirection=0)
{
if (is_numeric($aDirection)) {
$this->dir=$aDirection;
} elseif ($aDirection=="h") {
$this->dir = 0;
} elseif ($aDirection=="v") {
$this->dir = 90;
} else {
JpGraphError::RaiseL(25051);
}//(" Invalid direction specified for text.");
}
// Total width of text
public function GetWidth($aImg)
{
$aImg->SetFont($this->font_family, $this->font_style, $this->raw_font_size);
$w = $aImg->GetTextWidth($this->t, $this->dir);
return $w;
}
// Hight of font
public function GetFontHeight($aImg)
{
$aImg->SetFont($this->font_family, $this->font_style, $this->raw_font_size);
$h = $aImg->GetFontHeight();
return $h;
}
public function GetTextHeight($aImg)
{
$aImg->SetFont($this->font_family, $this->font_style, $this->raw_font_size);
$h = $aImg->GetTextHeight($this->t, $this->dir);
return $h;
}
public function GetHeight($aImg)
{
// Synonym for GetTextHeight()
$aImg->SetFont($this->font_family, $this->font_style, $this->raw_font_size);
$h = $aImg->GetTextHeight($this->t, $this->dir);
return $h;
}
// Set the margin which will be interpretated differently depending
// on the context.
public function SetMargin($aMarg)
{
$this->margin = $aMarg;
}
public function StrokeWithScale($aImg, $axscale, $ayscale)
{
if ($this->iScalePosX === null || $this->iScalePosY === null) {
$this->Stroke($aImg);
} else {
$this->Stroke(
$aImg,
round($axscale->Translate($this->iScalePosX)),
round($ayscale->Translate($this->iScalePosY))
);
}
}
public function SetCSIMTarget($aURITarget, $aAlt='', $aWinTarget='')
{
$this->iCSIMtarget = $aURITarget;
$this->iCSIMalt = $aAlt;
$this->iCSIMWinTarget = $aWinTarget;
}
public function GetCSIMareas()
{
if ($this->iCSIMtarget !== '') {
return $this->iCSIMarea;
} else {
return '';
}
}
// Display text in image
public function Stroke($aImg, $x=null, $y=null)
{
if ($x !== null) {
$this->x = round($x);
}
if ($y !== null) {
$this->y = round($y);
}
// Insert newlines
if ($this->iWordwrap > 0) {
$this->t = wordwrap($this->t, $this->iWordwrap, "\n");
}
// If position been given as a fraction of the image size
// calculate the absolute position
if ($this->x < 1 && $this->x > 0) {
$this->x *= $aImg->width;
}
if ($this->y < 1 && $this->y > 0) {
$this->y *= $aImg->height;
}
$aImg->PushColor($this->color);
$aImg->SetFont($this->font_family, $this->font_style, $this->raw_font_size);
$aImg->SetTextAlign($this->halign, $this->valign);
if ($this->boxed) {
if ($this->fcolor=="nofill") {
$this->fcolor=false;
}
$oldweight=$aImg->SetLineWeight(1);
if ($this->iBoxType == 2 && $this->font_family > FF_FONT2+2) {
$bbox = $aImg->StrokeBoxedText2(
$this->x,
$this->y,
$this->t,
$this->dir,
$this->fcolor,
$this->bcolor,
$this->shadow,
$this->paragraph_align,
2,
4,
$this->icornerradius,
$this->ishadowwidth
);
} else {
$bbox = $aImg->StrokeBoxedText(
$this->x,
$this->y,
$this->t,
$this->dir,
$this->fcolor,
$this->bcolor,
$this->shadow,
$this->paragraph_align,
3,
3,
$this->icornerradius,
$this->ishadowwidth
);
}
$aImg->SetLineWeight($oldweight);
} else {
$debug=false;
$bbox = $aImg->StrokeText($this->x, $this->y, $this->t, $this->dir, $this->paragraph_align, $debug);
}
// Create CSIM targets
$coords = $bbox[0].','.$bbox[1].','.$bbox[2].','.$bbox[3].','.$bbox[4].','.$bbox[5].','.$bbox[6].','.$bbox[7];
$this->iCSIMarea = "<area shape=\"poly\" coords=\"$coords\" href=\"".htmlentities($this->iCSIMtarget)."\" ";
if (trim($this->iCSIMalt) != '') {
$this->iCSIMarea .= " alt=\"".$this->iCSIMalt."\" ";
$this->iCSIMarea .= " title=\"".$this->iCSIMalt."\" ";
}
if (trim($this->iCSIMWinTarget) != '') {
$this->iCSIMarea .= " target=\"".$this->iCSIMWinTarget."\" ";
}
$this->iCSIMarea .= " />\n";
$aImg->PopColor($this->color);
}
public function __get($name)
{
if (strpos($name, 'raw_') !== false) {
// if $name == 'raw_left_margin' , return $this->_left_margin;
$variable_name = '_' . str_replace('raw_', '', $name);
return $this->$variable_name;
}
$variable_name = '_' . $name;
if (isset($this->$variable_name)) {
return $this->$variable_name * SUPERSAMPLING_SCALE;
} else {
JpGraphError::RaiseL('25132', $name);
}
}
public function __set($name, $value)
{
$this->{'_'.$name} = $value;
}
} // Class

View file

@ -0,0 +1,139 @@
<?php
//=======================================================================
// File: JPGRAPH_THEME.INC.PHP
// Description: Class to define graph theme
// Created: 2010-09-29
// Ver: $Id: jpgraph_theme.inc.php 83 2010-10-01 11:24:19Z atsushi $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================
// include Theme classes
foreach (glob(dirname(__FILE__) . '/themes/*.php') as $theme_class_script) {
require_once($theme_class_script);
}
//===================================================
// CLASS
// Description:
//===================================================
abstract class Theme
{
protected $color_index;
public function __construct()
{
$this->color_index = 0;
}
/**
*
*/
abstract public function GetColorList();
/**
*
*/
abstract public function ApplyPlot($plot);
/**
*
*/
public function SetupPlot($plot)
{
if (is_array($plot)) {
foreach ($plot as $obj) {
$this->ApplyPlot($obj);
}
} else {
$this->ApplyPlot($plot);
}
}
/**
*
*/
public function ApplyGraph($graph)
{
$this->graph = $graph;
$method_name = '';
if (get_class($graph) == 'Graph') {
$method_name = 'SetupGraph';
} else {
$method_name = 'Setup' . get_class($graph);
}
if (method_exists($this, $method_name)) {
$this->$method_name($graph);
} else {
JpGraphError::RaiseL(30001, $method_name, $method_name); //Theme::%s() is not defined. \nPlease make %s(\$graph) function in your theme classs.
}
}
/**
*
*/
public function PreStrokeApply($graph)
{
}
/**
*
*/
public function GetThemeColors($num = 30)
{
$result_list = array();
$old_index = $this->color_index;
$this->color_index = 0;
$count = 0;
$i = 0;
while (true) {
for ($j = 0; $j < count($this->GetColorList()); $j++) {
if (++$count > $num) {
break 2;
}
$result_list[] = $this->GetNextColor();
}
$i++;
}
$this->color_index = $old_index;
return $result_list;
}
/**
*
*/
public function GetNextColor()
{
$color_list = $this->GetColorList();
$color = null;
if (isset($color_list[$this->color_index])) {
$color = $color_list[$this->color_index];
} else {
$color_count = count($color_list);
if ($color_count <= $this->color_index) {
$color_tmp = $color_list[$this->color_index % $color_count];
$brightness = 1.0 - intval($this->color_index / $color_count) * 0.2;
$rgb = new RGB();
$color = $color_tmp . ':' . $brightness;
$color = $rgb->Color($color);
$alpha = array_pop($color);
$color = $rgb->tryHexConversion($color);
if ($alpha) {
$color .= '@' . $alpha;
}
}
}
$this->color_index++;
return $color;
}
} // Class

View file

@ -3,67 +3,151 @@
// File: jpgraph_ttf.inc.php // File: jpgraph_ttf.inc.php
// Description: Handling of TTF fonts // Description: Handling of TTF fonts
// Created: 2006-11-19 // Created: 2006-11-19
// Ver: $Id: jpgraph_ttf.inc.php 805 2006-11-28 07:45:54Z ljp $ // Ver: $Id: jpgraph_ttf.inc.php 1858 2009-09-28 14:39:51Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
// TTF Font families // TTF Font families
DEFINE("FF_COURIER", 10); define("FF_COURIER", 10);
DEFINE("FF_VERDANA", 11); define("FF_VERDANA", 11);
DEFINE("FF_TIMES", 12); define("FF_TIMES", 12);
DEFINE("FF_COMIC", 14); define("FF_COMIC", 14);
DEFINE("FF_ARIAL", 15); define("FF_ARIAL", 15);
DEFINE("FF_GEORGIA", 16); define("FF_GEORGIA", 16);
DEFINE("FF_TREBUCHE", 17); define("FF_TREBUCHE", 17);
// Gnome Vera font // Gnome Vera font
// Available from http://www.gnome.org/fonts/ // Available from http://www.gnome.org/fonts/
DEFINE("FF_VERA", 18); define("FF_VERA", 18);
DEFINE("FF_VERAMONO", 19); define("FF_VERAMONO", 19);
DEFINE("FF_VERASERIF", 20); define("FF_VERASERIF", 20);
// Chinese font // Chinese font
DEFINE("FF_SIMSUN", 30); define("FF_SIMSUN", 30);
DEFINE("FF_CHINESE", 31); define("FF_CHINESE", 31);
DEFINE("FF_BIG5", 31); define("FF_BIG5", 32);
// Japanese font // Japanese font
DEFINE("FF_MINCHO", 40); define("FF_MINCHO", 40);
DEFINE("FF_PMINCHO", 41); define("FF_PMINCHO", 41);
DEFINE("FF_GOTHIC", 42); define("FF_GOTHIC", 42);
DEFINE("FF_PGOTHIC", 43); define("FF_PGOTHIC", 43);
// Hebrew fonts // Hebrew fonts
DEFINE("FF_DAVID", 44); define("FF_DAVID", 44);
DEFINE("FF_MIRIAM", 45); define("FF_MIRIAM", 45);
DEFINE("FF_AHRON", 46); define("FF_AHRON", 46);
// Dejavu-fonts http://sourceforge.net/projects/dejavu
define("FF_DV_SANSSERIF", 47);
define("FF_DV_SERIF", 48);
define("FF_DV_SANSSERIFMONO", 49);
define("FF_DV_SERIFCOND", 50);
define("FF_DV_SANSSERIFCOND", 51);
// Extra fonts // Extra fonts
// Download fonts from // Download fonts from
// http://www.webfontlist.com // http://www.webfontlist.com
// http://www.webpagepublicity.com/free-fonts.html // http://www.webpagepublicity.com/free-fonts.html
// http://www.fontonic.com/fonts.asp?width=d&offset=120
// http://www.fontspace.com/category/famous
DEFINE("FF_SPEEDO", 50); // This font is also known as Bauer (Used for gauge fascia) // define("FF_SPEEDO",71); // This font is also known as Bauer (Used for development gauge fascia)
DEFINE("FF_DIGITAL", 51); // Digital readout font define("FF_DIGITAL", 72); // Digital readout font
DEFINE("FF_COMPUTER", 52); // The classic computer font define("FF_COMPUTER", 73); // The classic computer font
DEFINE("FF_CALCULATOR", 53); // Triad font define("FF_CALCULATOR", 74); // Triad font
define("FF_USERFONT", 90);
define("FF_USERFONT1", 90);
define("FF_USERFONT2", 91);
define("FF_USERFONT3", 92);
// Limits for fonts // Limits for fonts
DEFINE("_FIRST_FONT", 10); define("_FIRST_FONT", 10);
DEFINE("_LAST_FONT", 53); define("_LAST_FONT", 99);
// TTF Font styles // TTF Font styles
DEFINE("FS_NORMAL", 9001); define("FS_NORMAL", 9001);
DEFINE("FS_BOLD", 9002); define("FS_BOLD", 9002);
DEFINE("FS_ITALIC", 9003); define("FS_ITALIC", 9003);
DEFINE("FS_BOLDIT", 9004); define("FS_BOLDIT", 9004);
DEFINE("FS_BOLDITALIC", 9004); define("FS_BOLDITALIC", 9004);
//Definitions for internal font //Definitions for internal font
DEFINE("FF_FONT0", 1); define("FF_FONT0", 1);
DEFINE("FF_FONT1", 2); define("FF_FONT1", 2);
DEFINE("FF_FONT2", 4); define("FF_FONT2", 4);
//------------------------------------------------------------------------
// Defines for font setup
//------------------------------------------------------------------------
// Actual name of the TTF file used together with FF_CHINESE aka FF_BIG5
// This is the TTF file being used when the font family is specified as
// either FF_CHINESE or FF_BIG5
define('CHINESE_TTF_FONT', 'bkai00mp.ttf');
// Special unicode greek language support
define("LANGUAGE_GREEK", false);
// If you are setting this config to true the conversion of greek characters
// will assume that the input text is windows 1251
define("GREEK_FROM_WINDOWS", false);
// Special unicode cyrillic language support
define("LANGUAGE_CYRILLIC", false);
// If you are setting this config to true the conversion
// will assume that the input text is windows 1251, if
// false it will assume koi8-r
define("CYRILLIC_FROM_WINDOWS", false);
// The following constant is used to auto-detect
// whether cyrillic conversion is really necessary
// if enabled. Just replace 'windows-1251' with a variable
// containing the input character encoding string
// of your application calling jpgraph.
// A typical such string would be 'UTF-8' or 'utf-8'.
// The comparison is case-insensitive.
// If this charset is not a 'koi8-r' or 'windows-1251'
// derivate then no conversion is done.
//
// This constant can be very important in multi-user
// multi-language environments where a cyrillic conversion
// could be needed for some cyrillic people
// and resulting in just erraneous conversions
// for not-cyrillic language based people.
//
// Example: In the free project management
// software dotproject.net $locale_char_set is dynamically
// set by the language environment the user has chosen.
//
// Usage: define('LANGUAGE_CHARSET', $locale_char_set);
//
// where $locale_char_set is a GLOBAL (string) variable
// from the application including JpGraph.
//
define('LANGUAGE_CHARSET', null);
// Japanese TrueType font used with FF_MINCHO, FF_PMINCHO, FF_GOTHIC, FF_PGOTHIC
// Standard fonts from Infomation-technology Promotion Agency (IPA)
// See http://mix-mplus-ipa.sourceforge.jp/
define('MINCHO_TTF_FONT', 'ipam.ttf');
define('PMINCHO_TTF_FONT', 'ipamp.ttf');
define('GOTHIC_TTF_FONT', 'ipag.ttf');
define('PGOTHIC_TTF_FONT', 'ipagp.ttf');
// Assume that Japanese text have been entered in EUC-JP encoding.
// If this define is true then conversion from EUC-JP to UTF8 is done
// automatically in the library using the mbstring module in PHP.
define('ASSUME_EUCJP_ENCODING', false);
// Default font family
define('FF_DEFAULT', FF_DV_SANSSERIF);
//================================================================= //=================================================================
// CLASS LanguageConv // CLASS LanguageConv
@ -103,7 +187,7 @@ class LanguageConv
$this->g2312 = new GB2312toUTF8(); $this->g2312 = new GB2312toUTF8();
} }
return $this->g2312->gb2utf8($aTxt); return $this->g2312->gb2utf8($aTxt);
} elseif ($aFF === FF_CHINESE) { } elseif ($aFF === FF_BIG5) {
if (!function_exists('iconv')) { if (!function_exists('iconv')) {
JpGraphError::RaiseL(25006); JpGraphError::RaiseL(25006);
//('Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).'); //('Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).');
@ -186,13 +270,12 @@ class TTF
private $font_files; private $font_files;
private $style_names; private $style_names;
//--------------- public function __construct()
// CONSTRUCTOR
public function TTF()
{ {
// String names for font styles to be used in error messages // String names for font styles to be used in error messages
$this->style_names=array(FS_NORMAL =>'normal', $this->style_names=array(
FS_NORMAL =>'normal',
FS_BOLD =>'bold', FS_BOLD =>'bold',
FS_ITALIC =>'italic', FS_ITALIC =>'italic',
FS_BOLDITALIC =>'bolditalic'); FS_BOLDITALIC =>'bolditalic');
@ -241,70 +324,144 @@ class TTF
FS_BOLDITALIC =>'' ) , FS_BOLDITALIC =>'' ) ,
/* Chinese fonts */ /* Chinese fonts */
FF_SIMSUN => array(FS_NORMAL =>'simsun.ttc', FF_SIMSUN => array(
FS_NORMAL =>'simsun.ttc',
FS_BOLD =>'simhei.ttf', FS_BOLD =>'simhei.ttf',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_CHINESE => array(FS_NORMAL =>CHINESE_TTF_FONT, FF_CHINESE => array(
FS_NORMAL =>CHINESE_TTF_FONT,
FS_BOLD =>'',
FS_ITALIC =>'',
FS_BOLDITALIC =>'' ),
FF_BIG5 => array(
FS_NORMAL =>CHINESE_TTF_FONT,
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
/* Japanese fonts */ /* Japanese fonts */
FF_MINCHO => array(FS_NORMAL =>MINCHO_TTF_FONT, FF_MINCHO => array(
FS_NORMAL =>MINCHO_TTF_FONT,
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_PMINCHO => array(FS_NORMAL =>PMINCHO_TTF_FONT,
FF_PMINCHO => array(
FS_NORMAL =>PMINCHO_TTF_FONT,
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_GOTHIC => array(FS_NORMAL =>GOTHIC_TTF_FONT,
FF_GOTHIC => array(
FS_NORMAL =>GOTHIC_TTF_FONT,
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_PGOTHIC => array(FS_NORMAL =>PGOTHIC_TTF_FONT,
FS_BOLD =>'', FF_PGOTHIC => array(
FS_ITALIC =>'', FS_NORMAL =>PGOTHIC_TTF_FONT,
FS_BOLDITALIC =>'' ),
FF_MINCHO => array(FS_NORMAL =>PMINCHO_TTF_FONT,
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
/* Hebrew fonts */ /* Hebrew fonts */
FF_DAVID => array(FS_NORMAL =>'DAVIDNEW.TTF', FF_DAVID => array(
FS_NORMAL =>'DAVIDNEW.TTF',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_MIRIAM => array(FS_NORMAL =>'MRIAMY.TTF', FF_MIRIAM => array(
FS_NORMAL =>'MRIAMY.TTF',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_AHRON => array(FS_NORMAL =>'ahronbd.ttf', FF_AHRON => array(
FS_NORMAL =>'ahronbd.ttf',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
/* Misc fonts */ /* Misc fonts */
FF_DIGITAL => array(FS_NORMAL =>'DIGIRU__.TTF', FF_DIGITAL => array(
FS_NORMAL =>'DIGIRU__.TTF',
FS_BOLD =>'Digirtu_.ttf', FS_BOLD =>'Digirtu_.ttf',
FS_ITALIC =>'Digir___.ttf', FS_ITALIC =>'Digir___.ttf',
FS_BOLDITALIC =>'DIGIRT__.TTF' ), FS_BOLDITALIC =>'DIGIRT__.TTF' ),
FF_SPEEDO => array(FS_NORMAL =>'Speedo.ttf',
/* This is an experimental font for the speedometer development
FF_SPEEDO => array(
FS_NORMAL =>'Speedo.ttf',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_COMPUTER => array(FS_NORMAL =>'COMPUTER.TTF', */
FF_COMPUTER => array(
FS_NORMAL =>'COMPUTER.TTF',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
FF_CALCULATOR => array(FS_NORMAL =>'Triad_xs.ttf',
FF_CALCULATOR => array(
FS_NORMAL =>'Triad_xs.ttf',
FS_BOLD =>'', FS_BOLD =>'',
FS_ITALIC =>'', FS_ITALIC =>'',
FS_BOLDITALIC =>'' ), FS_BOLDITALIC =>'' ),
/* Dejavu fonts */
FF_DV_SANSSERIF => array(
FS_NORMAL =>array('DejaVuSans.ttf'),
FS_BOLD =>array('DejaVuSans-Bold.ttf','DejaVuSansBold.ttf'),
FS_ITALIC =>array('DejaVuSans-Oblique.ttf','DejaVuSansOblique.ttf'),
FS_BOLDITALIC =>array('DejaVuSans-BoldOblique.ttf','DejaVuSansBoldOblique.ttf') ),
FF_DV_SANSSERIFMONO => array(
FS_NORMAL =>array('DejaVuSansMono.ttf','DejaVuMonoSans.ttf'),
FS_BOLD =>array('DejaVuSansMono-Bold.ttf','DejaVuMonoSansBold.ttf'),
FS_ITALIC =>array('DejaVuSansMono-Oblique.ttf','DejaVuMonoSansOblique.ttf'),
FS_BOLDITALIC =>array('DejaVuSansMono-BoldOblique.ttf','DejaVuMonoSansBoldOblique.ttf') ),
FF_DV_SANSSERIFCOND => array(
FS_NORMAL =>array('DejaVuSansCondensed.ttf','DejaVuCondensedSans.ttf'),
FS_BOLD =>array('DejaVuSansCondensed-Bold.ttf','DejaVuCondensedSansBold.ttf'),
FS_ITALIC =>array('DejaVuSansCondensed-Oblique.ttf','DejaVuCondensedSansOblique.ttf'),
FS_BOLDITALIC =>array('DejaVuSansCondensed-BoldOblique.ttf','DejaVuCondensedSansBoldOblique.ttf') ),
FF_DV_SERIF => array(
FS_NORMAL =>array('DejaVuSerif.ttf'),
FS_BOLD =>array('DejaVuSerif-Bold.ttf','DejaVuSerifBold.ttf'),
FS_ITALIC =>array('DejaVuSerif-Italic.ttf','DejaVuSerifItalic.ttf'),
FS_BOLDITALIC =>array('DejaVuSerif-BoldItalic.ttf','DejaVuSerifBoldItalic.ttf') ),
FF_DV_SERIFCOND => array(
FS_NORMAL =>array('DejaVuSerifCondensed.ttf','DejaVuCondensedSerif.ttf'),
FS_BOLD =>array('DejaVuSerifCondensed-Bold.ttf','DejaVuCondensedSerifBold.ttf'),
FS_ITALIC =>array('DejaVuSerifCondensed-Italic.ttf','DejaVuCondensedSerifItalic.ttf'),
FS_BOLDITALIC =>array('DejaVuSerifCondensed-BoldItalic.ttf','DejaVuCondensedSerifBoldItalic.ttf') ),
/* Placeholders for defined fonts */
FF_USERFONT1 => array(
FS_NORMAL =>'',
FS_BOLD =>'',
FS_ITALIC =>'',
FS_BOLDITALIC =>'' ),
FF_USERFONT2 => array(
FS_NORMAL =>'',
FS_BOLD =>'',
FS_ITALIC =>'',
FS_BOLDITALIC =>'' ),
FF_USERFONT3 => array(
FS_NORMAL =>'',
FS_BOLD =>'',
FS_ITALIC =>'',
FS_BOLDITALIC =>'' ),
); );
} }
@ -317,24 +474,166 @@ class TTF
if (!$fam) { if (!$fam) {
JpGraphError::RaiseL(25046, $family);//("Specified TTF font family (id=$family) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/"); JpGraphError::RaiseL(25046, $family);//("Specified TTF font family (id=$family) is unknown or does not exist. Please note that TTF fonts are not distributed with JpGraph for copyright reasons. You can find the MS TTF WEB-fonts (arial, courier etc) for download at http://corefonts.sourceforge.net/");
} }
$f = @$fam[$style]; $ff = @$fam[$style];
if ($f==='') { // There are several optional file names. They are tried in order
// and the first one found is used
if (!is_array($ff)) {
$ff = array($ff);
}
$jpgraph_font_dir = dirname(__FILE__).'/fonts/';
foreach ($ff as $font_file) {
// All font families are guaranteed to have the normal style
if ($font_file==='') {
JpGraphError::RaiseL(25047, $this->style_names[$style], $this->font_files[$family][FS_NORMAL]); JpGraphError::RaiseL(25047, $this->style_names[$style], $this->font_files[$family][FS_NORMAL]);
}//('Style "'.$this->style_names[$style].'" is not available for font family '.$this->font_files[$family][FS_NORMAL].'.'); }//('Style "'.$this->style_names[$style].'" is not available for font family '.$this->font_files[$family][FS_NORMAL].'.');
if (!$f) { if (!$font_file) {
JpGraphError::RaiseL(25048, $fam);//("Unknown font style specification [$fam]."); JpGraphError::RaiseL(25048, $fam);//("Unknown font style specification [$fam].");
} }
if ($family >= FF_MINCHO && $family <= FF_PGOTHIC) { // check jpgraph/src/fonts dir
$f = MBTTF_DIR.$f; $jpgraph_font_file = $jpgraph_font_dir . $font_file;
} else { if (file_exists($jpgraph_font_file) === true && is_readable($jpgraph_font_file) === true) {
$f = TTF_DIR.$f; $font_file = $jpgraph_font_file;
break;
} }
if (file_exists($f) === false || is_readable($f) === false) { // check OS font dir
JpGraphError::RaiseL(25049, $f);//("Font file \"$f\" is not readable or does not exist."); if ($family >= FF_MINCHO && $family <= FF_PGOTHIC) {
$font_file = MBTTF_DIR.$font_file;
} else {
$font_file = TTF_DIR.$font_file;
} }
return $f; if (file_exists($font_file) === true && is_readable($font_file) === true) {
break;
}
}
if (!file_exists($font_file)) {
JpGraphError::RaiseL(25049, $font_file);//("Font file \"$font_file\" is not readable or does not exist.");
}
return $font_file;
}
public function SetUserFont($aNormal, $aBold='', $aItalic='', $aBoldIt='')
{
$this->font_files[FF_USERFONT] =
array(FS_NORMAL => $aNormal,
FS_BOLD => $aBold,
FS_ITALIC => $aItalic,
FS_BOLDITALIC => $aBoldIt ) ;
}
public function SetUserFont1($aNormal, $aBold='', $aItalic='', $aBoldIt='')
{
$this->font_files[FF_USERFONT1] =
array(FS_NORMAL => $aNormal,
FS_BOLD => $aBold,
FS_ITALIC => $aItalic,
FS_BOLDITALIC => $aBoldIt ) ;
}
public function SetUserFont2($aNormal, $aBold='', $aItalic='', $aBoldIt='')
{
$this->font_files[FF_USERFONT2] =
array(FS_NORMAL => $aNormal,
FS_BOLD => $aBold,
FS_ITALIC => $aItalic,
FS_BOLDITALIC => $aBoldIt ) ;
}
public function SetUserFont3($aNormal, $aBold='', $aItalic='', $aBoldIt='')
{
$this->font_files[FF_USERFONT3] =
array(FS_NORMAL => $aNormal,
FS_BOLD => $aBold,
FS_ITALIC => $aItalic,
FS_BOLDITALIC => $aBoldIt ) ;
} }
} // Class } // Class
//=============================================================================
// CLASS SymChar
// Description: Code values for some commonly used characters that
// normally isn't available directly on the keyboard, for example
// mathematical and greek symbols.
//=============================================================================
class SymChar
{
public static function Get($aSymb, $aCapital=false)
{
$iSymbols = array(
/* Greek */
array('alpha','03B1','0391'),
array('beta','03B2','0392'),
array('gamma','03B3','0393'),
array('delta','03B4','0394'),
array('epsilon','03B5','0395'),
array('zeta','03B6','0396'),
array('ny','03B7','0397'),
array('eta','03B8','0398'),
array('theta','03B8','0398'),
array('iota','03B9','0399'),
array('kappa','03BA','039A'),
array('lambda','03BB','039B'),
array('mu','03BC','039C'),
array('nu','03BD','039D'),
array('xi','03BE','039E'),
array('omicron','03BF','039F'),
array('pi','03C0','03A0'),
array('rho','03C1','03A1'),
array('sigma','03C3','03A3'),
array('tau','03C4','03A4'),
array('upsilon','03C5','03A5'),
array('phi','03C6','03A6'),
array('chi','03C7','03A7'),
array('psi','03C8','03A8'),
array('omega','03C9','03A9'),
/* Money */
array('euro','20AC'),
array('yen','00A5'),
array('pound','20A4'),
/* Math */
array('approx','2248'),
array('neq','2260'),
array('not','2310'),
array('def','2261'),
array('inf','221E'),
array('sqrt','221A'),
array('int','222B'),
/* Misc */
array('copy','00A9'),
array('para','00A7'),
array('tm','2122'), /* Trademark symbol */
array('rtm','00AE'), /* Registered trademark */
array('degree','00b0'),
array('lte','2264'), /* Less than or equal */
array('gte','2265'), /* Greater than or equal */
);
$n = count($iSymbols);
$i=0;
$found = false;
$aSymb = strtolower($aSymb);
while ($i < $n && !$found) {
$found = $aSymb === $iSymbols[$i++][0];
}
if ($found) {
$ca = $iSymbols[--$i];
if ($aCapital && count($ca)==3) {
$s = $ca[2];
} else {
$s = $ca[1];
}
return sprintf('&#%04d;', hexdec($s));
} else {
return '';
}
}
}

View file

@ -3,9 +3,9 @@
// File: JPGRAPH_UTILS.INC // File: JPGRAPH_UTILS.INC
// Description: Collection of non-essential "nice to have" utilities // Description: Collection of non-essential "nice to have" utilities
// Created: 2005-11-20 // Created: 2005-11-20
// Ver: $Id: jpgraph_utils.inc.php 957 2007-12-01 14:00:29Z ljp $ // Ver: $Id: jpgraph_utils.inc.php 1777 2009-08-23 17:34:36Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -22,7 +22,7 @@ class FuncGenerator
private $iMax; private $iMax;
private $iStepSize; private $iStepSize;
public function FuncGenerator($aFunc, $aXFunc='') public function __construct($aFunc, $aXFunc='')
{ {
$this->iFunc = $aFunc; $this->iFunc = $aFunc;
$this->iXFunc = $aXFunc; $this->iXFunc = $aXFunc;
@ -54,175 +54,97 @@ class FuncGenerator
} }
} }
//=============================================================================
// CLASS SymChar
// Description: Code values for some commonly used characters that
// normally isn't available directly on the keyboard, for example
// mathematical and greek symbols.
//=============================================================================
class SymChar
{
public static function Get($aSymb, $aCapital=false)
{
$iSymbols = array(
/* Greek */
array('alpha','03B1','0391'),
array('beta','03B2','0392'),
array('gamma','03B3','0393'),
array('delta','03B4','0394'),
array('epsilon','03B5','0395'),
array('zeta','03B6','0396'),
array('ny','03B7','0397'),
array('eta','03B8','0398'),
array('theta','03B8','0398'),
array('iota','03B9','0399'),
array('kappa','03BA','039A'),
array('lambda','03BB','039B'),
array('mu','03BC','039C'),
array('nu','03BD','039D'),
array('xi','03BE','039E'),
array('omicron','03BF','039F'),
array('pi','03C0','03A0'),
array('rho','03C1','03A1'),
array('sigma','03C3','03A3'),
array('tau','03C4','03A4'),
array('upsilon','03C5','03A5'),
array('phi','03C6','03A6'),
array('chi','03C7','03A7'),
array('psi','03C8','03A8'),
array('omega','03C9','03A9'),
/* Money */
array('euro','20AC'),
array('yen','00A5'),
array('pound','20A4'),
/* Math */
array('approx','2248'),
array('neq','2260'),
array('not','2310'),
array('def','2261'),
array('inf','221E'),
array('sqrt','221A'),
array('int','222B'),
/* Misc */
array('copy','00A9'),
array('para','00A7'),
array('tm','2122'), /* Trademark symbol */
array('rtm','00AE') /* Registered trademark */
);
$n = count($iSymbols);
$i=0;
$found = false;
$aSymb = strtolower($aSymb);
while ($i < $n && !$found) {
$found = $aSymb === $iSymbols[$i++][0];
}
if ($found) {
$ca = $iSymbols[--$i];
if ($aCapital && count($ca)==3) {
$s = $ca[2];
} else {
$s = $ca[1];
}
return sprintf('&#%04d;', hexdec($s));
} else {
return '';
}
}
}
//============================================================================= //=============================================================================
// CLASS DateScaleUtils // CLASS DateScaleUtils
// Description: Help to create a manual date scale // Description: Help to create a manual date scale
//============================================================================= //=============================================================================
DEFINE('DSUTILS_MONTH', 1); // Major and minor ticks on a monthly basis define('DSUTILS_MONTH', 1); // Major and minor ticks on a monthly basis
DEFINE('DSUTILS_MONTH1', 1); // Major and minor ticks on a monthly basis define('DSUTILS_MONTH1', 1); // Major and minor ticks on a monthly basis
DEFINE('DSUTILS_MONTH2', 2); // Major ticks on a bi-monthly basis define('DSUTILS_MONTH2', 2); // Major ticks on a bi-monthly basis
DEFINE('DSUTILS_MONTH3', 3); // Major icks on a tri-monthly basis define('DSUTILS_MONTH3', 3); // Major icks on a tri-monthly basis
DEFINE('DSUTILS_MONTH6', 4); // Major on a six-monthly basis define('DSUTILS_MONTH6', 4); // Major on a six-monthly basis
DEFINE('DSUTILS_WEEK1', 5); // Major ticks on a weekly basis define('DSUTILS_WEEK1', 5); // Major ticks on a weekly basis
DEFINE('DSUTILS_WEEK2', 6); // Major ticks on a bi-weekly basis define('DSUTILS_WEEK2', 6); // Major ticks on a bi-weekly basis
DEFINE('DSUTILS_WEEK4', 7); // Major ticks on a quod-weekly basis define('DSUTILS_WEEK4', 7); // Major ticks on a quod-weekly basis
DEFINE('DSUTILS_DAY1', 8); // Major ticks on a daily basis define('DSUTILS_DAY1', 8); // Major ticks on a daily basis
DEFINE('DSUTILS_DAY2', 9); // Major ticks on a bi-daily basis define('DSUTILS_DAY2', 9); // Major ticks on a bi-daily basis
DEFINE('DSUTILS_DAY4', 10); // Major ticks on a qoud-daily basis define('DSUTILS_DAY4', 10); // Major ticks on a qoud-daily basis
DEFINE('DSUTILS_YEAR1', 11); // Major ticks on a yearly basis define('DSUTILS_YEAR1', 11); // Major ticks on a yearly basis
DEFINE('DSUTILS_YEAR2', 12); // Major ticks on a bi-yearly basis define('DSUTILS_YEAR2', 12); // Major ticks on a bi-yearly basis
DEFINE('DSUTILS_YEAR5', 13); // Major ticks on a five-yearly basis define('DSUTILS_YEAR5', 13); // Major ticks on a five-yearly basis
class DateScaleUtils class DateScaleUtils
{ {
public $iMin=0; public static $iMin=0;
public $iMax=0; public static $iMax=0;
private $starthour; private static $starthour;
private $startmonth; private static $startmonth;
private $startday; private static $startday;
private $startyear; private static $startyear;
private $endmonth; private static $endmonth;
private $endyear; private static $endyear;
private $endday; private static $endday;
private $tickPositions=array(); private static $tickPositions=array();
private $minTickPositions=array(); private static $minTickPositions=array();
private $iUseWeeks = true; private static $iUseWeeks = true;
public function UseWeekFormat($aFlg) public static function UseWeekFormat($aFlg)
{ {
$this->iUseWeeks = $aFlg; self::$iUseWeeks = $aFlg;
} }
public function doYearly($aType, $aMinor=false) public static function doYearly($aType, $aMinor=false)
{ {
$i=0; $i=0;
$j=0; $j=0;
$m = $this->startmonth; $m = self::$startmonth;
$y = $this->startyear; $y = self::$startyear;
if ($this->startday == 1) { if (self::$startday == 1) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
} }
++$m; ++$m;
switch ($aType) { switch ($aType) {
case DSUTILS_YEAR1: case DSUTILS_YEAR1:
for ($y=$this->startyear; $y <= $this->endyear; ++$y) { for ($y=self::$startyear; $y <= self::$endyear; ++$y) {
if ($aMinor) { if ($aMinor) {
while ($m <= 12) { while ($m <= 12) {
if (!($y == $this->endyear && $m > $this->endmonth)) { if (!($y == self::$endyear && $m > self::$endmonth)) {
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y);
} }
++$m; ++$m;
} }
$m=1; $m=1;
} }
$this->tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y);
} }
break; break;
case DSUTILS_YEAR2: case DSUTILS_YEAR2:
$y=$this->startyear; $y=self::$startyear;
while ($y <= $this->endyear) { while ($y <= self::$endyear) {
$this->tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y);
for ($k=0; $k < 1; ++$k) { for ($k=0; $k < 1; ++$k) {
++$y; ++$y;
if ($aMinor) { if ($aMinor) {
$this->minTickPositions[$j++] = mktime(0, 0, 0, 1, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, 1, 1, $y);
} }
} }
++$y; ++$y;
} }
break; break;
case DSUTILS_YEAR5: case DSUTILS_YEAR5:
$y=$this->startyear; $y=self::$startyear;
while ($y <= $this->endyear) { while ($y <= self::$endyear) {
$this->tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, 1, 1, $y);
for ($k=0; $k < 4; ++$k) { for ($k=0; $k < 4; ++$k) {
++$y; ++$y;
if ($aMinor) { if ($aMinor) {
$this->minTickPositions[$j++] = mktime(0, 0, 0, 1, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, 1, 1, $y);
} }
} }
++$y; ++$y;
@ -231,74 +153,76 @@ class DateScaleUtils
} }
} }
public function doDaily($aType, $aMinor=false) public static function doDaily($aType, $aMinor=false)
{ {
$m = $this->startmonth; $m = self::$startmonth;
$y = $this->startyear; $y = self::$startyear;
$d = $this->startday; $d = self::$startday;
$h = $this->starthour; $h = self::$starthour;
$i=0; $i=0;
$j=0; $j=0;
if ($h == 0) { if ($h == 0) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, $d, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, $d, $y);
$t = mktime(0, 0, 0, $m, $d, $y);
} else {
$t = mktime(0, 0, 0, $m, $d, $y);
} }
$t = mktime(0, 0, 0, $m, $d, $y);
switch ($aType) { switch ($aType) {
case DSUTILS_DAY1: case DSUTILS_DAY1:
while ($t <= $this->iMax) { while ($t <= self::$iMax) {
$t += 3600*24; $t = strtotime('+1 day', $t);
$this->tickPositions[$i++] = $t; self::$tickPositions[$i++] = $t;
if ($aMinor) {
self::$minTickPositions[$j++] = strtotime('+12 hours', $t);
}
} }
break; break;
case DSUTILS_DAY2: case DSUTILS_DAY2:
while ($t <= $this->iMax) { while ($t <= self::$iMax) {
$t += 3600*24; $t = strtotime('+1 day', $t);
if ($aMinor) { if ($aMinor) {
$this->minTickPositions[$j++] = $t; self::$minTickPositions[$j++] = $t;
} }
$t += 3600*24; $t = strtotime('+1 day', $t);
$this->tickPositions[$i++] = $t; self::$tickPositions[$i++] = $t;
} }
break; break;
case DSUTILS_DAY4: case DSUTILS_DAY4:
while ($t <= $this->iMax) { while ($t <= self::$iMax) {
for ($k=0; $k < 3; ++$k) { for ($k=0; $k < 3; ++$k) {
$t += 3600*24; $t = strtotime('+1 day', $t);
if ($aMinor) { if ($aMinor) {
$this->minTickPositions[$j++] = $t; self::$minTickPositions[$j++] = $t;
} }
} }
$t += 3600*24; $t = strtotime('+1 day', $t);
$this->tickPositions[$i++] = $t; self::$tickPositions[$i++] = $t;
} }
break; break;
} }
} }
public function doWeekly($aType, $aMinor=false) public static function doWeekly($aType, $aMinor=false)
{ {
$hpd = 3600*24; $hpd = 3600*24;
$hpw = 3600*24*7; $hpw = 3600*24*7;
// Find out week number of min date // Find out week number of min date
$thursday = $this->iMin + $hpd * (3 - (date('w', $this->iMin) + 6) % 7); $thursday = self::$iMin + $hpd * (3 - (date('w', self::$iMin) + 6) % 7);
$week = 1 + (date('z', $thursday) - (11 - date('w', mktime(0, 0, 0, 1, 1, date('Y', $thursday)))) % 7) / 7; $week = 1 + (date('z', $thursday) - (11 - date('w', mktime(0, 0, 0, 1, 1, date('Y', $thursday)))) % 7) / 7;
$daynumber = date('w', $this->iMin); $daynumber = date('w', self::$iMin);
if ($daynumber == 0) { if ($daynumber == 0) {
$daynumber = 7; $daynumber = 7;
} }
$m = $this->startmonth; $m = self::$startmonth;
$y = $this->startyear; $y = self::$startyear;
$d = $this->startday; $d = self::$startday;
$i=0; $i=0;
$j=0; $j=0;
// The assumption is that the weeks start on Monday. If the first day // The assumption is that the weeks start on Monday. If the first day
// is later in the week then the first week tick has to be on the following // is later in the week then the first week tick has to be on the following
// week. // week.
if ($daynumber == 1) { if ($daynumber == 1) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, $d, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, $d, $y);
$t = mktime(0, 0, 0, $m, $d, $y) + $hpw; $t = mktime(0, 0, 0, $m, $d, $y) + $hpw;
} else { } else {
$t = mktime(0, 0, 0, $m, $d, $y) + $hpd*(8-$daynumber); $t = mktime(0, 0, 0, $m, $d, $y) + $hpd*(8-$daynumber);
@ -315,93 +239,93 @@ class DateScaleUtils
$cnt=3; $cnt=3;
break; break;
} }
while ($t <= $this->iMax) { while ($t <= self::$iMax) {
$this->tickPositions[$i++] = $t; self::$tickPositions[$i++] = $t;
for ($k=0; $k < $cnt; ++$k) { for ($k=0; $k < $cnt; ++$k) {
$t += $hpw; $t += $hpw;
if ($aMinor) { if ($aMinor) {
$this->minTickPositions[$j++] = $t; self::$minTickPositions[$j++] = $t;
} }
} }
$t += $hpw; $t += $hpw;
} }
} }
public function doMonthly($aType, $aMinor=false) public static function doMonthly($aType, $aMinor=false)
{ {
$monthcount=0; $monthcount=0;
$m = $this->startmonth; $m = self::$startmonth;
$y = $this->startyear; $y = self::$startyear;
$i=0; $i=0;
$j=0; $j=0;
// Skip the first month label if it is before the startdate // Skip the first month label if it is before the startdate
if ($this->startday == 1) { if (self::$startday == 1) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
$monthcount=1; $monthcount=1;
} }
if ($aType == 1) { if ($aType == 1) {
if ($this->startday < 15) { if (self::$startday < 15) {
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 15, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 15, $y);
} }
} }
++$m; ++$m;
// Loop through all the years included in the scale // Loop through all the years included in the scale
for ($y=$this->startyear; $y <= $this->endyear; ++$y) { for ($y=self::$startyear; $y <= self::$endyear; ++$y) {
// Loop through all the months. There are three cases to consider: // Loop through all the months. There are three cases to consider:
// 1. We are in the first year and must start with the startmonth // 1. We are in the first year and must start with the startmonth
// 2. We are in the end year and we must stop at last month of the scale // 2. We are in the end year and we must stop at last month of the scale
// 3. A year in between where we run through all the 12 months // 3. A year in between where we run through all the 12 months
$stopmonth = $y == $this->endyear ? $this->endmonth : 12; $stopmonth = $y == self::$endyear ? self::$endmonth : 12;
while ($m <= $stopmonth) { while ($m <= $stopmonth) {
switch ($aType) { switch ($aType) {
case DSUTILS_MONTH1: case DSUTILS_MONTH1:
// Set minor tick at the middle of the month // Set minor tick at the middle of the month
if ($aMinor) { if ($aMinor) {
if ($m <= $stopmonth) { if ($m <= $stopmonth) {
if (!($y==$this->endyear && $m==$stopmonth && $this->endday < 15)) { if (!($y==self::$endyear && $m==$stopmonth && self::$endday < 15)) {
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 15, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 15, $y);
} }
} }
} }
// Major at month // Major at month
// Get timestamp of first hour of first day in each month // Get timestamp of first hour of first day in each month
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
break; break;
case DSUTILS_MONTH2: case DSUTILS_MONTH2:
if ($aMinor) { if ($aMinor) {
// Set minor tick at start of each month // Set minor tick at start of each month
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y);
} }
// Major at every second month // Major at every second month
// Get timestamp of first hour of first day in each month // Get timestamp of first hour of first day in each month
if ($monthcount % 2 == 0) { if ($monthcount % 2 == 0) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
} }
break; break;
case DSUTILS_MONTH3: case DSUTILS_MONTH3:
if ($aMinor) { if ($aMinor) {
// Set minor tick at start of each month // Set minor tick at start of each month
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y);
} }
// Major at every third month // Major at every third month
// Get timestamp of first hour of first day in each month // Get timestamp of first hour of first day in each month
if ($monthcount % 3 == 0) { if ($monthcount % 3 == 0) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
} }
break; break;
case DSUTILS_MONTH6: case DSUTILS_MONTH6:
if ($aMinor) { if ($aMinor) {
// Set minor tick at start of each month // Set minor tick at start of each month
$this->minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y); self::$minTickPositions[$j++] = mktime(0, 0, 0, $m, 1, $y);
} }
// Major at every third month // Major at every third month
// Get timestamp of first hour of first day in each month // Get timestamp of first hour of first day in each month
if ($monthcount % 6 == 0) { if ($monthcount % 6 == 0) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y); self::$tickPositions[$i++] = mktime(0, 0, 0, $m, 1, $y);
} }
break; break;
} }
@ -414,20 +338,20 @@ class DateScaleUtils
// For the case where all dates are within the same month // For the case where all dates are within the same month
// we want to make sure we have at least two ticks on the scale // we want to make sure we have at least two ticks on the scale
// since the scale want work properly otherwise // since the scale want work properly otherwise
if ($this->startmonth == $this->endmonth && $this->startyear == $this->endyear && $aType==1) { if (self::$startmonth == self::$endmonth && self::$startyear == self::$endyear && $aType==1) {
$this->tickPositions[$i++] = mktime(0, 0, 0, $this->startmonth + 1, 1, $this->startyear); self::$tickPositions[$i++] = mktime(0, 0, 0, self::$startmonth + 1, 1, self::$startyear);
} }
return array($this->tickPositions,$this->minTickPositions); return array(self::$tickPositions,self::$minTickPositions);
} }
public function GetTicks($aData, $aType=1, $aMinor=false, $aEndPoints=false) public static function GetTicks($aData, $aType=1, $aMinor=false, $aEndPoints=false)
{ {
$n = count($aData); $n = count($aData);
return $this->GetTicksFromMinMax($aData[0], $aData[$n-1], $aType, $aMinor, $aEndPoints); return self::GetTicksFromMinMax($aData[0], $aData[$n-1], $aType, $aMinor, $aEndPoints);
} }
public function GetAutoTicks($aMin, $aMax, $aMaxTicks=10, $aMinor=false) public static function GetAutoTicks($aMin, $aMax, $aMaxTicks=10, $aMinor=false)
{ {
$diff = $aMax - $aMin; $diff = $aMax - $aMin;
$spd = 3600*24; $spd = 3600*24;
@ -435,7 +359,7 @@ class DateScaleUtils
$spm = $spd*30; $spm = $spd*30;
$spy = $spd*352; $spy = $spd*352;
if ($this->iUseWeeks) { if (self::$iUseWeeks) {
$w = 'W'; $w = 'W';
} else { } else {
$w = 'd M'; $w = 'd M';
@ -446,13 +370,9 @@ class DateScaleUtils
// Second value: Array of formatting depending on divisor for wanted max number of ticks. <divisor><formatting><format-string>,.. // Second value: Array of formatting depending on divisor for wanted max number of ticks. <divisor><formatting><format-string>,..
$tt = array( $tt = array(
array($spw, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',-1,DSUTILS_DAY4,'d M')), array($spw, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',-1,DSUTILS_DAY4,'d M')),
array($spm, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',4,DSUTILS_DAY4,'d M', array($spm, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',4,DSUTILS_DAY4,'d M',7,DSUTILS_WEEK1,$w,-1,DSUTILS_WEEK2,$w)),
7,DSUTILS_WEEK1,$w,-1,DSUTILS_WEEK2,$w)), array($spy, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',4,DSUTILS_DAY4,'d M',7,DSUTILS_WEEK1,$w,14,DSUTILS_WEEK2,$w,30,DSUTILS_MONTH1,'M',60,DSUTILS_MONTH2,'M',-1,DSUTILS_MONTH3,'M')),
array($spy, array(1,DSUTILS_DAY1,'d M',2,DSUTILS_DAY2,'d M',4,DSUTILS_DAY4,'d M', array(-1, array(30,DSUTILS_MONTH1,'M-Y',60,DSUTILS_MONTH2,'M-Y',90,DSUTILS_MONTH3,'M-Y',180,DSUTILS_MONTH6,'M-Y',352,DSUTILS_YEAR1,'Y',704,DSUTILS_YEAR2,'Y',-1,DSUTILS_YEAR5,'Y')));
7,DSUTILS_WEEK1,$w,14,DSUTILS_WEEK2,$w,
30,DSUTILS_MONTH1,'M',60,DSUTILS_MONTH2,'M',-1,DSUTILS_MONTH3,'M')),
array(-1, array(30,DSUTILS_MONTH1,'M-Y',60,DSUTILS_MONTH2,'M-Y',90,DSUTILS_MONTH3,'M-Y',
180,DSUTILS_MONTH6,'M-Y',352,DSUTILS_YEAR1,'Y',704,DSUTILS_YEAR2,'Y',-1,DSUTILS_YEAR5,'Y')));
$ntt = count($tt); $ntt = count($tt);
$nd = floor($diff/$spd); $nd = floor($diff/$spd);
@ -464,7 +384,7 @@ class DateScaleUtils
if ($nd/$t[3*$j] <= $aMaxTicks || $j==$n-1) { if ($nd/$t[3*$j] <= $aMaxTicks || $j==$n-1) {
$type = $t[3*$j+1]; $type = $t[3*$j+1];
$fs = $t[3*$j+2]; $fs = $t[3*$j+2];
list($tickPositions, $minTickPositions) = $this->GetTicksFromMinMax($aMin, $aMax, $type, $aMinor); list($tickPositions, $minTickPositions) = self::GetTicksFromMinMax($aMin, $aMax, $type, $aMinor);
return array($fs,$tickPositions,$minTickPositions,$type); return array($fs,$tickPositions,$minTickPositions,$type);
} }
} }
@ -472,26 +392,26 @@ class DateScaleUtils
} }
} }
public function GetTicksFromMinMax($aMin, $aMax, $aType, $aMinor=false, $aEndPoints=false) public static function GetTicksFromMinMax($aMin, $aMax, $aType, $aMinor=false, $aEndPoints=false)
{ {
$this->starthour = date('G', $aMin); self::$starthour = date('G', $aMin);
$this->startmonth = date('n', $aMin); self::$startmonth = date('n', $aMin);
$this->startday = date('j', $aMin); self::$startday = date('j', $aMin);
$this->startyear = date('Y', $aMin); self::$startyear = date('Y', $aMin);
$this->endmonth = date('n', $aMax); self::$endmonth = date('n', $aMax);
$this->endyear = date('Y', $aMax); self::$endyear = date('Y', $aMax);
$this->endday = date('j', $aMax); self::$endday = date('j', $aMax);
$this->iMin = $aMin; self::$iMin = $aMin;
$this->iMax = $aMax; self::$iMax = $aMax;
if ($aType <= DSUTILS_MONTH6) { if ($aType <= DSUTILS_MONTH6) {
$this->doMonthly($aType, $aMinor); self::doMonthly($aType, $aMinor);
} elseif ($aType <= DSUTILS_WEEK4) { } elseif ($aType <= DSUTILS_WEEK4) {
$this->doWeekly($aType, $aMinor); self::doWeekly($aType, $aMinor);
} elseif ($aType <= DSUTILS_DAY4) { } elseif ($aType <= DSUTILS_DAY4) {
$this->doDaily($aType, $aMinor); self::doDaily($aType, $aMinor);
} elseif ($aType <= DSUTILS_YEAR5) { } elseif ($aType <= DSUTILS_YEAR5) {
$this->doYearly($aType, $aMinor); self::doYearly($aType, $aMinor);
} else { } else {
JpGraphError::RaiseL(24003); JpGraphError::RaiseL(24003);
} }
@ -505,7 +425,7 @@ class DateScaleUtils
$tickPositions[$i] = $aData[$n-1]; $tickPositions[$i] = $aData[$n-1];
} }
return array($this->tickPositions,$this->minTickPositions); return array(self::$tickPositions,self::$minTickPositions);
} }
} }
@ -514,7 +434,6 @@ class DateScaleUtils
//============================================================================= //=============================================================================
class ReadFileData class ReadFileData
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Desciption: // Desciption:
// Read numeric data from a file. // Read numeric data from a file.
@ -529,7 +448,7 @@ class ReadFileData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
public static function FromCSV($aFile, &$aData, $aSepChar=',', $aMaxLineLength=1024) public static function FromCSV($aFile, &$aData, $aSepChar=',', $aMaxLineLength=1024)
{ {
$rh = fopen($aFile, 'r'); $rh = @fopen($aFile, 'r');
if ($rh === false) { if ($rh === false) {
return false; return false;
} }
@ -553,4 +472,255 @@ class ReadFileData
} }
return $cnt; return $cnt;
} }
//----------------------------------------------------------------------------
// Desciption:
// Read numeric data from a file.
// Each value should be separated by either a new line or by a specified
// separator character (default is ',').
// Before returning the data each value is converted to a proper float
// value. The routine is robust in the sense that non numeric data in the
// file will be discarded.
//
// Options:
// 'separator' => ',',
// 'enclosure' => '"',
// 'readlength' => 1024,
// 'ignore_first' => false,
// 'first_as_key' => false
// 'escape' => '\', # PHP >= 5.3 only
//
// Returns:
// The number of lines read on success, FALSE on failure
//----------------------------------------------------------------------------
public static function FromCSV2($aFile, &$aData, $aOptions = array())
{
$aDefaults = array(
'separator' => ',',
'enclosure' => chr(34),
'escape' => chr(92),
'readlength' => 1024,
'ignore_first' => false,
'first_as_key' => false
);
$aOptions = array_merge(
$aDefaults,
is_array($aOptions) ? $aOptions : array()
);
if ($aOptions['first_as_key']) {
$aOptions['ignore_first'] = true;
}
$rh = @fopen($aFile, 'r');
if ($rh === false) {
return false;
}
$aData = array();
$aLine = fgetcsv(
$rh,
$aOptions['readlength'],
$aOptions['separator'],
$aOptions['enclosure']
/*, $aOptions['escape'] # PHP >= 5.3 only */
);
// Use numeric array keys for the columns by default
// If specified use first lines values as assoc keys instead
$keys = array_keys($aLine);
if ($aOptions['first_as_key']) {
$keys = array_values($aLine);
}
$num_lines = 0;
$num_cols = count($aLine);
while ($aLine !== false) {
if (is_array($aLine) && count($aLine) != $num_cols) {
JpGraphError::RaiseL(24004);
// 'ReadCSV2: Column count mismatch in %s line %d'
}
// fgetcsv returns NULL for empty lines
if (!is_null($aLine)) {
$num_lines++;
if (!($aOptions['ignore_first'] && $num_lines == 1) && is_numeric($aLine[0])) {
for ($i = 0; $i < $num_cols; $i++) {
$aData[ $keys[$i] ][] = floatval($aLine[$i]);
}
}
}
$aLine = fgetcsv(
$rh,
$aOptions['readlength'],
$aOptions['separator'],
$aOptions['enclosure']
/*, $aOptions['escape'] # PHP >= 5.3 only*/
);
}
fclose($rh);
if ($aOptions['ignore_first']) {
$num_lines--;
}
return $num_lines;
}
// Read data from two columns in a plain text file
public static function From2Col($aFile, $aCol1, $aCol2, $aSepChar=' ')
{
$lines = @file($aFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if ($lines === false) {
return false;
}
$s = '/[\s]+/';
if ($aSepChar == ',') {
$s = '/[\s]*,[\s]*/';
} elseif ($aSepChar == ';') {
$s = '/[\s]*;[\s]*/';
}
foreach ($lines as $line => $datarow) {
$split = preg_split($s, $datarow);
$aCol1[] = floatval(trim($split[0]));
$aCol2[] = floatval(trim($split[1]));
}
return count($lines);
}
// Read data from one columns in a plain text file
public static function From1Col($aFile, $aCol1)
{
$lines = @file($aFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if ($lines === false) {
return false;
}
foreach ($lines as $line => $datarow) {
$aCol1[] = floatval(trim($datarow));
}
return count($lines);
}
public static function FromMatrix($aFile, $aSepChar=' ')
{
$lines = @file($aFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if ($lines === false) {
return false;
}
$mat = array();
$reg = '/'.$aSepChar.'/';
foreach ($lines as $line => $datarow) {
$row = preg_split($reg, trim($datarow));
foreach ($row as $key => $cell) {
$row[$key] = floatval(trim($cell));
}
$mat[] = $row;
}
return $mat;
}
}
define('__LR_EPSILON', 1.0e-8);
//=============================================================================
// Class LinearRegression
//=============================================================================
class LinearRegression
{
private $ix=array();
private $iy=array();
private $ib=0;
private $ia=0;
private $icalculated=false;
public $iDet=0;
public $iCorr=0;
public $iStdErr=0;
public function __construct($aDataX, $aDataY)
{
if (count($aDataX) !== count($aDataY)) {
JpGraph::Raise('LinearRegression: X and Y data array must be of equal length.');
}
$this->ix = $aDataX;
$this->iy = $aDataY;
}
public function Calc()
{
$this->icalculated = true;
$n = count($this->ix);
$sx2 = 0 ;
$sy2 = 0 ;
$sxy = 0 ;
$sx = 0 ;
$sy = 0 ;
for ($i=0; $i < $n; ++$i) {
$sx2 += $this->ix[$i] * $this->ix[$i];
$sy2 += $this->iy[$i] * $this->iy[$i];
$sxy += $this->ix[$i] * $this->iy[$i];
$sx += $this->ix[$i];
$sy += $this->iy[$i];
}
if ($n*$sx2 - $sx*$sx > __LR_EPSILON) {
$this->ib = ($n*$sxy - $sx*$sy) / ($n*$sx2 - $sx*$sx);
$this->ia = ($sy - $this->ib*$sx) / $n;
$sx = $this->ib * ($sxy - $sx*$sy/$n);
$sy2 = $sy2 - $sy*$sy/$n;
$sy = $sy2 - $sx;
$this->iDet = $sx / $sy2;
$this->iCorr = sqrt($this->iDet);
if ($n > 2) {
$this->iStdErr = sqrt($sy / ($n-2));
} else {
$this->iStdErr = NAN ;
}
} else {
$this->ib = 0;
$this->ia = 0;
}
}
public function GetAB()
{
if ($this->icalculated == false) {
$this->Calc();
}
return array($this->ia, $this->ib);
}
public function GetStat()
{
if ($this->icalculated == false) {
$this->Calc();
}
return array($this->iStdErr, $this->iCorr, $this->iDet);
}
public function GetY($aMinX, $aMaxX, $aStep=1)
{
if ($this->icalculated == false) {
$this->Calc();
}
$yy = array();
$i = 0;
for ($x=$aMinX; $x <= $aMaxX; $x += $aStep) {
$xx[$i ] = $x;
$yy[$i++] = $this->ia + $this->ib * $x;
}
return array($xx,$yy);
}
} }

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,8 @@
// Description: German language file for error messages // Description: German language file for error messages
// Created: 2006-03-06 // Created: 2006-03-06
// Author: Timo Leopold (timo@leopold-hh.de) // Author: Timo Leopold (timo@leopold-hh.de)
// Ver: $Id: de.inc.php 993 2008-03-30 21:17:41Z ljp $ // Johan Persson (ljp@localhost.nil)
// Ver: $Id: de.inc.php 1886 2009-10-01 23:30:16Z ljp $
// //
// Copyright (c) // Copyright (c)
//======================================================================== //========================================================================
@ -17,13 +18,13 @@ $_jpg_messages = array(
** Headers wurden bereits gesendet - Fehler. Dies wird als HTML formatiert, weil es direkt als text zurueckgesendet wird ** Headers wurden bereits gesendet - Fehler. Dies wird als HTML formatiert, weil es direkt als text zurueckgesendet wird
*/ */
10 => array('<table border="1"><tr><td style="color:darkred;font-size:1.2em;"><b>JpGraph Fehler:</b> 10 => array('<table border="1"><tr><td style="color:darkred;font-size:1.2em;"><b>JpGraph Fehler:</b>
HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zeile <b>%d</b>.</td></tr><tr><td><b>Erklärung:</b><br>HTTP header wurden bereits zum Browser gesendet, wobei die Daten als Text gekennzeichnet wurden, bevor die Bibliothek die Chance hatte, seinen Bild-HTTP-Header zum Browser zu schicken. Dies verhindert, dass die Bibliothek Bilddaten zum Browser schicken kann (weil sie vom Browser als Text interpretiert würden und daher nur Mist dargestellt würde).<p>Wahrscheinlich steht Text im Skript bevor <i>Graph::Stroke()</i> aufgerufen wird. Wenn dieser Text zum Browser gesendet wird, nimmt dieser an, dass die gesamten Daten aus Text bestehen. Such nach irgendwelchem Text, auch nach Leerzeichen und Zeilenumbrüchen, die eventuell bereits zum Browser gesendet wurden. <p>Zum Beispiel ist ein oft auftretender Fehler, eine Leerzeile am Anfang der Datei oder vor <i>Graph::Stroke()</i> zu lassen."<b>&lt;?php</b>".</td></tr></table>',2), HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zeile <b>%d</b>.</td></tr><tr><td><b>Erklärung:</b><br>HTTP header wurden bereits zum Browser gesendet, wobei die Daten als Text gekennzeichnet wurden, bevor die Bibliothek die Chance hatte, seinen Bild-HTTP-Header zum Browser zu schicken. Dies verhindert, dass die Bibliothek Bilddaten zum Browser schicken kann (weil sie vom Browser als Text interpretiert würden und daher nur Mist dargestellt würde).<p>Wahrscheinlich steht Text im Skript bevor <i>Graph::Stroke()</i> aufgerufen wird. Wenn dieser Text zum Browser gesendet wird, nimmt dieser an, dass die gesamten Daten aus Text bestehen. Such nach irgendwelchem Text, auch nach Leerzeichen und Zeilenumbrüchen, die eventuell bereits zum Browser gesendet wurden. <p>Zum Beispiel ist ein oft auftretender Fehler, eine Leerzeile am Anfang der Datei oder vor <i>Graph::Stroke()</i> zu lassen."<b>&lt;?php</b>".</td></tr></table>',2),
/* /*
** Setup Fehler ** Setup Fehler
*/ */
11 => array('Es wurde kein Pfad für CACHE_DIR angegeben. Bitte gib einen Pfad CACHE_DIR in der Datei jpg-config.inc an.',0), 11 => array('Es wurde kein Pfad für CACHE_DIR angegeben. Bitte gib einen Pfad CACHE_DIR in der Datei jpg-config.inc an.',0),
12 => array('Es wurde kein Pfad für TTF_DIR angegeben und der Pfad kann nicht automatisch ermittelt werden. Bitte gib den Pfad in der Datei jpg-config.inc an.',0), 12 => array('Es wurde kein Pfad für TTF_DIR angegeben und der Pfad kann nicht automatisch ermittelt werden. Bitte gib den Pfad in der Datei jpg-config.inc an.',0),
13 => array('The installed PHP version (%s) is not compatible with this release of the library. The library requires at least PHP version %s',2), 13 => array('The installed PHP version (%s) is not compatible with this release of the library. The library requires at least PHP version %s',2),
/* /*
@ -33,24 +34,25 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
2001 => array('Die Anzahl der Farben ist nicht gleich der Anzahl der Vorlagen in BarPlot::SetPattern().',0), 2001 => array('Die Anzahl der Farben ist nicht gleich der Anzahl der Vorlagen in BarPlot::SetPattern().',0),
2002 => array('Unbekannte Vorlage im Aufruf von BarPlot::SetPattern().',0), 2002 => array('Unbekannte Vorlage im Aufruf von BarPlot::SetPattern().',0),
2003 => array('Anzahl der X- und Y-Koordinaten sind nicht identisch. Anzahl der X-Koordinaten: %d; Anzahl der Y-Koordinaten: %d.',2), 2003 => array('Anzahl der X- und Y-Koordinaten sind nicht identisch. Anzahl der X-Koordinaten: %d; Anzahl der Y-Koordinaten: %d.',2),
2004 => array('Alle Werte für ein Balkendiagramm (barplot) müssen numerisch sein. Du hast den Wert nr [%d] == %s angegeben.',2), 2004 => array('Alle Werte für ein Balkendiagramm (barplot) müssen numerisch sein. Du hast den Wert nr [%d] == %s angegeben.',2),
2005 => array('Du hast einen leeren Vektor für die Schattierungsfarben im Balkendiagramm (barplot) angegeben.',0), 2005 => array('Du hast einen leeren Vektor für die Schattierungsfarben im Balkendiagramm (barplot) angegeben.',0),
2006 => array('Unbekannte Position für die Werte der Balken: %s.',1), 2006 => array('Unbekannte Position für die Werte der Balken: %s.',1),
2007 => array('Kann GroupBarPlot nicht aus einem leeren Vektor erzeugen.',0), 2007 => array('Kann GroupBarPlot nicht aus einem leeren Vektor erzeugen.',0),
2008 => array('GroupBarPlot Element nbr %d wurde nicht definiert oder ist leer.',0), 2008 => array('GroupBarPlot Element nbr %d wurde nicht definiert oder ist leer.',0),
2009 => array('Eins der Objekte, das an GroupBar weitergegeben wurde ist kein Balkendiagramm (BarPlot). Versichere Dich, dass Du den GroupBarPlot aus einem Vektor von Balkendiagrammen (barplot) oder AccBarPlot-Objekten erzeugst. (Class = %s)',1), 2009 => array('Eins der Objekte, das an GroupBar weitergegeben wurde ist kein Balkendiagramm (BarPlot). Versichere Dich, dass Du den GroupBarPlot aus einem Vektor von Balkendiagrammen (barplot) oder AccBarPlot-Objekten erzeugst. (Class = %s)',1),
2010 => array('Kann AccBarPlot nicht aus einem leeren Vektor erzeugen.',0), 2010 => array('Kann AccBarPlot nicht aus einem leeren Vektor erzeugen.',0),
2011 => array('AccBarPlot-Element nbr %d wurde nicht definiert oder ist leer.',1), 2011 => array('AccBarPlot-Element nbr %d wurde nicht definiert oder ist leer.',1),
2012 => array('Eins der Objekte, das an AccBar weitergegeben wurde ist kein Balkendiagramm (barplot). Versichere Dich, dass Du den AccBar-Plot aus einem Vektor von Balkendiagrammen (barplot) erzeugst. (Class=%s)',1), 2012 => array('Eins der Objekte, das an AccBar weitergegeben wurde ist kein Balkendiagramm (barplot). Versichere Dich, dass Du den AccBar-Plot aus einem Vektor von Balkendiagrammen (barplot) erzeugst. (Class=%s)',1),
2013 => array('Du hast einen leeren Vektor für die Schattierungsfarben im Balkendiagramm (barplot) angegeben.',0), 2013 => array('Du hast einen leeren Vektor für die Schattierungsfarben im Balkendiagramm (barplot) angegeben.',0),
2014 => array('Die Anzahl der Datenpunkte jeder Datenreihe in AccBarPlot muss gleich sein.',0), 2014 => array('Die Anzahl der Datenpunkte jeder Datenreihe in AccBarPlot muss gleich sein.',0),
2015 => array('Individual bar plots in an AccBarPlot or GroupBarPlot can not have specified X-coordinates',0),
/* /*
** jpgraph_date ** jpgraph_date
*/ */
3001 => array('Es ist nur möglich, entweder SetDateAlign() oder SetTimeAlign() zu benutzen, nicht beides!',0), 3001 => array('Es ist nur möglich, entweder SetDateAlign() oder SetTimeAlign() zu benutzen, nicht beides!',0),
/* /*
** jpgraph_error ** jpgraph_error
@ -62,9 +64,9 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
** jpgraph_flags ** jpgraph_flags
*/ */
5001 => array('Unbekannte Flaggen-Größe (%d).',1), 5001 => array('Unbekannte Flaggen-Größe (%d).',1),
5002 => array('Der Flaggen-Index %s existiert nicht.',1), 5002 => array('Der Flaggen-Index %s existiert nicht.',1),
5003 => array('Es wurde eine ungültige Ordnungszahl (%d) für den Flaggen-Index angegeben.',1), 5003 => array('Es wurde eine ungültige Ordnungszahl (%d) für den Flaggen-Index angegeben.',1),
5004 => array('Der Landesname %s hat kein korrespondierendes Flaggenbild. Die Flagge mag existieren, abr eventuell unter einem anderen Namen, z.B. versuche "united states" statt "usa".',1), 5004 => array('Der Landesname %s hat kein korrespondierendes Flaggenbild. Die Flagge mag existieren, abr eventuell unter einem anderen Namen, z.B. versuche "united states" statt "usa".',1),
@ -72,35 +74,36 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
** jpgraph_gantt ** jpgraph_gantt
*/ */
6001 => array('Interner Fehler. Die Höhe für ActivityTitles ist < 0.',0), 6001 => array('Interner Fehler. Die Höhe für ActivityTitles ist < 0.',0),
6002 => array('Es dürfen keine negativen Werte für die Gantt-Diagramm-Dimensionen angegeben werden. Verwende 0, wenn die Dimensionen automatisch ermittelt werden sollen.',0), 6002 => array('Es dürfen keine negativen Werte für die Gantt-Diagramm-Dimensionen angegeben werden. Verwende 0, wenn die Dimensionen automatisch ermittelt werden sollen.',0),
6003 => array('Ungültiges Format für den Bedingungs-Parameter bei Index=%d in CreateSimple(). Der Parameter muss bei index 0 starten und Vektoren in der Form (Row,Constrain-To,Constrain-Type) enthalten.',1), 6003 => array('Ungültiges Format für den Bedingungs-Parameter bei Index=%d in CreateSimple(). Der Parameter muss bei index 0 starten und Vektoren in der Form (Row,Constrain-To,Constrain-Type) enthalten.',1),
6004 => array('Ungültiges Format für den Fortschritts-Parameter bei Index=%d in CreateSimple(). Der Parameter muss bei Index 0 starten und Vektoren in der Form (Row,Progress) enthalten.',1), 6004 => array('Ungültiges Format für den Fortschritts-Parameter bei Index=%d in CreateSimple(). Der Parameter muss bei Index 0 starten und Vektoren in der Form (Row,Progress) enthalten.',1),
6005 => array('SetScale() ist nicht sinnvoll bei Gantt-Diagrammen.',0), 6005 => array('SetScale() ist nicht sinnvoll bei Gantt-Diagrammen.',0),
6006 => array('Das Gantt-Diagramm kann nicht automatisch skaliert werden. Es existieren keine Aktivitäten mit Termin. [GetBarMinMax() start >= n]',0), 6006 => array('Das Gantt-Diagramm kann nicht automatisch skaliert werden. Es existieren keine Aktivitäten mit Termin. [GetBarMinMax() start >= n]',0),
6007 => array('Plausibiltätsprüfung für die automatische Gantt-Diagramm-Größe schlug fehl. Entweder die Breite (=%d) oder die Höhe (=%d) ist größer als MAX_GANTTIMG_SIZE. Dies kann möglicherweise durch einen falschen Wert bei einer Aktivität hervorgerufen worden sein.',2), 6007 => array('Plausibiltätsprüfung für die automatische Gantt-Diagramm-Größe schlug fehl. Entweder die Breite (=%d) oder die Höhe (=%d) ist größer als MAX_GANTTIMG_SIZE. Dies kann möglicherweise durch einen falschen Wert bei einer Aktivität hervorgerufen worden sein.',2),
6008 => array('Du hast eine Bedingung angegeben von Reihe=%d bis Reihe=%d, die keine Aktivität hat.',2), 6008 => array('Du hast eine Bedingung angegeben von Reihe=%d bis Reihe=%d, die keine Aktivität hat.',2),
6009 => array('Unbekannter Bedingungstyp von Reihe=%d bis Reihe=%d',2), 6009 => array('Unbekannter Bedingungstyp von Reihe=%d bis Reihe=%d',2),
6010 => array('Ungültiger Icon-Index für das eingebaute Gantt-Icon [%d]',1), 6010 => array('Ungültiger Icon-Index für das eingebaute Gantt-Icon [%d]',1),
6011 => array('Argument für IconImage muss entweder ein String oder ein Integer sein.',0), 6011 => array('Argument für IconImage muss entweder ein String oder ein Integer sein.',0),
6012 => array('Unbekannter Typ bei der Gantt-Objekt-Title-Definition.',0), 6012 => array('Unbekannter Typ bei der Gantt-Objekt-Title-Definition.',0),
6015 => array('Ungültige vertikale Position %d',1), 6015 => array('Ungültige vertikale Position %d',1),
6016 => array('Der eingegebene Datums-String (%s) für eine Gantt-Aktivität kann nicht interpretiert werden. Versichere Dich, dass es ein gültiger Datumsstring ist, z.B. 2005-04-23 13:30',1), 6016 => array('Der eingegebene Datums-String (%s) für eine Gantt-Aktivität kann nicht interpretiert werden. Versichere Dich, dass es ein gültiger Datumsstring ist, z.B. 2005-04-23 13:30',1),
6017 => array('Unbekannter Datumstyp in GanttScale (%s).',1), 6017 => array('Unbekannter Datumstyp in GanttScale (%s).',1),
6018 => array('Intervall für Minuten muss ein gerader Teiler einer Stunde sein, z.B. 1,5,10,12,15,20,30, etc. Du hast ein Intervall von %d Minuten angegeben.',1), 6018 => array('Intervall für Minuten muss ein gerader Teiler einer Stunde sein, z.B. 1,5,10,12,15,20,30, etc. Du hast ein Intervall von %d Minuten angegeben.',1),
6019 => array('Die vorhandene Breite (%d) für die Minuten ist zu klein, um angezeigt zu werden. Bitte benutze die automatische Größenermittlung oder vergrößere die Breite des Diagramms.',1), 6019 => array('Die vorhandene Breite (%d) für die Minuten ist zu klein, um angezeigt zu werden. Bitte benutze die automatische Größenermittlung oder vergrößere die Breite des Diagramms.',1),
6020 => array('Das Intervall für die Stunden muss ein gerader Teiler eines Tages sein, z.B. 0:30, 1:00, 1:30, 4:00, etc. Du hast ein Intervall von %d eingegeben.',1), 6020 => array('Das Intervall für die Stunden muss ein gerader Teiler eines Tages sein, z.B. 0:30, 1:00, 1:30, 4:00, etc. Du hast ein Intervall von %d eingegeben.',1),
6021 => array('Unbekanntes Format für die Woche.',0), 6021 => array('Unbekanntes Format für die Woche.',0),
6022 => array('Die Gantt-Skala wurde nicht eingegeben.',0), 6022 => array('Die Gantt-Skala wurde nicht eingegeben.',0),
6023 => array('Wenn Du sowohl Stunden als auch Minuten anzeigen lassen willst, muss das Stunden-Interval gleich 1 sein (anderenfalls ist es nicht sinnvoll, Minuten anzeigen zu lassen).',0), 6023 => array('Wenn Du sowohl Stunden als auch Minuten anzeigen lassen willst, muss das Stunden-Interval gleich 1 sein (anderenfalls ist es nicht sinnvoll, Minuten anzeigen zu lassen).',0),
6024 => array('Das CSIM-Ziel muss als String angegeben werden. Der Start des Ziels ist: %d',1), 6024 => array('Das CSIM-Ziel muss als String angegeben werden. Der Start des Ziels ist: %d',1),
6025 => array('Der CSIM-Alt-Text muss als String angegeben werden. Der Beginn des Alt-Textes ist: %d',1), 6025 => array('Der CSIM-Alt-Text muss als String angegeben werden. Der Beginn des Alt-Textes ist: %d',1),
6027 => array('Der Fortschrittswert muss im Bereich [0, 1] liegen.',0), 6027 => array('Der Fortschrittswert muss im Bereich [0, 1] liegen.',0),
6028 => array('Die eingegebene Höhe (%d) für GanttBar ist nicht im zulässigen Bereich.',1), 6028 => array('Die eingegebene Höhe (%d) für GanttBar ist nicht im zulässigen Bereich.',1),
6029 => array('Der Offset für die vertikale Linie muss im Bereich [0,1] sein.',0), 6029 => array('Der Offset für die vertikale Linie muss im Bereich [0,1] sein.',0),
6030 => array('Unbekannte Pfeilrichtung für eine Verbindung.',0), 6030 => array('Unbekannte Pfeilrichtung für eine Verbindung.',0),
6031 => array('Unbekannter Pfeiltyp für eine Verbindung.',0), 6031 => array('Unbekannter Pfeiltyp für eine Verbindung.',0),
6032 => array('Interner Fehler: Unbekannter Pfadtyp (=%d) für eine Verbindung.',1), 6032 => array('Interner Fehler: Unbekannter Pfadtyp (=%d) für eine Verbindung.',1),
6033 => array('Array of fonts must contain arrays with 3 elements, i.e. (Family, Style, Size)',0),
/* /*
** jpgraph_gradient ** jpgraph_gradient
@ -112,107 +115,108 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
** jpgraph_iconplot ** jpgraph_iconplot
*/ */
8001 => array('Der Mix-Wert für das Icon muss zwischen 0 und 100 sein.',0), 8001 => array('Der Mix-Wert für das Icon muss zwischen 0 und 100 sein.',0),
8002 => array('Die Ankerposition für Icons muss entweder "top", "bottom", "left", "right" oder "center" sein.',0), 8002 => array('Die Ankerposition für Icons muss entweder "top", "bottom", "left", "right" oder "center" sein.',0),
8003 => array('Es ist nicht möglich, gleichzeitig ein Bild und eine Landesflagge für dasselbe Icon zu definieren',0), 8003 => array('Es ist nicht möglich, gleichzeitig ein Bild und eine Landesflagge für dasselbe Icon zu definieren',0),
8004 => array('Wenn Du Landesflaggen benutzen willst, musst Du die Datei "jpgraph_flags.php" hinzufügen (per include).',0), 8004 => array('Wenn Du Landesflaggen benutzen willst, musst Du die Datei "jpgraph_flags.php" hinzufügen (per include).',0),
/* /*
** jpgraph_imgtrans ** jpgraph_imgtrans
*/ */
9001 => array('Der Wert für die Bildtransformation ist außerhalb des zulässigen Bereichs. Der verschwindende Punkt am Horizont muss als Wert zwischen 0 und 1 angegeben werden.',0), 9001 => array('Der Wert für die Bildtransformation ist außerhalb des zulässigen Bereichs. Der verschwindende Punkt am Horizont muss als Wert zwischen 0 und 1 angegeben werden.',0),
/* /*
** jpgraph_lineplot ** jpgraph_lineplot
*/ */
10001 => array('Die Methode LinePlot::SetFilled() sollte nicht mehr benutzt werden. Benutze lieber SetFillColor()',0), 10001 => array('Die Methode LinePlot::SetFilled() sollte nicht mehr benutzt werden. Benutze lieber SetFillColor()',0),
10002 => array('Der Plot ist zu kompliziert für FastLineStroke. Benutze lieber den StandardStroke()',0), 10002 => array('Der Plot ist zu kompliziert für FastLineStroke. Benutze lieber den StandardStroke()',0),
10003 => array('Each plot in an accumulated lineplot must have the same number of data points.',0), 10003 => array('Each plot in an accumulated lineplot must have the same number of data points.',0),
/* /*
** jpgraph_log ** jpgraph_log
*/ */
11001 => array('Deine Daten enthalten nicht-numerische Werte.',0), 11001 => array('Deine Daten enthalten nicht-numerische Werte.',0),
11002 => array('Negative Werte können nicht für logarithmische Achsen verwendet werden.',0), 11002 => array('Negative Werte können nicht für logarithmische Achsen verwendet werden.',0),
11003 => array('Deine Daten enthalten nicht-numerische Werte.',0), 11003 => array('Deine Daten enthalten nicht-numerische Werte.',0),
11004 => array('Skalierungsfehler für die logarithmische Achse. Es gibt ein Problem mit den Daten der Achse. Der größte Wert muss größer sein als Null. Es ist mathematisch nicht möglich, einen Wert gleich Null in der Skala zu haben.',0), 11004 => array('Skalierungsfehler für die logarithmische Achse. Es gibt ein Problem mit den Daten der Achse. Der größte Wert muss größer sein als Null. Es ist mathematisch nicht möglich, einen Wert gleich Null in der Skala zu haben.',0),
11005 => array('Das Tick-Intervall für die logarithmische Achse ist nicht definiert. Lösche jeden Aufruf von SetTextLabelStart() oder SetTextTickInterval() bei der logarithmischen Achse.',0), 11005 => array('Das Tick-Intervall für die logarithmische Achse ist nicht definiert. Lösche jeden Aufruf von SetTextLabelStart() oder SetTextTickInterval() bei der logarithmischen Achse.',0),
/* /*
** jpgraph_mgraph ** jpgraph_mgraph
*/ */
12001 => array("Du benutzt GD 2.x und versuchst ein Nicht-Truecolor-Bild als Hintergrundbild zu benutzen. Um Hintergrundbilder mit GD 2.x zu benutzen, ist es notwendig Truecolor zu aktivieren, indem die USE_TRUECOLOR-Konstante auf TRUE gesetzt wird. Wegen eines Bugs in GD 2.0.1 ist die Qualität der Truetype-Schriften sehr schlecht, wenn man Truetype-Schriften mit Truecolor-Bildern verwendet.",0), 12001 => array("Du benutzt GD 2.x und versuchst ein Nicht-Truecolor-Bild als Hintergrundbild zu benutzen. Um Hintergrundbilder mit GD 2.x zu benutzen, ist es notwendig Truecolor zu aktivieren, indem die USE_TRUECOLOR-Konstante auf TRUE gesetzt wird. Wegen eines Bugs in GD 2.0.1 ist die Qualität der Truetype-Schriften sehr schlecht, wenn man Truetype-Schriften mit Truecolor-Bildern verwendet.",0),
12002 => array('Ungültiger Dateiname für MGraph::SetBackgroundImage() : %s. Die Datei muss eine gültige Dateierweiterung haben (jpg,gif,png), wenn die automatische Typerkennung verwendet wird.',1), 12002 => array('Ungültiger Dateiname für MGraph::SetBackgroundImage() : %s. Die Datei muss eine gültige Dateierweiterung haben (jpg,gif,png), wenn die automatische Typerkennung verwendet wird.',1),
12003 => array('Unbekannte Dateierweiterung (%s) in MGraph::SetBackgroundImage() für Dateiname: %s',2), 12003 => array('Unbekannte Dateierweiterung (%s) in MGraph::SetBackgroundImage() für Dateiname: %s',2),
12004 => array('Das Bildformat des Hintergrundbildes (%s) wird von Deiner System-Konfiguration nicht unterstützt. ',1), 12004 => array('Das Bildformat des Hintergrundbildes (%s) wird von Deiner System-Konfiguration nicht unterstützt. ',1),
12005 => array('Das Hintergrundbild kann nicht gelesen werden: %s',1), 12005 => array('Das Hintergrundbild kann nicht gelesen werden: %s',1),
12006 => array('Es wurden ungültige Größen für Breite oder Höhe beim Erstellen des Bildes angegeben, (Breite=%d, Höhe=%d)',2), 12006 => array('Es wurden ungültige Größen für Breite oder Höhe beim Erstellen des Bildes angegeben, (Breite=%d, Höhe=%d)',2),
12007 => array('Das Argument für MGraph::Add() ist nicht gültig für GD.',0), 12007 => array('Das Argument für MGraph::Add() ist nicht gültig für GD.',0),
12008 => array('Deine PHP- (und GD-lib-) Installation scheint keine bekannten Bildformate zu unterstützen.',0), 12008 => array('Deine PHP- (und GD-lib-) Installation scheint keine bekannten Bildformate zu unterstützen.',0),
12009 => array('Deine PHP-Installation unterstützt das gewählte Bildformat nicht: %s',1), 12009 => array('Deine PHP-Installation unterstützt das gewählte Bildformat nicht: %s',1),
12010 => array('Es konnte kein Bild als Datei %s erzeugt werden. Überprüfe, ob Du die entsprechenden Schreibrechte im aktuellen Verzeichnis hast.',1), 12010 => array('Es konnte kein Bild als Datei %s erzeugt werden. Überprüfe, ob Du die entsprechenden Schreibrechte im aktuellen Verzeichnis hast.',1),
12011 => array('Es konnte kein Truecolor-Bild erzeugt werden. Überprüfe, ob Du wirklich die GD2-Bibliothek installiert hast.',0), 12011 => array('Es konnte kein Truecolor-Bild erzeugt werden. Überprüfe, ob Du wirklich die GD2-Bibliothek installiert hast.',0),
12012 => array('Es konnte kein Bild erzeugt werden. Überprüfe, ob Du wirklich die GD2-Bibliothek installiert hast.',0), 12012 => array('Es konnte kein Bild erzeugt werden. Überprüfe, ob Du wirklich die GD2-Bibliothek installiert hast.',0),
/* /*
** jpgraph_pie3d ** jpgraph_pie3d
*/ */
14001 => array('Pie3D::ShowBorder(). Missbilligte Funktion. Benutze Pie3D::SetEdge(), um die Ecken der Tortenstücke zu kontrollieren.',0), 14001 => array('Pie3D::ShowBorder(). Missbilligte Funktion. Benutze Pie3D::SetEdge(), um die Ecken der Tortenstücke zu kontrollieren.',0),
14002 => array('PiePlot3D::SetAngle() 3D-Torten-Projektionswinkel muss zwischen 5 und 85 Grad sein.',0), 14002 => array('PiePlot3D::SetAngle() 3D-Torten-Projektionswinkel muss zwischen 5 und 85 Grad sein.',0),
14003 => array('Interne Festlegung schlug fehl. Pie3D::Pie3DSlice',0), 14003 => array('Interne Festlegung schlug fehl. Pie3D::Pie3DSlice',0),
14004 => array('Tortenstück-Startwinkel muss zwischen 0 und 360 Grad sein.',0), 14004 => array('Tortenstück-Startwinkel muss zwischen 0 und 360 Grad sein.',0),
14005 => array('Pie3D Interner Fehler: Versuch, zweimal zu umhüllen bei der Suche nach dem Startindex.',0,), 14005 => array('Pie3D Interner Fehler: Versuch, zweimal zu umhüllen bei der Suche nach dem Startindex.',0,),
14006 => array('Pie3D Interner Fehler: Z-Sortier-Algorithmus für 3D-Tortendiagramme funktioniert nicht einwandfrei (2). Versuch, zweimal zu umhüllen beim Erstellen des Bildes.',0), 14006 => array('Pie3D Interner Fehler: Z-Sortier-Algorithmus für 3D-Tortendiagramme funktioniert nicht einwandfrei (2). Versuch, zweimal zu umhüllen beim Erstellen des Bildes.',0),
14007 => array('Die Breite für das 3D-Tortendiagramm ist 0. Gib eine Breite > 0 an.',0), 14007 => array('Die Breite für das 3D-Tortendiagramm ist 0. Gib eine Breite > 0 an.',0),
/* /*
** jpgraph_pie ** jpgraph_pie
*/ */
15001 => array('PiePLot::SetTheme() Unbekannter Stil: %s',1), 15001 => array('PiePLot::SetTheme() Unbekannter Stil: %s',1),
15002 => array('Argument für PiePlot::ExplodeSlice() muss ein Integer-Wert sein',0), 15002 => array('Argument für PiePlot::ExplodeSlice() muss ein Integer-Wert sein',0),
15003 => array('Argument für PiePlot::Explode() muss ein Vektor mit Integer-Werten sein.',0), 15003 => array('Argument für PiePlot::Explode() muss ein Vektor mit Integer-Werten sein.',0),
15004 => array('Tortenstück-Startwinkel muss zwischen 0 und 360 Grad sein.',0), 15004 => array('Tortenstück-Startwinkel muss zwischen 0 und 360 Grad sein.',0),
15005 => array('PiePlot::SetFont() sollte nicht mehr verwendet werden. Benutze stattdessen PiePlot->value->SetFont().',0), 15005 => array('PiePlot::SetFont() sollte nicht mehr verwendet werden. Benutze stattdessen PiePlot->value->SetFont().',0),
15006 => array('PiePlot::SetSize() Radius für Tortendiagramm muss entweder als Bruch [0, 0.5] der Bildgröße oder als Absoluwert in Pixel im Bereich [10, 1000] angegeben werden.',0), 15006 => array('PiePlot::SetSize() Radius für Tortendiagramm muss entweder als Bruch [0, 0.5] der Bildgröße oder als Absoluwert in Pixel im Bereich [10, 1000] angegeben werden.',0),
15007 => array('PiePlot::SetFontColor() sollte nicht mehr verwendet werden. Benutze stattdessen PiePlot->value->SetColor()..',0), 15007 => array('PiePlot::SetFontColor() sollte nicht mehr verwendet werden. Benutze stattdessen PiePlot->value->SetColor()..',0),
15008 => array('PiePlot::SetLabelType() der Typ für Tortendiagramme muss entweder 0 or 1 sein (nicht %d).',1), 15008 => array('PiePlot::SetLabelType() der Typ für Tortendiagramme muss entweder 0 or 1 sein (nicht %d).',1),
15009 => array('Ungültiges Tortendiagramm. Die Summe aller Daten ist Null.',0), 15009 => array('Ungültiges Tortendiagramm. Die Summe aller Daten ist Null.',0),
15010 => array('Die Summe aller Daten ist Null.',0), 15010 => array('Die Summe aller Daten ist Null.',0),
15011 => array('Um Bildtransformationen benutzen zu können, muss die Datei jpgraph_imgtrans.php eingefügt werden (per include).',0), 15011 => array('Um Bildtransformationen benutzen zu können, muss die Datei jpgraph_imgtrans.php eingefügt werden (per include).',0), // @todo translate into German
15012 => array('PiePlot::SetTheme() is no longer recommended. Use PieGraph::SetTheme()',0),
/* /*
** jpgraph_plotband ** jpgraph_plotband
*/ */
16001 => array('Die Dichte für das Pattern muss zwischen 1 und 100 sein. (Du hast %f eingegeben)',1), 16001 => array('Die Dichte für das Pattern muss zwischen 1 und 100 sein. (Du hast %f eingegeben)',1),
16002 => array('Es wurde keine Position für das Pattern angegeben.',0), 16002 => array('Es wurde keine Position für das Pattern angegeben.',0),
16003 => array('Unbekannte Pattern-Definition (%d)',0), 16003 => array('Unbekannte Pattern-Definition (%d)',0),
16004 => array('Der Mindeswert für das PlotBand ist größer als der Maximalwert. Bitte korrigiere dies!',0), 16004 => array('Der Mindeswert für das PlotBand ist größer als der Maximalwert. Bitte korrigiere dies!',0),
/* /*
** jpgraph_polar ** jpgraph_polar
*/ */
17001 => array('PolarPlots müssen eine gerade Anzahl von Datenpunkten haben. Jeder Datenpunkt ist ein Tupel (Winkel, Radius).',0), 17001 => array('PolarPlots müssen eine gerade Anzahl von Datenpunkten haben. Jeder Datenpunkt ist ein Tupel (Winkel, Radius).',0),
17002 => array('Unbekannte Ausrichtung für X-Achsen-Titel. (%s)',1), 17002 => array('Unbekannte Ausrichtung für X-Achsen-Titel. (%s)',1),
//17003 => array('Set90AndMargin() wird für PolarGraph nicht unterstützt.',0), //17003 => array('Set90AndMargin() wird für PolarGraph nicht unterstützt.',0),
17004 => array('Unbekannter Achsentyp für PolarGraph. Er muss entweder \'lin\' oder \'log\' sein.',0), 17004 => array('Unbekannter Achsentyp für PolarGraph. Er muss entweder \'lin\' oder \'log\' sein.',0),
/* /*
** jpgraph_radar ** jpgraph_radar
*/ */
18001 => array('ClientSideImageMaps werden für RadarPlots nicht unterstützt.',0), 18001 => array('ClientSideImageMaps werden für RadarPlots nicht unterstützt.',0),
18002 => array('RadarGraph::SupressTickMarks() sollte nicht mehr verwendet werden. Benutze stattdessen HideTickMarks().',0), 18002 => array('RadarGraph::SupressTickMarks() sollte nicht mehr verwendet werden. Benutze stattdessen HideTickMarks().',0),
18003 => array('Ungültiger Achsentyp für RadarPlot (%s). Er muss entweder \'lin\' oder \'log\' sein.',1), 18003 => array('Ungültiger Achsentyp für RadarPlot (%s). Er muss entweder \'lin\' oder \'log\' sein.',1),
18004 => array('Die RadarPlot-Größe muss zwischen 0.1 und 1 sein. (Dein Wert=%f)',1), 18004 => array('Die RadarPlot-Größe muss zwischen 0.1 und 1 sein. (Dein Wert=%f)',1),
18005 => array('RadarPlot: nicht unterstützte Tick-Dichte: %d',1), 18005 => array('RadarPlot: nicht unterstützte Tick-Dichte: %d',1),
18006 => array('Minimum Daten %f (RadarPlots sollten nur verwendet werden, wenn alle Datenpunkte einen Wert > 0 haben).',1), 18006 => array('Minimum Daten %f (RadarPlots sollten nur verwendet werden, wenn alle Datenpunkte einen Wert > 0 haben).',1),
18007 => array('Die Anzahl der Titel entspricht nicht der Anzahl der Datenpunkte.',0), 18007 => array('Die Anzahl der Titel entspricht nicht der Anzahl der Datenpunkte.',0),
18008 => array('Jeder RadarPlot muss die gleiche Anzahl von Datenpunkten haben.',0), 18008 => array('Jeder RadarPlot muss die gleiche Anzahl von Datenpunkten haben.',0),
@ -222,29 +226,29 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
*/ */
19001 => array('Spline: Anzahl der X- und Y-Koordinaten muss gleich sein.',0), 19001 => array('Spline: Anzahl der X- und Y-Koordinaten muss gleich sein.',0),
19002 => array('Ungültige Dateneingabe für Spline. Zwei oder mehr aufeinanderfolgende X-Werte sind identisch. Jeder eigegebene X-Wert muss unterschiedlich sein, weil vom mathematischen Standpunkt ein Eins-zu-Eins-Mapping vorliegen muss, d.h. jeder X-Wert korrespondiert mit exakt einem Y-Wert.',0), 19002 => array('Ungültige Dateneingabe für Spline. Zwei oder mehr aufeinanderfolgende X-Werte sind identisch. Jeder eigegebene X-Wert muss unterschiedlich sein, weil vom mathematischen Standpunkt ein Eins-zu-Eins-Mapping vorliegen muss, d.h. jeder X-Wert korrespondiert mit exakt einem Y-Wert.',0),
19003 => array('Bezier: Anzahl der X- und Y-Koordinaten muss gleich sein.',0), 19003 => array('Bezier: Anzahl der X- und Y-Koordinaten muss gleich sein.',0),
/* /*
** jpgraph_scatter ** jpgraph_scatter
*/ */
20001 => array('Fieldplots müssen die gleiche Anzahl von X und Y Datenpunkten haben.',0), 20001 => array('Fieldplots müssen die gleiche Anzahl von X und Y Datenpunkten haben.',0),
20002 => array('Bei Fieldplots muss ein Winkel für jeden X und Y Datenpunkt angegeben werden.',0), 20002 => array('Bei Fieldplots muss ein Winkel für jeden X und Y Datenpunkt angegeben werden.',0),
20003 => array('Scatterplots müssen die gleiche Anzahl von X- und Y-Datenpunkten haben.',0), 20003 => array('Scatterplots müssen die gleiche Anzahl von X- und Y-Datenpunkten haben.',0),
/* /*
** jpgraph_stock ** jpgraph_stock
*/ */
21001 => array('Die Anzahl der Datenwerte für Stock-Charts müssen ein Mehrfaches von %d Datenpunkten sein.',1), 21001 => array('Die Anzahl der Datenwerte für Stock-Charts müssen ein Mehrfaches von %d Datenpunkten sein.',1),
/* /*
** jpgraph_plotmark ** jpgraph_plotmark
*/ */
23001 => array('Der Marker "%s" existiert nicht in der Farbe: %d',2), 23001 => array('Der Marker "%s" existiert nicht in der Farbe: %d',2),
23002 => array('Der Farb-Index ist zu hoch für den Marker "%s"',1), 23002 => array('Der Farb-Index ist zu hoch für den Marker "%s"',1),
23003 => array('Ein Dateiname muss angegeben werden, wenn Du den Marker-Typ auf MARK_IMG setzt.',0), 23003 => array('Ein Dateiname muss angegeben werden, wenn Du den Marker-Typ auf MARK_IMG setzt.',0),
/* /*
@ -254,69 +258,69 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
24001 => array('FuncGenerator : Keine Funktion definiert. ',0), 24001 => array('FuncGenerator : Keine Funktion definiert. ',0),
24002 => array('FuncGenerator : Syntax-Fehler in der Funktionsdefinition ',0), 24002 => array('FuncGenerator : Syntax-Fehler in der Funktionsdefinition ',0),
24003 => array('DateScaleUtils: Unknown tick type specified in call to GetTicks()',0), 24003 => array('DateScaleUtils: Unknown tick type specified in call to GetTicks()',0),
24004 => array('ReadCSV2: Die anzahl der spalten fehler in %s reihe %d',2),
/* /*
** jpgraph ** jpgraph
*/ */
25001 => array('Diese PHP-Installation ist nicht mit der GD-Bibliothek kompiliert. Bitte kompiliere PHP mit GD-Unterstützung neu, damit JpGraph funktioniert. (Weder die Funktion imagetypes() noch imagecreatefromstring() existiert!)',0), 25001 => array('Diese PHP-Installation ist nicht mit der GD-Bibliothek kompiliert. Bitte kompiliere PHP mit GD-Unterstützung neu, damit JpGraph funktioniert. (Weder die Funktion imagetypes() noch imagecreatefromstring() existiert!)',0),
25002 => array('Diese PHP-Installation scheint nicht die benötigte GD-Bibliothek zu unterstützen. Bitte schau in der PHP-Dokumentation nach, wie man die GD-Bibliothek installiert und aktiviert.',0), 25002 => array('Diese PHP-Installation scheint nicht die benötigte GD-Bibliothek zu unterstützen. Bitte schau in der PHP-Dokumentation nach, wie man die GD-Bibliothek installiert und aktiviert.',0),
25003 => array('Genereller PHP Fehler : Bei %s:%d : %s',3), 25003 => array('Genereller PHP Fehler : Bei %s:%d : %s',3),
25004 => array('Genereller PHP Fehler : %s ',1), 25004 => array('Genereller PHP Fehler : %s ',1),
25005 => array('PHP_SELF, die PHP-Global-Variable kann nicht ermittelt werden. PHP kann nicht von der Kommandozeile gestartet werden, wenn der Cache oder die Bilddateien automatisch benannt werden sollen.',0), 25005 => array('PHP_SELF, die PHP-Global-Variable kann nicht ermittelt werden. PHP kann nicht von der Kommandozeile gestartet werden, wenn der Cache oder die Bilddateien automatisch benannt werden sollen.',0),
25006 => array('Die Benutzung der FF_CHINESE (FF_BIG5) Schriftfamilie benötigt die iconv() Funktion in Deiner PHP-Konfiguration. Dies wird nicht defaultmäßig in PHP kompiliert (benötigt "--width-iconv" bei der Konfiguration).',0), 25006 => array('Die Benutzung der FF_CHINESE (FF_BIG5) Schriftfamilie benötigt die iconv() Funktion in Deiner PHP-Konfiguration. Dies wird nicht defaultmäßig in PHP kompiliert (benötigt "--width-iconv" bei der Konfiguration).',0),
25007 => array('Du versuchst das lokale (%s) zu verwenden, was von Deiner PHP-Installation nicht unterstützt wird. Hinweis: Benutze \'\', um das defaultmäßige Lokale für diese geographische Region festzulegen.',1), 25007 => array('Du versuchst das lokale (%s) zu verwenden, was von Deiner PHP-Installation nicht unterstützt wird. Hinweis: Benutze \'\', um das defaultmäßige Lokale für diese geographische Region festzulegen.',1),
25008 => array('Die Bild-Breite und Höhe in Graph::Graph() müssen numerisch sein',0), 25008 => array('Die Bild-Breite und Höhe in Graph::Graph() müssen numerisch sein',0),
25009 => array('Die Skalierung der Achsen muss angegeben werden mit Graph::SetScale()',0), 25009 => array('Die Skalierung der Achsen muss angegeben werden mit Graph::SetScale()',0),
25010 => array('Graph::Add() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0), 25010 => array('Graph::Add() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0),
25011 => array('Graph::AddY2() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0), 25011 => array('Graph::AddY2() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0),
25012 => array('Graph::AddYN() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0), 25012 => array('Graph::AddYN() Du hast versucht, einen leeren Plot zum Graph hinzuzufügen.',0),
25013 => array('Es können nur Standard-Plots zu multiplen Y-Achsen hinzugefügt werden',0), 25013 => array('Es können nur Standard-Plots zu multiplen Y-Achsen hinzugefügt werden',0),
25014 => array('Graph::AddText() Du hast versucht, einen leeren Text zum Graph hinzuzufügen.',0), 25014 => array('Graph::AddText() Du hast versucht, einen leeren Text zum Graph hinzuzufügen.',0),
25015 => array('Graph::AddLine() Du hast versucht, eine leere Linie zum Graph hinzuzufügen.',0), 25015 => array('Graph::AddLine() Du hast versucht, eine leere Linie zum Graph hinzuzufügen.',0),
25016 => array('Graph::AddBand() Du hast versucht, ein leeres Band zum Graph hinzuzufügen.',0), 25016 => array('Graph::AddBand() Du hast versucht, ein leeres Band zum Graph hinzuzufügen.',0),
25017 => array('Du benutzt GD 2.x und versuchst, ein Hintergrundbild in einem Truecolor-Bild zu verwenden. Um Hintergrundbilder mit GD 2.x zu verwenden, ist es notwendig, Truecolor zu aktivieren, indem die USE_TRUECOLOR-Konstante auf TRUE gesetzt wird. Wegen eines Bugs in GD 2.0.1 ist die Qualität der Schrift sehr schlecht, wenn Truetype-Schrift in Truecolor-Bildern verwendet werden.',0), 25017 => array('Du benutzt GD 2.x und versuchst, ein Hintergrundbild in einem Truecolor-Bild zu verwenden. Um Hintergrundbilder mit GD 2.x zu verwenden, ist es notwendig, Truecolor zu aktivieren, indem die USE_TRUECOLOR-Konstante auf TRUE gesetzt wird. Wegen eines Bugs in GD 2.0.1 ist die Qualität der Schrift sehr schlecht, wenn Truetype-Schrift in Truecolor-Bildern verwendet werden.',0),
25018 => array('Falscher Dateiname für Graph::SetBackgroundImage() : "%s" muss eine gültige Dateinamenerweiterung (jpg,gif,png) haben, wenn die automatische Dateityperkennung verwenndet werden soll.',1), 25018 => array('Falscher Dateiname für Graph::SetBackgroundImage() : "%s" muss eine gültige Dateinamenerweiterung (jpg,gif,png) haben, wenn die automatische Dateityperkennung verwenndet werden soll.',1),
25019 => array('Unbekannte Dateinamenerweiterung (%s) in Graph::SetBackgroundImage() für Dateiname: "%s"',2), 25019 => array('Unbekannte Dateinamenerweiterung (%s) in Graph::SetBackgroundImage() für Dateiname: "%s"',2),
25020 => array('Graph::SetScale(): Dar Maximalwert muss größer sein als der Mindestwert.',0), 25020 => array('Graph::SetScale(): Dar Maximalwert muss größer sein als der Mindestwert.',0),
25021 => array('Unbekannte Achsendefinition für die Y-Achse. (%s)',1), 25021 => array('Unbekannte Achsendefinition für die Y-Achse. (%s)',1),
25022 => array('Unbekannte Achsendefinition für die X-Achse. (%s)',1), 25022 => array('Unbekannte Achsendefinition für die X-Achse. (%s)',1),
25023 => array('Nicht unterstützter Y2-Achsentyp: "%s" muss einer von (lin,log,int) sein.',1), 25023 => array('Nicht unterstützter Y2-Achsentyp: "%s" muss einer von (lin,log,int) sein.',1),
25024 => array('Nicht unterstützter X-Achsentyp: "%s" muss einer von (lin,log,int) sein.',1), 25024 => array('Nicht unterstützter X-Achsentyp: "%s" muss einer von (lin,log,int) sein.',1),
25025 => array('Nicht unterstützte Tick-Dichte: %d',1), 25025 => array('Nicht unterstützte Tick-Dichte: %d',1),
25026 => array('Nicht unterstützter Typ der nicht angegebenen Y-Achse. Du hast entweder: 1. einen Y-Achsentyp für automatisches Skalieren definiert, aber keine Plots angegeben. 2. eine Achse direkt definiert, aber vergessen, die Tick-Dichte zu festzulegen.',0), 25026 => array('Nicht unterstützter Typ der nicht angegebenen Y-Achse. Du hast entweder: 1. einen Y-Achsentyp für automatisches Skalieren definiert, aber keine Plots angegeben. 2. eine Achse direkt definiert, aber vergessen, die Tick-Dichte zu festzulegen.',0),
25027 => array('Kann cached CSIM "%s" zum Lesen nicht öffnen.',1), 25027 => array('Kann cached CSIM "%s" zum Lesen nicht öffnen.',1),
25028 => array('Apache/PHP hat keine Schreibrechte, in das CSIM-Cache-Verzeichnis (%s) zu schreiben. Überprüfe die Rechte.',1), 25028 => array('Apache/PHP hat keine Schreibrechte, in das CSIM-Cache-Verzeichnis (%s) zu schreiben. Überprüfe die Rechte.',1),
25029 => array('Kann nicht in das CSIM "%s" schreiben. Überprüfe die Schreibrechte und den freien Speicherplatz.',1), 25029 => array('Kann nicht in das CSIM "%s" schreiben. Überprüfe die Schreibrechte und den freien Speicherplatz.',1),
25030 => array('Fehlender Skriptname für StrokeCSIM(). Der Name des aktuellen Skriptes muss als erster Parameter von StrokeCSIM() angegeben werden.',0), 25030 => array('Fehlender Skriptname für StrokeCSIM(). Der Name des aktuellen Skriptes muss als erster Parameter von StrokeCSIM() angegeben werden.',0),
25031 => array('Der Achsentyp muss mittels Graph::SetScale() angegeben werden.',0), 25031 => array('Der Achsentyp muss mittels Graph::SetScale() angegeben werden.',0),
25032 => array('Es existieren keine Plots für die Y-Achse nbr:%d',1), 25032 => array('Es existieren keine Plots für die Y-Achse nbr:%d',1),
25033 => array('',0), 25033 => array('',0),
25034 => array('Undefinierte X-Achse kann nicht gezeichnet werden. Es wurden keine Plots definiert.',0), 25034 => array('Undefinierte X-Achse kann nicht gezeichnet werden. Es wurden keine Plots definiert.',0),
25035 => array('Du hast Clipping aktiviert. Clipping wird nur für Diagramme mit 0 oder 90 Grad Rotation unterstützt. Bitte verändere Deinen Rotationswinkel (=%d Grad) dementsprechend oder deaktiviere Clipping.',1), 25035 => array('Du hast Clipping aktiviert. Clipping wird nur für Diagramme mit 0 oder 90 Grad Rotation unterstützt. Bitte verändere Deinen Rotationswinkel (=%d Grad) dementsprechend oder deaktiviere Clipping.',1),
25036 => array('Unbekannter Achsentyp AxisStyle() : %s',1), 25036 => array('Unbekannter Achsentyp AxisStyle() : %s',1),
25037 => array('Das Bildformat Deines Hintergrundbildes (%s) wird von Deiner System-Konfiguration nicht unterstützt. ',1), 25037 => array('Das Bildformat Deines Hintergrundbildes (%s) wird von Deiner System-Konfiguration nicht unterstützt. ',1),
25038 => array('Das Hintergrundbild scheint von einem anderen Typ (unterschiedliche Dateierweiterung) zu sein als der angegebene Typ. Angegebenen: %s; Datei: %s',2), 25038 => array('Das Hintergrundbild scheint von einem anderen Typ (unterschiedliche Dateierweiterung) zu sein als der angegebene Typ. Angegebenen: %s; Datei: %s',2),
25039 => array('Hintergrundbild kann nicht gelesen werden: "%s"',1), 25039 => array('Hintergrundbild kann nicht gelesen werden: "%s"',1),
25040 => array('Es ist nicht möglich, sowohl ein Hintergrundbild als auch eine Hintergrund-Landesflagge anzugeben.',0), 25040 => array('Es ist nicht möglich, sowohl ein Hintergrundbild als auch eine Hintergrund-Landesflagge anzugeben.',0),
25041 => array('Um Landesflaggen als Hintergrund benutzen zu können, muss die Datei "jpgraph_flags.php" eingefügt werden (per include).',0), 25041 => array('Um Landesflaggen als Hintergrund benutzen zu können, muss die Datei "jpgraph_flags.php" eingefügt werden (per include).',0),
25042 => array('Unbekanntes Hintergrundbild-Layout',0), 25042 => array('Unbekanntes Hintergrundbild-Layout',0),
25043 => array('Unbekannter Titelhintergrund-Stil.',0), 25043 => array('Unbekannter Titelhintergrund-Stil.',0),
25044 => array('Automatisches Skalieren kann nicht verwendet werden, weil es unmöglich ist, einen gültigen min/max Wert für die Y-Achse zu ermitteln (nur Null-Werte).',0), 25044 => array('Automatisches Skalieren kann nicht verwendet werden, weil es unmöglich ist, einen gültigen min/max Wert für die Y-Achse zu ermitteln (nur Null-Werte).',0),
25045 => array('Die Schriftfamilien FF_HANDWRT und FF_BOOK sind wegen Copyright-Problemen nicht mehr verfügbar. Diese Schriften können nicht mehr mit JpGraph verteilt werden. Bitte lade Dir Schriften von http://corefonts.sourceforge.net/ herunter.',0), 25045 => array('Die Schriftfamilien FF_HANDWRT und FF_BOOK sind wegen Copyright-Problemen nicht mehr verfügbar. Diese Schriften können nicht mehr mit JpGraph verteilt werden. Bitte lade Dir Schriften von http://corefonts.sourceforge.net/ herunter.',0),
25046 => array('Angegebene TTF-Schriftfamilie (id=%d) ist unbekannt oder existiert nicht. Bitte merke Dir, dass TTF-Schriften wegen Copyright-Problemen nicht mit JpGraph mitgeliefert werden. Du findest MS-TTF-Internetschriften (arial, courier, etc.) zum Herunterladen unter http://corefonts.sourceforge.net/',1), 25046 => array('Angegebene TTF-Schriftfamilie (id=%d) ist unbekannt oder existiert nicht. Bitte merke Dir, dass TTF-Schriften wegen Copyright-Problemen nicht mit JpGraph mitgeliefert werden. Du findest MS-TTF-Internetschriften (arial, courier, etc.) zum Herunterladen unter http://corefonts.sourceforge.net/',1),
25047 => array('Stil %s ist nicht verfügbar für Schriftfamilie %s',2), 25047 => array('Stil %s ist nicht verfügbar für Schriftfamilie %s',2),
25048 => array('Unbekannte Schriftstildefinition [%s].',1), 25048 => array('Unbekannte Schriftstildefinition [%s].',1),
25049 => array('Schriftdatei "%s" ist nicht lesbar oder existiert nicht.',1), 25049 => array('Schriftdatei "%s" ist nicht lesbar oder existiert nicht.',1),
25050 => array('Erstes Argument für Text::Text() muss ein String sein.',0), 25050 => array('Erstes Argument für Text::Text() muss ein String sein.',0),
25051 => array('Ungültige Richtung angegeben für Text.',0), 25051 => array('Ungültige Richtung angegeben für Text.',0),
25052 => array('PANIK: Interner Fehler in SuperScript::Stroke(). Unbekannte vertikale Ausrichtung für Text.',0), 25052 => array('PANIK: Interner Fehler in SuperScript::Stroke(). Unbekannte vertikale Ausrichtung für Text.',0),
25053 => array('PANIK: Interner Fehler in SuperScript::Stroke(). Unbekannte horizontale Ausrichtung für Text.',0), 25053 => array('PANIK: Interner Fehler in SuperScript::Stroke(). Unbekannte horizontale Ausrichtung für Text.',0),
25054 => array('Interner Fehler: Unbekannte Grid-Achse %s',1), 25054 => array('Interner Fehler: Unbekannte Grid-Achse %s',1),
25055 => array('Axis::SetTickDirection() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetTickSide().',0), 25055 => array('Axis::SetTickDirection() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetTickSide().',0),
25056 => array('SetTickLabelMargin() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetLabelMargin().',0), 25056 => array('SetTickLabelMargin() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetLabelMargin().',0),
@ -324,81 +328,94 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
25058 => array('TextLabelIntevall >= 1 muss angegeben werden.',0), 25058 => array('TextLabelIntevall >= 1 muss angegeben werden.',0),
25059 => array('SetLabelPos() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetLabelSide().',0), 25059 => array('SetLabelPos() sollte nicht mehr verwendet werden. Benutze stattdessen Axis::SetLabelSide().',0),
25060 => array('Unbekannte Ausrichtung angegeben für X-Achsentitel (%s).',1), 25060 => array('Unbekannte Ausrichtung angegeben für X-Achsentitel (%s).',1),
25061 => array('Unbekannte Ausrichtung angegeben für Y-Achsentitel (%s).',1), 25061 => array('Unbekannte Ausrichtung angegeben für Y-Achsentitel (%s).',1),
25062 => array('Label unter einem Winkel werden für die Y-Achse nicht unterstützt.',0), 25062 => array('Label unter einem Winkel werden für die Y-Achse nicht unterstützt.',0),
25063 => array('Ticks::SetPrecision() sollte nicht mehr verwendet werden. Benutze stattdessen Ticks::SetLabelFormat() (oder Ticks::SetFormatCallback()).',0), 25063 => array('Ticks::SetPrecision() sollte nicht mehr verwendet werden. Benutze stattdessen Ticks::SetLabelFormat() (oder Ticks::SetFormatCallback()).',0),
25064 => array('Kleinere oder größere Schrittgröße ist 0. Überprüfe, ob Du fälschlicherweise SetTextTicks(0) in Deinem Skript hast. Wenn dies nicht der Fall ist, bist Du eventuell über einen Bug in JpGraph gestolpert. Bitte sende einen Report und füge den Code an, der den Fehler verursacht hat.',0), 25064 => array('Kleinere oder größere Schrittgröße ist 0. Überprüfe, ob Du fälschlicherweise SetTextTicks(0) in Deinem Skript hast. Wenn dies nicht der Fall ist, bist Du eventuell über einen Bug in JpGraph gestolpert. Bitte sende einen Report und füge den Code an, der den Fehler verursacht hat.',0),
25065 => array('Tick-Positionen müssen als array() angegeben werden',0), 25065 => array('Tick-Positionen müssen als array() angegeben werden',0),
25066 => array('Wenn die Tick-Positionen und -Label von Hand eingegeben werden, muss die Anzahl der Ticks und der Label gleich sein.',0), 25066 => array('Wenn die Tick-Positionen und -Label von Hand eingegeben werden, muss die Anzahl der Ticks und der Label gleich sein.',0),
25067 => array('Deine von Hand eingegebene Achse und Ticks sind nicht korrekt. Die Skala scheint zu klein zu sein für den Tickabstand.',0), 25067 => array('Deine von Hand eingegebene Achse und Ticks sind nicht korrekt. Die Skala scheint zu klein zu sein für den Tickabstand.',0),
25068 => array('Ein Plot hat eine ungültige Achse. Dies kann beispielsweise der Fall sein, wenn Du automatisches Text-Skalieren verwendest, um ein Liniendiagramm zu zeichnen mit nur einem Datenpunkt, oder wenn die Bildfläche zu klein ist. Es kann auch der Fall sein, dass kein Datenpunkt einen numerischen Wert hat (vielleicht nur \'-\' oder \'x\').',0), 25068 => array('Ein Plot hat eine ungültige Achse. Dies kann beispielsweise der Fall sein, wenn Du automatisches Text-Skalieren verwendest, um ein Liniendiagramm zu zeichnen mit nur einem Datenpunkt, oder wenn die Bildfläche zu klein ist. Es kann auch der Fall sein, dass kein Datenpunkt einen numerischen Wert hat (vielleicht nur \'-\' oder \'x\').',0),
25069 => array('Grace muss größer sein als 0',0), 25069 => array('Grace muss größer sein als 0',0),
25070 => array('Deine Daten enthalten nicht-numerische Werte.',0), 25070 => array('Deine Daten enthalten nicht-numerische Werte.',0),
25071 => array('Du hast mit SetAutoMin() einen Mindestwert angegeben, der größer ist als der Maximalwert für die Achse. Dies ist nicht möglich.',0), 25071 => array('Du hast mit SetAutoMin() einen Mindestwert angegeben, der größer ist als der Maximalwert für die Achse. Dies ist nicht möglich.',0),
25072 => array('Du hast mit SetAutoMax() einen Maximalwert angegeben, der kleiner ist als der Minimalwert der Achse. Dies ist nicht möglich.',0), 25072 => array('Du hast mit SetAutoMax() einen Maximalwert angegeben, der kleiner ist als der Minimalwert der Achse. Dies ist nicht möglich.',0),
25073 => array('Interner Fehler. Der Integer-Skalierungs-Algorithmus-Vergleich ist außerhalb der Grenzen (r=%f).',1), 25073 => array('Interner Fehler. Der Integer-Skalierungs-Algorithmus-Vergleich ist außerhalb der Grenzen (r=%f).',1),
25074 => array('Interner Fehler. Der Skalierungsbereich ist negativ (%f) [für %s Achse]. Dieses Problem könnte verursacht werden durch den Versuch, \'ungültige\' Werte in die Daten-Vektoren einzugeben (z.B. nur String- oder NULL-Werte), was beim automatischen Skalieren einen Fehler erzeugt.',2), 25074 => array('Interner Fehler. Der Skalierungsbereich ist negativ (%f) [für %s Achse]. Dieses Problem könnte verursacht werden durch den Versuch, \'ungültige\' Werte in die Daten-Vektoren einzugeben (z.B. nur String- oder NULL-Werte), was beim automatischen Skalieren einen Fehler erzeugt.',2),
25075 => array('Die automatischen Ticks können nicht gesetzt werden, weil min==max.',0), 25075 => array('Die automatischen Ticks können nicht gesetzt werden, weil min==max.',0),
25077 => array('Einstellfaktor für die Farbe muss größer sein als 0',0), 25077 => array('Einstellfaktor für die Farbe muss größer sein als 0',0),
25078 => array('Unbekannte Farbe: %s',1), 25078 => array('Unbekannte Farbe: %s',1),
25079 => array('Unbekannte Farbdefinition: %s, Größe=%d',2), 25079 => array('Unbekannte Farbdefinition: %s, Größe=%d',2),
25080 => array('Der Alpha-Parameter für Farben muss zwischen 0.0 und 1.0 liegen.',0), 25080 => array('Der Alpha-Parameter für Farben muss zwischen 0.0 und 1.0 liegen.',0),
25081 => array('Das ausgewählte Grafikformat wird entweder nicht unterstützt oder ist unbekannt [%s]',1), 25081 => array('Das ausgewählte Grafikformat wird entweder nicht unterstützt oder ist unbekannt [%s]',1),
25082 => array('Es wurden ungültige Größen für Breite und Höhe beim Erstellen des Bildes definiert (Breite=%d, Höhe=%d).',2), 25082 => array('Es wurden ungültige Größen für Breite und Höhe beim Erstellen des Bildes definiert (Breite=%d, Höhe=%d).',2),
25083 => array('Es wurde eine ungültige Größe beim Kopieren des Bildes angegeben. Die Größe für das kopierte Bild wurde auf 1 Pixel oder weniger gesetzt.',0), 25083 => array('Es wurde eine ungültige Größe beim Kopieren des Bildes angegeben. Die Größe für das kopierte Bild wurde auf 1 Pixel oder weniger gesetzt.',0),
25084 => array('Fehler beim Erstellen eines temporären GD-Canvas. Möglicherweise liegt ein Arbeitsspeicherproblem vor.',0), 25084 => array('Fehler beim Erstellen eines temporären GD-Canvas. Möglicherweise liegt ein Arbeitsspeicherproblem vor.',0),
25085 => array('Ein Bild kann nicht aus dem angegebenen String erzeugt werden. Er ist entweder in einem nicht unterstützen Format oder er represäntiert ein kaputtes Bild.',0), 25085 => array('Ein Bild kann nicht aus dem angegebenen String erzeugt werden. Er ist entweder in einem nicht unterstützen Format oder er represäntiert ein kaputtes Bild.',0),
25086 => array('Du scheinst nur GD 1.x installiert zu haben. Um Alphablending zu aktivieren, ist GD 2.x oder höher notwendig. Bitte installiere GD 2.x oder versichere Dich, dass die Konstante USE_GD2 richtig gesetzt ist. Standardmäßig wird die installierte GD-Version automatisch erkannt. Ganz selten wird GD2 erkannt, obwohl nur GD1 installiert ist. Die Konstante USE_GD2 muss dann zu "false" gesetzt werden.',0), 25086 => array('Du scheinst nur GD 1.x installiert zu haben. Um Alphablending zu aktivieren, ist GD 2.x oder höher notwendig. Bitte installiere GD 2.x oder versichere Dich, dass die Konstante USE_GD2 richtig gesetzt ist. Standardmäßig wird die installierte GD-Version automatisch erkannt. Ganz selten wird GD2 erkannt, obwohl nur GD1 installiert ist. Die Konstante USE_GD2 muss dann zu "false" gesetzt werden.',0),
25087 => array('Diese PHP-Version wurde ohne TTF-Unterstützung konfiguriert. PHP muss mit TTF-Unterstützung neu kompiliert und installiert werden.',0), 25087 => array('Diese PHP-Version wurde ohne TTF-Unterstützung konfiguriert. PHP muss mit TTF-Unterstützung neu kompiliert und installiert werden.',0),
25088 => array('Die GD-Schriftunterstützung wurde falsch konfiguriert. Der Aufruf von imagefontwidth() ist fehlerhaft.',0), 25088 => array('Die GD-Schriftunterstützung wurde falsch konfiguriert. Der Aufruf von imagefontwidth() ist fehlerhaft.',0),
25089 => array('Die GD-Schriftunterstützung wurde falsch konfiguriert. Der Aufruf von imagefontheight() ist fehlerhaft.',0), 25089 => array('Die GD-Schriftunterstützung wurde falsch konfiguriert. Der Aufruf von imagefontheight() ist fehlerhaft.',0),
25090 => array('Unbekannte Richtung angegeben im Aufruf von StrokeBoxedText() [%s].',1), 25090 => array('Unbekannte Richtung angegeben im Aufruf von StrokeBoxedText() [%s].',1),
25091 => array('Die interne Schrift untestützt das Schreiben von Text in einem beliebigen Winkel nicht. Benutze stattdessen TTF-Schriften.',0), 25091 => array('Die interne Schrift untestützt das Schreiben von Text in einem beliebigen Winkel nicht. Benutze stattdessen TTF-Schriften.',0),
25092 => array('Es liegt entweder ein Konfigurationsproblem mit TrueType oder ein Problem beim Lesen der Schriftdatei "%s" vor. Versichere Dich, dass die Datei existiert und Leserechte und -pfad vergeben sind. (wenn \'basedir\' restriction in PHP aktiviert ist, muss die Schriftdatei im Dokumentwurzelverzeichnis abgelegt werden). Möglicherweise ist die FreeType-Bibliothek falsch installiert. Versuche, mindestens zur FreeType-Version 2.1.13 zu aktualisieren und kompiliere GD mit einem korrekten Setup neu, damit die FreeType-Bibliothek gefunden werden kann.',1), 25092 => array('Es liegt entweder ein Konfigurationsproblem mit TrueType oder ein Problem beim Lesen der Schriftdatei "%s" vor. Versichere Dich, dass die Datei existiert und Leserechte und -pfad vergeben sind. (wenn \'basedir\' restriction in PHP aktiviert ist, muss die Schriftdatei im Dokumentwurzelverzeichnis abgelegt werden). Möglicherweise ist die FreeType-Bibliothek falsch installiert. Versuche, mindestens zur FreeType-Version 2.1.13 zu aktualisieren und kompiliere GD mit einem korrekten Setup neu, damit die FreeType-Bibliothek gefunden werden kann.',1),
25093 => array('Die Schriftdatei "%s" kann nicht gelesen werden beim Aufruf von Image::GetBBoxTTF. Bitte versichere Dich, dass die Schrift gesetzt wurde, bevor diese Methode aufgerufen wird, und dass die Schrift im TTF-Verzeichnis installiert ist.',1), 25093 => array('Die Schriftdatei "%s" kann nicht gelesen werden beim Aufruf von Image::GetBBoxTTF. Bitte versichere Dich, dass die Schrift gesetzt wurde, bevor diese Methode aufgerufen wird, und dass die Schrift im TTF-Verzeichnis installiert ist.',1),
25094 => array('Die Textrichtung muss in einem Winkel zwischen 0 und 90 engegeben werden.',0), 25094 => array('Die Textrichtung muss in einem Winkel zwischen 0 und 90 engegeben werden.',0),
25095 => array('Unbekannte Schriftfamilien-Definition. ',0), 25095 => array('Unbekannte Schriftfamilien-Definition. ',0),
25096 => array('Der Farbpalette können keine weiteren Farben zugewiesen werden. Dem Bild wurde bereits die größtmögliche Anzahl von Farben (%d) zugewiesen und die Palette ist voll. Verwende stattdessen ein TrueColor-Bild',0), 25096 => array('Der Farbpalette können keine weiteren Farben zugewiesen werden. Dem Bild wurde bereits die größtmögliche Anzahl von Farben (%d) zugewiesen und die Palette ist voll. Verwende stattdessen ein TrueColor-Bild',0),
25097 => array('Eine Farbe wurde als leerer String im Aufruf von PushColor() angegegeben.',0), 25097 => array('Eine Farbe wurde als leerer String im Aufruf von PushColor() angegegeben.',0),
25098 => array('Negativer Farbindex. Unpassender Aufruf von PopColor().',0), 25098 => array('Negativer Farbindex. Unpassender Aufruf von PopColor().',0),
25099 => array('Die Parameter für Helligkeit und Kontrast sind außerhalb des zulässigen Bereichs [-1,1]',0), 25099 => array('Die Parameter für Helligkeit und Kontrast sind außerhalb des zulässigen Bereichs [-1,1]',0),
25100 => array('Es liegt ein Problem mit der Farbpalette und dem GD-Setup vor. Bitte deaktiviere anti-aliasing oder verwende GD2 mit TrueColor. Wenn die GD2-Bibliothek installiert ist, versichere Dich, dass die Konstante USE_GD2 auf "true" gesetzt und TrueColor aktiviert ist.',0), 25100 => array('Es liegt ein Problem mit der Farbpalette und dem GD-Setup vor. Bitte deaktiviere anti-aliasing oder verwende GD2 mit TrueColor. Wenn die GD2-Bibliothek installiert ist, versichere Dich, dass die Konstante USE_GD2 auf "true" gesetzt und TrueColor aktiviert ist.',0),
25101 => array('Ungültiges numerisches Argument für SetLineStyle(): (%d)',1), 25101 => array('Ungültiges numerisches Argument für SetLineStyle(): (%d)',1),
25102 => array('Ungültiges String-Argument für SetLineStyle(): %s',1), 25102 => array('Ungültiges String-Argument für SetLineStyle(): %s',1),
25103 => array('Ungültiges Argument für SetLineStyle %s',1), 25103 => array('Ungültiges Argument für SetLineStyle %s',1),
25104 => array('Unbekannter Linientyp: %s',1), 25104 => array('Unbekannter Linientyp: %s',1),
25105 => array('Es wurden NULL-Daten für ein gefülltes Polygon angegeben. Sorge dafür, dass keine NULL-Daten angegeben werden.',0), 25105 => array('Es wurden NULL-Daten für ein gefülltes Polygon angegeben. Sorge dafür, dass keine NULL-Daten angegeben werden.',0),
25106 => array('Image::FillToBorder : es können keine weiteren Farben zugewiesen werden.',0), 25106 => array('Image::FillToBorder : es können keine weiteren Farben zugewiesen werden.',0),
25107 => array('In Datei "%s" kann nicht geschrieben werden. Überprüfe die aktuellen Schreibrechte.',1), 25107 => array('In Datei "%s" kann nicht geschrieben werden. Überprüfe die aktuellen Schreibrechte.',1),
25108 => array('Das Bild kann nicht gestreamt werden. Möglicherweise liegt ein Fehler im PHP/GD-Setup vor. Kompiliere PHP neu und verwende die eingebaute GD-Bibliothek, die mit PHP angeboten wird.',0), 25108 => array('Das Bild kann nicht gestreamt werden. Möglicherweise liegt ein Fehler im PHP/GD-Setup vor. Kompiliere PHP neu und verwende die eingebaute GD-Bibliothek, die mit PHP angeboten wird.',0),
25109 => array('Deine PHP- (und GD-lib-) Installation scheint keine bekannten Grafikformate zu unterstützen. Sorge zunächst dafür, dass GD als PHP-Modul kompiliert ist. Wenn Du außerdem JPEG-Bilder verwenden willst, musst Du die JPEG-Bibliothek installieren. Weitere Details sind in der PHP-Dokumentation zu finden.',0), 25109 => array('Deine PHP- (und GD-lib-) Installation scheint keine bekannten Grafikformate zu unterstützen. Sorge zunächst dafür, dass GD als PHP-Modul kompiliert ist. Wenn Du außerdem JPEG-Bilder verwenden willst, musst Du die JPEG-Bibliothek installieren. Weitere Details sind in der PHP-Dokumentation zu finden.',0),
25110 => array('Dein PHP-Installation unterstützt das gewählte Grafikformat nicht: %s',1), 25110 => array('Dein PHP-Installation unterstützt das gewählte Grafikformat nicht: %s',1),
25111 => array('Das gecachete Bild %s kann nicht gelöscht werden. Problem mit den Rechten?',1), 25111 => array('Das gecachete Bild %s kann nicht gelöscht werden. Problem mit den Rechten?',1),
25112 => array('Das Datum der gecacheten Datei (%s) liegt in der Zukunft.',1), 25112 => array('Das Datum der gecacheten Datei (%s) liegt in der Zukunft.',1),
25113 => array('Das gecachete Bild %s kann nicht gelöscht werden. Problem mit den Rechten?',1), 25113 => array('Das gecachete Bild %s kann nicht gelöscht werden. Problem mit den Rechten?',1),
25114 => array('PHP hat nicht die erforderlichen Rechte, um in die Cache-Datei %s zu schreiben. Bitte versichere Dich, dass der Benutzer, der PHP anwendet, die entsprechenden Schreibrechte für die Datei hat, wenn Du das Cache-System in JPGraph verwenden willst.',1), 25114 => array('PHP hat nicht die erforderlichen Rechte, um in die Cache-Datei %s zu schreiben. Bitte versichere Dich, dass der Benutzer, der PHP anwendet, die entsprechenden Schreibrechte für die Datei hat, wenn Du das Cache-System in JPGraph verwenden willst.',1),
25115 => array('Berechtigung für gecachetes Bild %s kann nicht gesetzt werden. Problem mit den Rechten?',1), 25115 => array('Berechtigung für gecachetes Bild %s kann nicht gesetzt werden. Problem mit den Rechten?',1),
25116 => array('Datei kann nicht aus dem Cache %s geöffnet werden',1), 25116 => array('Datei kann nicht aus dem Cache %s geöffnet werden',1),
25117 => array('Gecachetes Bild %s kann nicht zum Lesen geöffnet werden.',1), 25117 => array('Gecachetes Bild %s kann nicht zum Lesen geöffnet werden.',1),
25118 => array('Verzeichnis %s kann nicht angelegt werden. Versichere Dich, dass PHP die Schreibrechte in diesem Verzeichnis hat.',1), 25118 => array('Verzeichnis %s kann nicht angelegt werden. Versichere Dich, dass PHP die Schreibrechte in diesem Verzeichnis hat.',1),
25119 => array('Rechte für Datei %s können nicht gesetzt werden. Problem mit den Rechten?',1), 25119 => array('Rechte für Datei %s können nicht gesetzt werden. Problem mit den Rechten?',1),
25120 => array('Die Position für die Legende muss als Prozentwert im Bereich 0-1 angegeben werden.',0), 25120 => array('Die Position für die Legende muss als Prozentwert im Bereich 0-1 angegeben werden.',0),
25121 => array('Eine leerer Datenvektor wurde für den Plot eingegeben. Es muss wenigstens ein Datenpunkt vorliegen.',0), 25121 => array('Eine leerer Datenvektor wurde für den Plot eingegeben. Es muss wenigstens ein Datenpunkt vorliegen.',0),
25122 => array('Stroke() muss als Subklasse der Klasse Plot definiert sein.',0), 25122 => array('Stroke() muss als Subklasse der Klasse Plot definiert sein.',0),
25123 => array('Du kannst keine Text-X-Achse mit X-Koordinaten verwenden. Benutze stattdessen eine "int" oder "lin" Achse.',0), 25123 => array('Du kannst keine Text-X-Achse mit X-Koordinaten verwenden. Benutze stattdessen eine "int" oder "lin" Achse.',0),
25124 => array('Der Eingabedatenvektor mus aufeinanderfolgende Werte von 0 aufwärts beinhalten. Der angegebene Y-Vektor beginnt mit leeren Werten (NULL).',0), 25124 => array('Der Eingabedatenvektor mus aufeinanderfolgende Werte von 0 aufwärts beinhalten. Der angegebene Y-Vektor beginnt mit leeren Werten (NULL).',0),
25125 => array('Ungültige Richtung für statische Linie.',0), 25125 => array('Ungültige Richtung für statische Linie.',0),
25126 => array('Es kann kein TrueColor-Bild erzeugt werden. Überprüfe, ob die GD2-Bibliothek und PHP korrekt aufgesetzt wurden.',0), 25126 => array('Es kann kein TrueColor-Bild erzeugt werden. Überprüfe, ob die GD2-Bibliothek und PHP korrekt aufgesetzt wurden.',0),
25127 => array('The library has been configured for automatic encoding conversion of Japanese fonts. This requires that PHP has the mb_convert_encoding() function. Your PHP installation lacks this function (PHP needs the "--enable-mbstring" when compiled).',0), 25127 => array('The library has been configured for automatic encoding conversion of Japanese fonts. This requires that PHP has the mb_convert_encoding() function. Your PHP installation lacks this function (PHP needs the "--enable-mbstring" when compiled).',0),
25128 => array('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.',0), 25128 => array('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.',0),
25129 => array('Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.',0), 25129 => array('Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.',0),
25130 => array('Too small plot area. (%d x %d). With the given image size and margins there is to little space left for the plot. Increase the plot size or reduce the margins.',2),
25131 => array('StrokeBoxedText2() only supports TTF fonts and not built-in bitmap fonts.',0),
25132 => array('Undefined property %s.',1), // @todo translate
25133 => array('Use Graph::SetTheme() after Graph::SetScale().',0), // @todo translate
/*
** jpgraph_led
*/
25500 => array('Multibyte strings must be enabled in the PHP installation in order to run the LED module so that the function mb_strlen() is available. See PHP documentation for more information.',0),
/* /*
**--------------------------------------------------------------------------------------------- **---------------------------------------------------------------------------------------------
** Pro-version strings ** Pro-version strings
@ -409,19 +426,19 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
** jpgraph_table ** jpgraph_table
*/ */
27001 => array('GTextTable: Ungültiges Argument für Set(). Das Array-Argument muss 2-- dimensional sein.',0), 27001 => array('GTextTable: Ungültiges Argument für Set(). Das Array-Argument muss 2-- dimensional sein.',0),
27002 => array('GTextTable: Ungültiges Argument für Set()',0), 27002 => array('GTextTable: Ungültiges Argument für Set()',0),
27003 => array('GTextTable: Falsche Anzahl von Argumenten für GTextTable::SetColor()',0), 27003 => array('GTextTable: Falsche Anzahl von Argumenten für GTextTable::SetColor()',0),
27004 => array('GTextTable: Angegebener Zellenbereich, der verschmolzen werden soll, ist ungültig.',0), 27004 => array('GTextTable: Angegebener Zellenbereich, der verschmolzen werden soll, ist ungültig.',0),
27005 => array('GTextTable: Bereits verschmolzene Zellen im Bereich (%d,%d) bis (%d,%d) können nicht ein weiteres Mal verschmolzen werden.',4), 27005 => array('GTextTable: Bereits verschmolzene Zellen im Bereich (%d,%d) bis (%d,%d) können nicht ein weiteres Mal verschmolzen werden.',4),
27006 => array('GTextTable: Spalten-Argument = %d liegt außerhalb der festgelegten Tabellengröße.',1), 27006 => array('GTextTable: Spalten-Argument = %d liegt außerhalb der festgelegten Tabellengröße.',1),
27007 => array('GTextTable: Zeilen-Argument = %d liegt außerhalb der festgelegten Tabellengröße.',1), 27007 => array('GTextTable: Zeilen-Argument = %d liegt außerhalb der festgelegten Tabellengröße.',1),
27008 => array('GTextTable: Spalten- und Zeilengröße müssen zu den Dimensionen der Tabelle passen.',0), 27008 => array('GTextTable: Spalten- und Zeilengröße müssen zu den Dimensionen der Tabelle passen.',0),
27009 => array('GTextTable: Die Anzahl der Tabellenspalten oder -zeilen ist 0. Versichere Dich, dass die Methoden Init() oder Set() aufgerufen werden.',0), 27009 => array('GTextTable: Die Anzahl der Tabellenspalten oder -zeilen ist 0. Versichere Dich, dass die Methoden Init() oder Set() aufgerufen werden.',0),
27010 => array('GTextTable: Es wurde keine Ausrichtung beim Aufruf von SetAlign() angegeben.',0), 27010 => array('GTextTable: Es wurde keine Ausrichtung beim Aufruf von SetAlign() angegeben.',0),
27011 => array('GTextTable: Es wurde eine unbekannte Ausrichtung beim Aufruf von SetAlign() abgegeben. Horizontal=%s, Vertikal=%s',2), 27011 => array('GTextTable: Es wurde eine unbekannte Ausrichtung beim Aufruf von SetAlign() abgegeben. Horizontal=%s, Vertikal=%s',2),
27012 => array('GTextTable: Interner Fehler. Es wurde ein ungültiges Argument festgeleget %s',1), 27012 => array('GTextTable: Interner Fehler. Es wurde ein ungültiges Argument festgeleget %s',1),
27013 => array('GTextTable: Das Argument für FormatNumber() muss ein String sein.',0), 27013 => array('GTextTable: Das Argument für FormatNumber() muss ein String sein.',0),
27014 => array('GTextTable: Die Tabelle wurde weder mit einem Aufruf von Set() noch von Init() initialisiert.',0), 27014 => array('GTextTable: Die Tabelle wurde weder mit einem Aufruf von Set() noch von Init() initialisiert.',0),
27015 => array('GTextTable: Der Zellenbildbedingungstyp muss entweder TIMG_WIDTH oder TIMG_HEIGHT sein.',0), 27015 => array('GTextTable: Der Zellenbildbedingungstyp muss entweder TIMG_WIDTH oder TIMG_HEIGHT sein.',0),
@ -429,25 +446,25 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
** jpgraph_windrose ** jpgraph_windrose
*/ */
22001 => array('Die Gesamtsumme der prozentualen Anteile aller Windrosenarme darf 100%% nicht überschreiten!\n(Aktuell max: %d)',1), 22001 => array('Die Gesamtsumme der prozentualen Anteile aller Windrosenarme darf 100%% nicht überschreiten!\n(Aktuell max: %d)',1),
22002 => array('Das Bild ist zu klein für eine Skala. Bitte vergrößere das Bild.',0), 22002 => array('Das Bild ist zu klein für eine Skala. Bitte vergrößere das Bild.',0),
22004 => array('Die Etikettendefinition für Windrosenrichtungen müssen 16 Werte haben (eine für jede Kompassrichtung).',0), 22004 => array('Die Etikettendefinition für Windrosenrichtungen müssen 16 Werte haben (eine für jede Kompassrichtung).',0),
22005 => array('Der Linientyp für radiale Linien muss einer von ("solid","dotted","dashed","longdashed") sein.',0), 22005 => array('Der Linientyp für radiale Linien muss einer von ("solid","dotted","dashed","longdashed") sein.',0),
22006 => array('Es wurde ein ungültiger Windrosentyp angegeben.',0), 22006 => array('Es wurde ein ungültiger Windrosentyp angegeben.',0),
22007 => array('Es wurden zu wenig Werte für die Bereichslegende angegeben.',0), 22007 => array('Es wurden zu wenig Werte für die Bereichslegende angegeben.',0),
22008 => array('Interner Fehler: Versuch, eine freie Windrose zu plotten, obwohl der Typ keine freie Windrose ist.',0), 22008 => array('Interner Fehler: Versuch, eine freie Windrose zu plotten, obwohl der Typ keine freie Windrose ist.',0),
22009 => array('Du hast die gleiche Richtung zweimal angegeben, einmal mit einem Winkel und einmal mit einer Kompassrichtung (%f Grad).',0), 22009 => array('Du hast die gleiche Richtung zweimal angegeben, einmal mit einem Winkel und einmal mit einer Kompassrichtung (%f Grad).',0),
22010 => array('Die Richtung muss entweder ein numerischer Wert sein oder eine der 16 Kompassrichtungen',0), 22010 => array('Die Richtung muss entweder ein numerischer Wert sein oder eine der 16 Kompassrichtungen',0),
22011 => array('Der Windrosenindex muss ein numerischer oder Richtungswert sein. Du hast angegeben Index=%d',1), 22011 => array('Der Windrosenindex muss ein numerischer oder Richtungswert sein. Du hast angegeben Index=%d',1),
22012 => array('Die radiale Achsendefinition für die Windrose enthält eine nicht aktivierte Richtung.',0), 22012 => array('Die radiale Achsendefinition für die Windrose enthält eine nicht aktivierte Richtung.',0),
22013 => array('Du hast dasselbe Look&Feel für die gleiche Kompassrichtung zweimal engegeben, einmal mit Text und einmal mit einem Index (Index=%d)',1), 22013 => array('Du hast dasselbe Look&Feel für die gleiche Kompassrichtung zweimal engegeben, einmal mit Text und einmal mit einem Index (Index=%d)',1),
22014 => array('Der Index für eine Kompassrichtung muss zwischen 0 und 15 sein.',0), 22014 => array('Der Index für eine Kompassrichtung muss zwischen 0 und 15 sein.',0),
22015 => array('Du hast einen unbekannten Windrosenplottyp angegeben.',0), 22015 => array('Du hast einen unbekannten Windrosenplottyp angegeben.',0),
22016 => array('Der Windrosenarmindex muss ein numerischer oder ein Richtungswert sein.',0), 22016 => array('Der Windrosenarmindex muss ein numerischer oder ein Richtungswert sein.',0),
22017 => array('Die Windrosendaten enthalten eine Richtung, die nicht aktiviert ist. Bitte berichtige, welche Label angezeigt werden sollen.',0), 22017 => array('Die Windrosendaten enthalten eine Richtung, die nicht aktiviert ist. Bitte berichtige, welche Label angezeigt werden sollen.',0),
22018 => array('Du hast für dieselbe Kompassrichtung zweimal Daten angegeben, einmal mit Text und einmal mit einem Index (Index=%d)',1), 22018 => array('Du hast für dieselbe Kompassrichtung zweimal Daten angegeben, einmal mit Text und einmal mit einem Index (Index=%d)',1),
22019 => array('Der Index für eine Richtung muss zwischen 0 und 15 sein. Winkel dürfen nicht für einen regelmäßigen Windplot angegeben werden, sondern entweder ein Index oder eine Kompassrichtung.',0), 22019 => array('Der Index für eine Richtung muss zwischen 0 und 15 sein. Winkel dürfen nicht für einen regelmäßigen Windplot angegeben werden, sondern entweder ein Index oder eine Kompassrichtung.',0),
22020 => array('Der Windrosenplot ist zu groß für die angegebene Bildgröße. Benutze entweder WindrosePlot::SetSize(), um den Plot kleiner zu machen oder vergrößere das Bild im ursprünglichen Aufruf von WindroseGraph().',0), 22020 => array('Der Windrosenplot ist zu groß für die angegebene Bildgröße. Benutze entweder WindrosePlot::SetSize(), um den Plot kleiner zu machen oder vergrößere das Bild im ursprünglichen Aufruf von WindroseGraph().',0),
22021 => array('It is only possible to add Text, IconPlot or WindrosePlot to a Windrose Graph',0), 22021 => array('It is only possible to add Text, IconPlot or WindrosePlot to a Windrose Graph',0),
/* /*
@ -455,7 +472,7 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
*/ */
13001 => array('Unbekannter Nadeltypstil (%d).',1), 13001 => array('Unbekannter Nadeltypstil (%d).',1),
13002 => array('Ein Wert für das Odometer (%f) ist außerhalb des angegebenen Bereichs [%f,%f]',3), 13002 => array('Ein Wert für das Odometer (%f) ist außerhalb des angegebenen Bereichs [%f,%f]',3),
/* /*
** jpgraph_barcode ** jpgraph_barcode
@ -463,36 +480,71 @@ HTTP header wurden bereits gesendet.<br>Fehler in der Datei <b>%s</b> in der Zei
1001 => array('Unbekannte Kodier-Specifikation: %s',1), 1001 => array('Unbekannte Kodier-Specifikation: %s',1),
1002 => array('datenvalidierung schlug fehl. [%s] kann nicht mittels der Kodierung "%s" kodiert werden',2), 1002 => array('datenvalidierung schlug fehl. [%s] kann nicht mittels der Kodierung "%s" kodiert werden',2),
1003 => array('Interner Kodierfehler. Kodieren von %s ist nicht möglich in Code 128',1), 1003 => array('Interner Kodierfehler. Kodieren von %s ist nicht möglich in Code 128',1),
1004 => array('Interner barcode Fehler. Unbekannter UPC-E Kodiertyp: %s',1), 1004 => array('Interner barcode Fehler. Unbekannter UPC-E Kodiertyp: %s',1),
1005 => array('Interner Fehler. Das Textzeichen-Tupel (%s, %s) kann nicht im Code-128 Zeichensatz C kodiert werden.',2), 1005 => array('Interner Fehler. Das Textzeichen-Tupel (%s, %s) kann nicht im Code-128 Zeichensatz C kodiert werden.',2),
1006 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, CTRL in CHARSET != A zu kodieren.',0), 1006 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, CTRL in CHARSET != A zu kodieren.',0),
1007 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, DEL in CHARSET != B zu kodieren.',0), 1007 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, DEL in CHARSET != B zu kodieren.',0),
1008 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, kleine Buchstaben in CHARSET != B zu kodieren.',0), 1008 => array('Interner Kodierfehler für CODE 128. Es wurde versucht, kleine Buchstaben in CHARSET != B zu kodieren.',0),
1009 => array('Kodieren mittels CODE 93 wird noch nicht unterstützt.',0), 1009 => array('Kodieren mittels CODE 93 wird noch nicht unterstützt.',0),
1010 => array('Kodieren mittels POSTNET wird noch nicht unterstützt.',0), 1010 => array('Kodieren mittels POSTNET wird noch nicht unterstützt.',0),
1011 => array('Nicht untrstütztes Barcode-Backend für den Typ %s',1), 1011 => array('Nicht untrstütztes Barcode-Backend für den Typ %s',1),
/* /*
** PDF417 ** PDF417
*/ */
26000 => array('PDF417: The PDF417 module requires that the PHP installation must support the function bcmod(). This is normally enabled at compile time. See documentation for more information.',0),
26001 => array('PDF417: Die Anzahl der Spalten muss zwischen 1 und 30 sein.',0), 26001 => array('PDF417: Die Anzahl der Spalten muss zwischen 1 und 30 sein.',0),
26002 => array('PDF417: Der Fehler-Level muss zwischen 0 und 8 sein.',0), 26002 => array('PDF417: Der Fehler-Level muss zwischen 0 und 8 sein.',0),
26003 => array('PDF417: Ungültiges Format für Eingabedaten, um sie mit PDF417 zu kodieren.',0), 26003 => array('PDF417: Ungültiges Format für Eingabedaten, um sie mit PDF417 zu kodieren.',0),
26004 => array('PDF417: die eigebenen Daten können nicht mit Fehler-Level %d und %d spalten kodiert werden, weil daraus zu viele Symbole oder mehr als 90 Zeilen resultieren.',2), 26004 => array('PDF417: die eigebenen Daten können nicht mit Fehler-Level %d und %d spalten kodiert werden, weil daraus zu viele Symbole oder mehr als 90 Zeilen resultieren.',2),
26005 => array('PDF417: Die Datei "%s" kann nicht zum Schreiben geöffnet werden.',1), 26005 => array('PDF417: Die Datei "%s" kann nicht zum Schreiben geöffnet werden.',1),
26006 => array('PDF417: Interner Fehler. Die Eingabedatendatei für PDF417-Cluster %d ist fehlerhaft.',1), 26006 => array('PDF417: Interner Fehler. Die Eingabedatendatei für PDF417-Cluster %d ist fehlerhaft.',1),
26007 => array('PDF417: Interner Fehler. GetPattern: Ungültiger Code-Wert %d (Zeile %d)',2), 26007 => array('PDF417: Interner Fehler. GetPattern: Ungültiger Code-Wert %d (Zeile %d)',2),
26008 => array('PDF417: Interner Fehler. Modus wurde nicht in der Modusliste!! Modus %d',1), 26008 => array('PDF417: Interner Fehler. Modus wurde nicht in der Modusliste!! Modus %d',1),
26009 => array('PDF417: Kodierfehler: Ungültiges Zeichen. Zeichen kann nicht mit ASCII-Code %d kodiert werden.',1), 26009 => array('PDF417: Kodierfehler: Ungültiges Zeichen. Zeichen kann nicht mit ASCII-Code %d kodiert werden.',1),
26010 => array('PDF417: Interner Fehler: Keine Eingabedaten beim Dekodieren.',0), 26010 => array('PDF417: Interner Fehler: Keine Eingabedaten beim Dekodieren.',0),
26011 => array('PDF417: Kodierfehler. Numerisches Kodieren bei nicht-numerischen Daten nicht möglich.',0), 26011 => array('PDF417: Kodierfehler. Numerisches Kodieren bei nicht-numerischen Daten nicht möglich.',0),
26012 => array('PDF417: Interner Fehler. Es wurden für den Binary-Kompressor keine Daten zum Dekodieren eingegeben.',0), 26012 => array('PDF417: Interner Fehler. Es wurden für den Binary-Kompressor keine Daten zum Dekodieren eingegeben.',0),
26013 => array('PDF417: Interner Fehler. Checksum Fehler. Koeffiziententabellen sind fehlerhaft.',0), 26013 => array('PDF417: Interner Fehler. Checksum Fehler. Koeffiziententabellen sind fehlerhaft.',0),
26014 => array('PDF417: Interner Fehler. Es wurden keine Daten zum Berechnen von Kodewörtern eingegeben.',0), 26014 => array('PDF417: Interner Fehler. Es wurden keine Daten zum Berechnen von Kodewörtern eingegeben.',0),
26015 => array('PDF417: Interner Fehler. Ein Eintrag 0 in die Statusübertragungstabellen ist nicht NULL. Eintrag 1 = (%s)',1), 26015 => array('PDF417: Interner Fehler. Ein Eintrag 0 in die Statusübertragungstabellen ist nicht NULL. Eintrag 1 = (%s)',1),
26016 => array('PDF417: Interner Fehler: Nichtregistrierter Statusübertragungsmodus beim Dekodieren.',0), 26016 => array('PDF417: Interner Fehler: Nichtregistrierter Statusübertragungsmodus beim Dekodieren.',0),
/*
** jpgraph_contour
*/
28001 => array('Dritten parameter fur Contour muss ein vector der fargen sind.',0),
28002 => array('Die anzahlen der farges jeder isobar linien muss gleich sein.',0),
28003 => array('ContourPlot Interner Fehler: isobarHCrossing: Spalten index ist zu hoch (%d)',1),
28004 => array('ContourPlot Interner Fehler: isobarHCrossing: Reihe index ist zu hoch (%d)',1),
28005 => array('ContourPlot Interner Fehler: isobarVCrossing: Reihe index ist zu hoch (%d)',1),
28006 => array('ContourPlot Interner Fehler: isobarVCrossing: Spalten index ist zu hoch (%d)',1),
28007 => array('ContourPlot. Interpolation faktor ist zu hoch (>5)',0),
/*
* jpgraph_matrix and colormap
*/
29201 => array('Min range value must be less or equal to max range value for colormaps',0),
29202 => array('The distance between min and max value is too small for numerical precision',0),
29203 => array('Number of color quantification level must be at least %d',1),
29204 => array('Number of colors (%d) is invalid for this colormap. It must be a number that can be written as: %d + k*%d',3),
29205 => array('Colormap specification out of range. Must be an integer in range [0,%d]',1),
29206 => array('Invalid object added to MatrixGraph',0),
29207 => array('Empty input data specified for MatrixPlot',0),
29208 => array('Unknown side specifiction for matrix labels "%s"',1),
29209 => array('CSIM Target matrix must be the same size as the data matrix (csim=%d x %d, data=%d x %d)',4),
29210 => array('CSIM Target for matrix labels does not match the number of labels (csim=%d, labels=%d)',2),
/*
* jpgraph_theme
*/
30001 => array("Theme::%s() is not defined. \nPlease make %s(\$graph) function in your theme classs.",2),
); );

View file

@ -3,9 +3,9 @@
// File: EN.INC.PHP // File: EN.INC.PHP
// Description: English language file for error messages // Description: English language file for error messages
// Created: 2006-01-25 // Created: 2006-01-25
// Ver: $Id: en.inc.php 993 2008-03-30 21:17:41Z ljp $ // Ver: $Id: en.inc.php 1886 2009-10-01 23:30:16Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -44,6 +44,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
2012 => array('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects. (Class=%s)',1), 2012 => array('One of the objects submitted to AccBar is not a BarPlot. Make sure that you create the AccBar plot from an array of BarPlot objects. (Class=%s)',1),
2013 => array('You have specified an empty array for shadow colors in the bar plot.',0), 2013 => array('You have specified an empty array for shadow colors in the bar plot.',0),
2014 => array('Number of datapoints for each data set in accbarplot must be the same',0), 2014 => array('Number of datapoints for each data set in accbarplot must be the same',0),
2015 => array('Individual bar plots in an AccBarPlot or GroupBarPlot can not have specified X-coordinates',0),
/* /*
@ -101,6 +102,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
6030 => array('Unknown arrow direction for link.',0), 6030 => array('Unknown arrow direction for link.',0),
6031 => array('Unknown arrow type for link.',0), 6031 => array('Unknown arrow type for link.',0),
6032 => array('Internal error: Unknown path type (=%d) specified for link.',1), 6032 => array('Internal error: Unknown path type (=%d) specified for link.',1),
6033 => array('Array of fonts must contain arrays with 3 elements, i.e. (Family, Style, Size)',0),
/* /*
** jpgraph_gradient ** jpgraph_gradient
@ -185,6 +187,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
15009 => array('Illegal pie plot. Sum of all data is zero for Pie Plot',0), 15009 => array('Illegal pie plot. Sum of all data is zero for Pie Plot',0),
15010 => array('Sum of all data is 0 for Pie.',0), 15010 => array('Sum of all data is 0 for Pie.',0),
15011 => array('In order to use image transformation you must include the file jpgraph_imgtrans.php in your script.',0), 15011 => array('In order to use image transformation you must include the file jpgraph_imgtrans.php in your script.',0),
15012 => array('PiePlot::SetTheme() is no longer supported. Use PieGraph::SetTheme()',0),
/* /*
** jpgraph_plotband ** jpgraph_plotband
@ -255,6 +258,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
24001 => array('FuncGenerator : No function specified. ',0), 24001 => array('FuncGenerator : No function specified. ',0),
24002 => array('FuncGenerator : Syntax error in function specification ',0), 24002 => array('FuncGenerator : Syntax error in function specification ',0),
24003 => array('DateScaleUtils: Unknown tick type specified in call to GetTicks()',0), 24003 => array('DateScaleUtils: Unknown tick type specified in call to GetTicks()',0),
24004 => array('ReadCSV2: Column count mismatch in %s line %d',2),
/* /*
** jpgraph ** jpgraph
*/ */
@ -398,7 +402,17 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
25127 => array('The library has been configured for automatic encoding conversion of Japanese fonts. This requires that PHP has the mb_convert_encoding() function. Your PHP installation lacks this function (PHP needs the "--enable-mbstring" when compiled).',0), 25127 => array('The library has been configured for automatic encoding conversion of Japanese fonts. This requires that PHP has the mb_convert_encoding() function. Your PHP installation lacks this function (PHP needs the "--enable-mbstring" when compiled).',0),
25128 => array('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.',0), 25128 => array('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.',0),
25129 => array('Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.',0), 25129 => array('Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.',0),
25130 => array('Too small plot area. (%d x %d). With the given image size and margins there is to little space left for the plot. Increase the plot size or reduce the margins.',2),
25131 => array('StrokeBoxedText2() only supports TTF fonts and not built-in bitmap fonts.',0),
25132 => array('Undefined property %s.',1),
25133 => array('Use Graph::SetTheme() after Graph::SetScale().',0),
/*
** jpgraph_led
*/
25500 => array('Multibyte strings must be enabled in the PHP installation in order to run the LED module so that the function mb_strlen() is available. See PHP documentation for more information.',0),
/* /*
**--------------------------------------------------------------------------------------------- **---------------------------------------------------------------------------------------------
@ -476,7 +490,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
/* /*
** PDF417 ** PDF417
*/ */
26000 => array('PDF417: The PDF417 module requires that the PHP installation must support the function bcmod(). This is normally enabled at compile time. See documentation for more information.',0),
26001 => array('PDF417: Number of Columns must be >= 1 and <= 30',0), 26001 => array('PDF417: Number of Columns must be >= 1 and <= 30',0),
26002 => array('PDF417: Error level must be between 0 and 8',0), 26002 => array('PDF417: Error level must be between 0 and 8',0),
26003 => array('PDF417: Invalid format for input data to encode with PDF417',0), 26003 => array('PDF417: Invalid format for input data to encode with PDF417',0),
@ -494,5 +508,36 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
26015 => array('PDF417: Internal error. State transition table entry 0 is NULL. Entry 1 = (%s)',1), 26015 => array('PDF417: Internal error. State transition table entry 0 is NULL. Entry 1 = (%s)',1),
26016 => array('PDF417: Internal error: Unrecognized state transition mode in decode.',0), 26016 => array('PDF417: Internal error: Unrecognized state transition mode in decode.',0),
/*
** jpgraph_contour
*/
28001 => array('Third argument to Contour must be an array of colors.',0),
28002 => array('Number of colors must equal the number of isobar lines specified',0),
28003 => array('ContourPlot Internal Error: isobarHCrossing: Coloumn index too large (%d)',1),
28004 => array('ContourPlot Internal Error: isobarHCrossing: Row index too large (%d)',1),
28005 => array('ContourPlot Internal Error: isobarVCrossing: Row index too large (%d)',1),
28006 => array('ContourPlot Internal Error: isobarVCrossing: Col index too large (%d)',1),
28007 => array('ContourPlot interpolation factor is too large (>5)',0),
/*
* jpgraph_matrix and colormap
*/
29201 => array('Min range value must be less or equal to max range value for colormaps',0),
29202 => array('The distance between min and max value is too small for numerical precision',0),
29203 => array('Number of color quantification level must be at least %d',1),
29204 => array('Number of colors (%d) is invalid for this colormap. It must be a number that can be written as: %d + k*%d',3),
29205 => array('Colormap specification out of range. Must be an integer in range [0,%d]',1),
29206 => array('Invalid object added to MatrixGraph',0),
29207 => array('Empty input data specified for MatrixPlot',0),
29208 => array('Unknown side specifiction for matrix labels "%s"',1),
29209 => array('CSIM Target matrix must be the same size as the data matrix (csim=%d x %d, data=%d x %d)',4),
29210 => array('CSIM Target for matrix labels does not match the number of labels (csim=%d, labels=%d)',2),
/*
* jpgraph_theme
*/
30001 => array("Theme::%s() is not defined. \nPlease make %s(\$graph) function in your theme classs.",2),
); );

View file

@ -4,9 +4,9 @@
// Description: Special localization file with the same error messages // Description: Special localization file with the same error messages
// for all errors. // for all errors.
// Created: 2006-02-18 // Created: 2006-02-18
// Ver: $Id: prod.inc.php 993 2008-03-30 21:17:41Z ljp $ // Ver: $Id: prod.inc.php 1886 2009-10-01 23:30:16Z ljp $
// //
// Copyright (c) Aditus Consulting. All rights reserved. // Copyright (c) Asial Corporation. All rights reserved.
//======================================================================== //========================================================================
*/ */
@ -75,6 +75,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
6030 => array(DEFAULT_ERROR_MESSAGE.'6030',0), 6030 => array(DEFAULT_ERROR_MESSAGE.'6030',0),
6031 => array(DEFAULT_ERROR_MESSAGE.'6031',0), 6031 => array(DEFAULT_ERROR_MESSAGE.'6031',0),
6032 => array(DEFAULT_ERROR_MESSAGE.'6032',0), 6032 => array(DEFAULT_ERROR_MESSAGE.'6032',0),
6033 => array(DEFAULT_ERROR_MESSAGE.'6033',0),
7001 => array(DEFAULT_ERROR_MESSAGE.'7001',0), 7001 => array(DEFAULT_ERROR_MESSAGE.'7001',0),
8001 => array(DEFAULT_ERROR_MESSAGE.'8001',0), 8001 => array(DEFAULT_ERROR_MESSAGE.'8001',0),
8002 => array(DEFAULT_ERROR_MESSAGE.'8002',0), 8002 => array(DEFAULT_ERROR_MESSAGE.'8002',0),
@ -119,6 +120,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
15009 => array(DEFAULT_ERROR_MESSAGE.'15009',0), 15009 => array(DEFAULT_ERROR_MESSAGE.'15009',0),
15010 => array(DEFAULT_ERROR_MESSAGE.'15010',0), 15010 => array(DEFAULT_ERROR_MESSAGE.'15010',0),
15011 => array(DEFAULT_ERROR_MESSAGE.'15011',0), 15011 => array(DEFAULT_ERROR_MESSAGE.'15011',0),
15012 => array(DEFAULT_ERROR_MESSAGE.'15012',0),
16001 => array(DEFAULT_ERROR_MESSAGE.'16001',0), 16001 => array(DEFAULT_ERROR_MESSAGE.'16001',0),
16002 => array(DEFAULT_ERROR_MESSAGE.'16002',0), 16002 => array(DEFAULT_ERROR_MESSAGE.'16002',0),
16003 => array(DEFAULT_ERROR_MESSAGE.'16003',0), 16003 => array(DEFAULT_ERROR_MESSAGE.'16003',0),
@ -147,6 +149,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
24001 => array(DEFAULT_ERROR_MESSAGE.'24001',0), 24001 => array(DEFAULT_ERROR_MESSAGE.'24001',0),
24002 => array(DEFAULT_ERROR_MESSAGE.'24002',0), 24002 => array(DEFAULT_ERROR_MESSAGE.'24002',0),
24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0), 24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0),
24004 => array(DEFAULT_ERROR_MESSAGE.'24004',0),
25001 => array(DEFAULT_ERROR_MESSAGE.'25001',0), 25001 => array(DEFAULT_ERROR_MESSAGE.'25001',0),
25002 => array(DEFAULT_ERROR_MESSAGE.'25002',0), 25002 => array(DEFAULT_ERROR_MESSAGE.'25002',0),
25003 => array(DEFAULT_ERROR_MESSAGE.'25003',0), 25003 => array(DEFAULT_ERROR_MESSAGE.'25003',0),
@ -275,6 +278,11 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
25127 => array(DEFAULT_ERROR_MESSAGE.'25127',0), 25127 => array(DEFAULT_ERROR_MESSAGE.'25127',0),
25128 => array(DEFAULT_ERROR_MESSAGE.'25128',0), 25128 => array(DEFAULT_ERROR_MESSAGE.'25128',0),
25129 => array(DEFAULT_ERROR_MESSAGE.'25129',0), 25129 => array(DEFAULT_ERROR_MESSAGE.'25129',0),
25130 => array(DEFAULT_ERROR_MESSAGE.'25130',0),
25131 => array(DEFAULT_ERROR_MESSAGE.'25131',0),
25132 => array(DEFAULT_ERROR_MESSAGE.'25132',0),
25133 => array(DEFAULT_ERROR_MESSAGE.'25133',0),
25500 => array(DEFAULT_ERROR_MESSAGE.'25500',0),
24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0), 24003 => array(DEFAULT_ERROR_MESSAGE.'24003',0),
24004 => array(DEFAULT_ERROR_MESSAGE.'24004',0), 24004 => array(DEFAULT_ERROR_MESSAGE.'24004',0),
24005 => array(DEFAULT_ERROR_MESSAGE.'24005',0), 24005 => array(DEFAULT_ERROR_MESSAGE.'24005',0),
@ -320,6 +328,7 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
1009 => array(DEFAULT_ERROR_MESSAGE.'1009',0), 1009 => array(DEFAULT_ERROR_MESSAGE.'1009',0),
1010 => array(DEFAULT_ERROR_MESSAGE.'1010',0), 1010 => array(DEFAULT_ERROR_MESSAGE.'1010',0),
1011 => array(DEFAULT_ERROR_MESSAGE.'1011',0), 1011 => array(DEFAULT_ERROR_MESSAGE.'1011',0),
26000 => array(DEFAULT_ERROR_MESSAGE.'26000',0),
26001 => array(DEFAULT_ERROR_MESSAGE.'26001',0), 26001 => array(DEFAULT_ERROR_MESSAGE.'26001',0),
26002 => array(DEFAULT_ERROR_MESSAGE.'26002',0), 26002 => array(DEFAULT_ERROR_MESSAGE.'26002',0),
26003 => array(DEFAULT_ERROR_MESSAGE.'26003',0), 26003 => array(DEFAULT_ERROR_MESSAGE.'26003',0),
@ -352,4 +361,24 @@ HTTP headers have already been sent.<br>Caused by output from file <b>%s</b> at
27013 => array(DEFAULT_ERROR_MESSAGE.'27013',0), 27013 => array(DEFAULT_ERROR_MESSAGE.'27013',0),
27014 => array(DEFAULT_ERROR_MESSAGE.'27014',0), 27014 => array(DEFAULT_ERROR_MESSAGE.'27014',0),
27015 => array(DEFAULT_ERROR_MESSAGE.'27015',0), 27015 => array(DEFAULT_ERROR_MESSAGE.'27015',0),
28001 => array(DEFAULT_ERROR_MESSAGE.'28001',0),
28002 => array(DEFAULT_ERROR_MESSAGE.'28002',0),
28003 => array(DEFAULT_ERROR_MESSAGE.'28003',0),
28004 => array(DEFAULT_ERROR_MESSAGE.'28004',0),
28005 => array(DEFAULT_ERROR_MESSAGE.'28005',0),
28006 => array(DEFAULT_ERROR_MESSAGE.'28006',0),
28007 => array(DEFAULT_ERROR_MESSAGE.'28007',0),
29201 => array(DEFAULT_ERROR_MESSAGE.'28001',0),
29202 => array(DEFAULT_ERROR_MESSAGE.'28002',0),
29203 => array(DEFAULT_ERROR_MESSAGE.'28003',0),
29204 => array(DEFAULT_ERROR_MESSAGE.'28004',0),
29205 => array(DEFAULT_ERROR_MESSAGE.'28005',0),
29206 => array(DEFAULT_ERROR_MESSAGE.'28006',0),
29207 => array(DEFAULT_ERROR_MESSAGE.'28007',0),
29208 => array(DEFAULT_ERROR_MESSAGE.'28008',0),
29209 => array(DEFAULT_ERROR_MESSAGE.'28009',0),
29210 => array(DEFAULT_ERROR_MESSAGE.'28010',0),
); );

View file

@ -0,0 +1,201 @@
<?php
/**
* Aqua Theme class
*/
class AquaTheme extends Theme
{
protected $font_color = '#0044CC';
protected $background_color = '#DDFFFF';
protected $axis_color = '#0066CC';
protected $grid_color = '#3366CC';
public function GetColorList()
{
return array(
'#183152',
'#C4D7ED',
'#375D81',
'#ABC8E2',
'#E1E6FA',
'#9BBAB2',
'#3B4259',
'#0063BC',
'#1D5A73',
'#ABABFF',
'#27ADC5',
'#EDFFCC',
/*
'#66FFFF',
'#00AABB',
'#00FFCC',
'#33CCFF',
'#008866',
'#99FFFF',
'#0099FF',
'#99FFCC',
'#3399FF',
'#2277FF',
'#445588',
'#003388',
'#338877',
'#55DDFF',
'#00FF99',
'#BBBBBB',
'#77AAFF',
'#00FFCC',
*/
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(4);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
//$plot->SetShadow();
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor());
$plot->SetWeight(2);
// $plot->SetBarCenter();
break;
}
case 'PiePlot':
{
$plot->SetCenter(0.5, 0.45);
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,182 @@
<?php
/**
* Green Theme class
*/
class GreenTheme extends Theme
{
private $font_color = '#009900';
private $background_color = '#EEFFDD';
private $axis_color = '#00CC00';
private $grid_color = '#33CC33';
public function GetColorList()
{
return array(
'#66CC00',
'#009900',
'#AAFF77',
'#559922',
'#00CC33',
'#99FF00',
'#009966',
'#00FF99',
'#99BB66',
'#33FF00',
'#DDFFBB',
'#669933',
'#BBDDCC',
'#77CCBB',
'#668833',
'#BBEE66',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
/*
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
*/
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
break;
}
case 'PiePlot':
{
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,184 @@
<?php
/**
* Ocean Theme class
*/
class OceanTheme extends Theme
{
protected $font_color = '#0066FF';
private $background_color = '#DDEEFF';
private $axis_color = '#0000CC';
private $grid_color = '#3333CC';
public function GetColorList()
{
return array(
'#0066FF',
'#CCCCFF',
'#0000FF',
'#3366FF',
'#33CCFF',
'#660088',
'#3300FF',
'#0099FF',
'#6633FF',
'#0055EE',
'#2277EE',
'#3300FF',
'#AA00EE',
'#778899',
'#114499',
'#7744EE',
'#002288',
'#6666FF',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
/*
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
*/
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor());
$plot->SetWeight(2);
break;
}
case 'PiePlot':
{
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,184 @@
<?php
/**
* Orange Theme class
*/
class OrangeTheme extends Theme
{
private $font_color = '#CC4400';
private $background_color = '#FFEEDD';
private $axis_color = '#CC6600';
private $grid_color = '#CC6633';
public function GetColorList()
{
return array(
'#FF9900',
'#FFCC00',
'#AA6600',
'#CCCC00',
'#CC6600',
'#FFFF66',
'#CCFF00',
'#CC3300',
'#669933',
'#EE7700',
'#AAEE33',
'#77AA00',
'#CCFF99',
'#FF6633',
'#885500',
'#AADD00',
'#99CC44',
'#887711',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
/*
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
*/
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
break;
}
case 'PiePlot':
{
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,179 @@
<?php
/**
* Pastel Theme class
*/
class PastelTheme extends Theme
{
private $font_color = '#0044CC';
private $background_color = '#DDFFFF';
private $axis_color = '#0066CC';
private $grid_color = '#3366CC';
public function GetColorList()
{
return array(
'#FFAACC',
'#AAEECC',
'#AACCFF',
'#CCAAFF',
'#EEDDFF',
'#FFCCAA',
'#CCBBDD',
'#CCFFAA',
'#C7D7C2',
'#FFEEDD',
'#FFCCEE',
'#BFECFA',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(4);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
// $plot->SetBarCenter();
break;
}
case 'PiePlot':
{
$plot->SetCenter(0.5, 0.45);
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,184 @@
<?php
/**
* Rose Theme class
*/
class RoseTheme extends Theme
{
private $font_color = '#CC0044';
private $background_color = '#FFDDDD';
private $axis_color = '#CC0000';
private $grid_color = '#CC3333';
public function GetColorList()
{
return array(
'#FF0000',
'#FF99FF',
'#AA0099',
'#FF00FF',
'#FF6666',
'#FF0099',
'#FFBB88',
'#AA2211',
'#FF6699',
'#BBAA88',
'#FF2200',
'#883333',
'#EE7777',
'#EE7711',
'#FF0066',
'#DD7711',
'#AA6600',
'#EE5500',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
/*
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
*/
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
break;
}
case 'PiePlot':
{
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,213 @@
<?php
/**
* Softy Theme class
*/
class SoftyTheme extends Theme
{
protected $font_color = '#000000';
protected $background_color = '#F7F8F4';
protected $axis_color = '#000000';
protected $grid_color = '#CCCCCC';
public function GetColorList()
{
return array(
'#CFE7FB',
'#F9D76F',
'#B9D566',
'#FFBB90',
'#66BBBB',
'#E69090',
'#BB90BB',
'#9AB67C',
'#D1CC66',
/*
'#AFD8F8',
'#F6BD0F',
'#8BBA00',
'#FF8E46',
'#008E8E',
'#D64646',
'#8E468E',
'#588526',
'#B3AA00',
'#008ED6',
'#9D080D',
'#A186BE',
*/
);
}
public function SetupGraph($graph)
{
// graph
$graph->SetFrame(false);
$graph->SetMarginColor('white');
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// y2~
if (isset($graph->y2axis)) {
$graph->y2axis->title->SetColor($this->font_color);
$graph->y2axis->SetColor($this->axis_color, $this->font_color);
$graph->y2axis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetLabelMargin(8);
$graph->y2axis->HideLine();
$graph->y2axis->HideTicks();
}
// yn
if (isset($graph->y2axis)) {
foreach ($graph->ynaxis as $axis) {
$axis->title->SetColor($this->font_color);
$axis->SetColor($this->axis_color, $this->font_color);
$axis->SetTickSide(SIDE_LEFT);
$axis->SetLabelMargin(8);
$axis->HideLine();
$axis->HideTicks();
}
}
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
$graph->ygrid->SetFill(true, '#FFFFFF', $this->background_color);
$graph->xgrid->Show();
$graph->xgrid->SetColor($this->grid_color);
$graph->xgrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
$plot->value->SetAlign('center', 'center');
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor());
$plot->SetWeight(2);
// $plot->SetBarCenter();
break;
}
case 'PiePlot':
{
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
$plot->value->SetAlign('center', 'center');
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
$_plot->SetValuePos('center');
}
break;
}
case 'ScatterPlot':
{
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,187 @@
<?php
/**
* Universal Theme class
*/
class UniversalTheme extends Theme
{
private $font_color = '#444444';
private $background_color = '#F4F4F4';
private $axis_color = '#888888';
private $grid_color = '#E3E3E3';
public function GetColorList()
{
return array(
'#61a9f3',#blue
'#f381b9',#red
'#61E3A9',#green
#'#D56DE2',
'#85eD82',
'#F7b7b7',
'#CFDF49',
'#88d8f2',
'#07AF7B',
'#B9E3F9',
'#FFF3AD',
'#EF606A',
'#EC8833',
'#FFF100',
'#87C9A5',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBox(true, '#DADADA');
// $graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
$graph->xaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
//$graph->xaxis->SetLabelMargin(30);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
// $graph->yaxis->SetTickPositions(array(50, 100, 150));
// $graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetFill(true, '#FFFFFF', $this->background_color);
// $graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(4);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
break;
}
case 'PiePlot':
{
$plot->SetCenter(0.5, 0.45);
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}

View file

@ -0,0 +1,179 @@
<?php
/**
* Vivid Theme class
*/
class VividTheme extends Theme
{
private $font_color = '#0044CC';
private $background_color = '#DDFFFF';
private $axis_color = '#0066CC';
private $grid_color = '#3366CC';
public function GetColorList()
{
return array(
'#FFFB11',
'#005EBC',
'#9AEB67',
'#FF4A26',
'#FDFF98',
'#6B7EFF',
'#BCE02E',
'#E0642E',
'#E0D62E',
'#2E97E0',
'#02927F',
'#FF005A',
);
}
public function SetupGraph($graph)
{
// graph
/*
$img = $graph->img;
$height = $img->height;
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
*/
$graph->SetFrame(false);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// legend
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
$graph->legend->SetFillColor('white');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(3);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// xaxis
$graph->xaxis->title->SetColor($this->font_color);
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
$graph->xaxis->SetLabelMargin(10);
// yaxis
$graph->yaxis->title->SetColor($this->font_color);
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->yaxis->SetLabelMargin(8);
$graph->yaxis->HideLine();
$graph->yaxis->HideTicks();
$graph->xaxis->SetTitleMargin(15);
// grid
$graph->ygrid->SetColor($this->grid_color);
$graph->ygrid->SetLineStyle('dotted');
// font
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
// $graph->img->SetAntiAliasing();
}
public function SetupPieGraph($graph)
{
// graph
$graph->SetFrame(false);
// legend
$graph->legend->SetFillColor('white');
$graph->legend->SetFrameWeight(0);
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(4);
$graph->legend->SetShadow(false);
$graph->legend->SetMarkAbsSize(5);
// title
$graph->title->SetColor($this->font_color);
$graph->subtitle->SetColor($this->font_color);
$graph->subsubtitle->SetColor($this->font_color);
$graph->SetAntiAliasing();
}
public function PreStrokeApply($graph)
{
if ($graph->legend->HasItems()) {
$img = $graph->img;
$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
);
}
}
public function ApplyPlot($plot)
{
switch (get_class($plot)) {
case 'GroupBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'AccBarPlot':
{
foreach ($plot->plots as $_plot) {
$this->ApplyPlot($_plot);
}
break;
}
case 'BarPlot':
{
$plot->Clear();
$color = $this->GetNextColor();
$plot->SetColor($color);
$plot->SetFillColor($color);
$plot->SetShadow('red', 3, 4, false);
break;
}
case 'LinePlot':
{
$plot->Clear();
$plot->SetColor($this->GetNextColor().'@0.4');
$plot->SetWeight(2);
// $plot->SetBarCenter();
break;
}
case 'PiePlot':
{
$plot->SetCenter(0.5, 0.45);
$plot->ShowBorder(false);
$plot->SetSliceColors($this->GetThemeColors());
break;
}
case 'PiePlot3D':
{
$plot->SetSliceColors($this->GetThemeColors());
break;
}
default:
{
}
}
}
}