Initial commit

This commit is contained in:
2026-09-03 11:24:19 +02:00
commit 6ed3153f36
1897 changed files with 538007 additions and 0 deletions
+129
View File
@@ -0,0 +1,129 @@
<?php
/*=========================================================================*/
/* Name: ClipCircle.php */
/* Uses: Draw a circle clipped within boundaries */
/* Date: 1/1/2008 */
/* Author: Andrew Que (http://www.DrQue.net/) */
/* Revisions: */
/* 1.0 - 1/1/2008 - QUE - Creatuib */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* X/Y trend with linear regression script */
/* Copyright (C) 2008 Andrew Que */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* (C) Copyright 2008 */
/* Andrew Que */
/* ð|> */
/*=========================================================================*/
/**
* Clip circle
*
* Contains a function to draw a circle clipped within boundaries
* @package XY_Plot
* @author Andrew Que ({@link http://www.DrQue.net/})
* @copyright Copyright (c) 2008, Andrew Que
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* Draw a circle with clipping
*
* <p>
* Draw a filled circle and do not allow it to extend byond a defined set of
* boundaries.
* <p>
* This isn't the most efficent implementation, so don't use when speed is
* essential
* @param $Image Image to draw circle onto
* @param $CenterX X-coordinate of center of circle
* @param $CenterY Y-coordinate of center of circle
* @param $Diameter Diameter of circle
* @param $Color Color of circle
* @param $ClipLeft Left boundary
* @param $ClipTop Top boundary
* @param $ClipRight Right boundary
* @param $ClipBottom Bottom doundary
*/
function ClippedFilledCircle(
$Image ,
$CenterX ,
$CenterY ,
$Diameter ,
$Color ,
$ClipLeft = null ,
$ClipTop = null ,
$ClipRight = null ,
$ClipBottom = null )
{
$Radius = $Diameter / 2.0;
$Count = round( -$Radius );
while ( $Count <= $Radius )
{
$y = $CenterY + $Count;
$yy = $CenterY + $Count;
$Delta = ( $Radius * $Radius ) - ( $Count * $Count );
++$Count;
if ( $Delta < 0 )
continue;
$Delta = sqrt( $Delta );
$x = ceil( $CenterX - $Delta );
$xx = floor( $CenterX + $Delta );
// Above the top margin?
if ( ( $ClipTop !== null )
&& ( $y < $ClipTop ) )
continue;
// Below the bottm margin?
if ( ( $ClipBottom !== null )
&& ( $yy > $ClipBottom ) )
continue;
// Byond left margin?
if ( ( $ClipLeft !== null )
&& ( $x < $ClipLeft ) )
$x = $ClipLeft;
// Byond right margin?
if ( ( $ClipRight !== null )
&& ( $xx > $ClipRight ) )
$xx = $ClipRight;
// Off the chat?
if ( ( $ClipLeft !== null )
&& ( $xx < $ClipLeft ) )
continue;
if ( ( $ClipLeft !== null )
&& ( $x > $ClipRight ) )
continue;
// Draw line
ImageLine( $Image , $x , $y , $xx , $y , $Color );
}
}
?>
+977
View File
@@ -0,0 +1,977 @@
<?php
/*=========================================================================*/
/* Name: ClipLine.php */
/* Uses: Used for clipping a line in a define square */
/* Date: 12/7/2007 */
/* Authors: */
/* Andrew Que (http://www.DrQue.net/) */
/* References: */
/* This unit was constructed mostly from an example in Wikipedia, which */
/* had the following credit: */
/* "Mark S. Sobkow, Paul Pospisil and Yee-Hong Yang. A Fast Two- */
/* Dimensional Line Clipping Algorithm via Line Encoding//Computer & */
/* Graphics, Vol. 11, No. 4, pp. 459-467, 1987." */
/* The port to PHP was done by Andrew Que */
/* Revisions: */
/* 1.0 - 12/7/2007 - QUE - Creation */
/* 1.1 - 12/31/2007 - QUE - Clipping for complete out-of-bounds */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* Line clipping function */
/* Copyright (C) 2007 Andrew Que */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* (C) Copyright 2007 */
/* Andrew Que */
/* ð|> */
/*=========================================================================*/
/**
* Used for clipping a line in a define square
*
* <p>
* This unit was constructed mostly from an example in Wikipedia, which
* had the following credit:
* <p>
* "Mark S. Sobkow, Paul Pospisil and Yee-Hong Yang. A Fast Two-
* Dimensional Line Clipping Algorithm via Line Encoding//Computer &
* Graphics, Vol. 11, No. 4, pp. 459-467, 1987."
* <p>
* The port to PHP was done by Andrew Que
*
* @package XY_Plot
* @author Andrew Que ({@link http://www.DrQue.net/})
* @copyright Copyright (c) 2007, Andrew Que
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* Implementation of the Fast-Clipping algorithm.
*
* This is a class, but acts more like a function. The reason
* implementation is done this way is because of the sub-functions that
* need access to the local variables.
*/
class ClipLine
{
/**#@+ @ignore */
public $x;
public $y;
public $xx;
public $yy;
public $X_Min;
public $Y_Min;
public $X_Max;
public $Y_Max;
/**#@-*/
/**
* Constructor
* @param x Left corner of line
* @param y Top corner of line
* @param xx Right corner of line
* @param yy Bottom corner of line
* @param X_Min Left edge of frame
* @param Y_Min Top edge of frame
* @param X_Max Right edge of frame
* @param Y_Max Bottom edge of frame
*/
public function __construct
(
&$x , &$y , &$xx , &$yy ,
$X_Min , $Y_Min , $X_Max , $Y_Max
)
{
// Set local variables
$this->x = &$x;
$this->y = &$y;
$this->xx = &$xx;
$this->yy = &$yy;
$this->X_Min = &$X_Min;
$this->Y_Min = &$Y_Min;
$this->X_Max = &$X_Max;
$this->Y_Max = &$Y_Max;
// Clip the line
$this->Clip();
}
//------------------------------------------------------
// Clipping function
// (There is one clipping function for each of the 8 areas)
//------------------------------------------------------
/**
* Start top
*/
private function clipStartTop()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->x += $DeltaX * ( $this->Y_Min - $this->y ) / $DeltaY;
$this->y = $this->Y_Min;
}
/**
* Start bottom
*/
private function clipStartBottom()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->x += $DeltaX * ( $this->Y_Max - $this->y ) / $DeltaY;
$this->y = $this->Y_Max;
}
/**
* Start right
*/
private function clipStartRight()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->y += $DeltaY * ( $this->X_Max - $this->x ) / $DeltaX;
$this->x = $this->X_Max;
}
/**
* Start left
*/
private function clipStartLeft()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->y += $DeltaY * ( $this->X_Min - $this->x ) / $DeltaX;
$this->x = $this->X_Min;
}
/**
* End top
*/
private function clipEndTop()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->xx += $DeltaX * ( $this->Y_Min - $this->yy ) / $DeltaY;
$this->yy = $this->Y_Min;
}
/**
* End bottom
*/
private function clipEndBottom()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->xx += $DeltaX * ( $this->Y_Max - $this->yy ) / $DeltaY;
$this->yy = $this->Y_Max;
}
/**
* End right
*/
private function clipEndRight()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->yy += $DeltaY * ( $this->X_Max - $this->xx ) / $DeltaX;
$this->xx = $this->X_Max;
}
/**
* End Left
*/
private function clipEndLeft()
{
$DeltaX = $this->xx - $this->x;
$DeltaY = $this->yy - $this->y;
$this->yy += $DeltaY * ( $this->X_Min - $this->xx ) / $DeltaX;
$this->xx = $this->X_Min;
}
/**
* Main body of clipping function
*
* This function does all the clipping work
*/
private function Clip()
{
$LineCode = 0;
// Figure out which sides clip
if ( $this->y < $this->Y_Min )
$LineCode |= 0x80; // BIT8
else
if ( $this->y > $this->Y_Max )
$LineCode |= 0x40; // BIT7
if ( $this->x > $this->X_Max )
$LineCode |= 0x20; // BIT6
else
if ( $this->x < $this->X_Min )
$LineCode |= 0x10; // BIT5
if ( $this->yy < $this->Y_Min )
$LineCode |= 0x08; // BIT4
else
if ( $this->yy > $this->Y_Max )
$LineCode |= 0x04; // BIT3
if ( $this->xx > $this->X_Max )
$LineCode |= 0x02; // BIT2
else
if ( $this->xx < $this->X_Min )
$LineCode |= 0x01; // BIT1
// Completely out of bounds? (i.e. not visible on screen)
if ( ( ( $LineCode & ( 0x80 | 0x08 ) ) == ( 0x80 | 0x08 ) )
|| ( ( $LineCode & ( 0x40 | 0x04 ) ) == ( 0x40 | 0x04 ) )
|| ( ( $LineCode & ( 0x20 | 0x02 ) ) == ( 0x20 | 0x02 ) )
|| ( ( $LineCode & ( 0x10 | 0x01 ) ) == ( 0x10 | 0x01 ) ) )
{
$this->x = $this->y = $this->xx = $this->yy = 0;
return;
}
// 9 - 8 - A
// | | |
// 1 - 0 - 2
// | | |
// 5 - 4 - 6
switch ( $LineCode )
{
//------------------------------
// Center
//------------------------------
case 0x00:
{
// Line is perfect, no clipping needed
break;
}
case 0x01:
{
$this->clipEndLeft();
break;
}
case 0x02:
{
$this->clipEndRight();
break;
}
case 0x04:
{
$this->clipEndBottom();
break;
}
case 0x05:
{
$this->clipEndLeft();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
case 0x06:
{
$this->clipEndRight();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
case 0x08:
{
$this->clipEndTop();
break;
}
case 0x09:
{
$this->clipEndLeft();
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
break;
}
case 0x0A:
{
$this->clipEndRight();
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
break;
}
//------------------------------
// Left
//------------------------------
case 0x10:
{
$this->clipStartLeft();
break;
}
case 0x12:
{
$this->clipStartLeft();
$this->clipEndRight();
break;
}
case 0x14:
{
$this->clipStartLeft();
if ( $this->y > $this->Y_Max )
break;
$this->clipEndBottom();
break;
}
case 0x16:
{
$this->clipStartLeft();
if ( $this->y > $this->Y_Max )
break;
$this->clipEndBottom();
if ( $this->xx > $this->X_Max )
$this->clipEndRight();
break;
}
case 0x18:
{
$this->clipStartLeft();
if ( $this->y < $this->Y_Min )
break;
$this->clipEndTop();
break;
}
case 0x1A:
{
$this->clipStartLeft();
if ( $this->y < $this->Y_Min )
break;
$this->clipEndTop();
if ( $this->xx > $this->X_Max )
$this->clipEndRight();
break;
}
//------------------------------
// Right
//------------------------------
case 0x20:
{
$this->clipStartRight();
break;
}
case 0x21:
{
$this->clipStartRight();
$this->clipEndLeft();
break;
}
case 0x24:
{
$this->clipStartRight();
if ( $this->y > $this->Y_Max )
break;
$this->clipEndBottom();
break;
}
case 0x25:
{
$this->clipStartRight();
if ( $this->y > $this->Y_Max )
break;
$this->clipEndBottom();
if ( $this->xx < $this->X_Min )
$this->clipEndLeft();
break;
}
case 0x28:
{
$this->clipStartRight();
if ( $this->y < $this->Y_Min )
break;
$this->clipEndTop();
break;
}
case 0x29:
{
$this->clipStartRight();
if ( $this->y < $this->Y_Min )
break;
$this->clipEndTop();
if ( $this->xx < $this->X_Min )
$this->clipEndLeft();
break;
}
//------------------------------
// Bottom
//------------------------------
case 0x40:
{
$this->clipStartBottom();
break;
}
case 0x41:
{
$this->clipStartBottom();
if ( $this->x < $this->X_Min )
break;
$this->clipEndLeft();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
case 0x42:
{
$this->clipStartBottom();
if ( $this->x > $this->X_Max )
break;
$this->clipEndRight();
break;
}
case 0x48:
{
$this->clipStartBottom();
$this->clipEndTop();
break;
}
case 0x49:
{
$this->clipStartBottom();
if ( $this->x < $this->X_Min )
break;
$this->clipEndLeft();
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
break;
}
case 0x4A:
{
$this->clipStartBottom();
if ( $this->x > $this->X_Max )
break;
$this->clipEndRight();
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
break;
}
//------------------------------
// Bottom-left
//------------------------------
case 0x50:
{
$this->clipStartLeft();
if ( $this->y > $this->Y_Max )
$this->clipStartBottom();
break;
}
case 0x52:
{
$this->clipEndRight();
if ( $this->yy > $this->Y_Max )
break;
$this->clipStartBottom();
if ( $this->x < $this->X_Min )
$this->clipStartLeft();
break;
}
case 0x58:
{
$this->clipEndTop();
if ( $this->xx < $this->X_Min )
break;
$this->clipStartBottom();
if ( $this->x < $this->X_Min )
$this->clipStartLeft();
break;
}
case 0x5A:
{
$this->clipStartLeft();
if ( $this->y < $this->Y_Min )
break;
$this->clipEndRight();
if ( $this->yy > $this->Y_Max )
break;
if ( $this->y > $this->Y_Max )
$this->clipStartBottom();
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
break;
}
//------------------------------
// Bottom-right
//------------------------------
case 0x60:
{
$this->clipStartRight();
if ( $this->y > $this->Y_Max )
$this->clipStartBottom();
break;
}
case 0x61:
{
$this->clipEndLeft();
if ( $this->yy > $this->Y_Max )
break;
$this->clipStartBottom();
if ( $this->x > $this->X_Max )
$this->clipStartRight();
break;
}
case 0x68:
{
$this->clipEndTop();
if ( $this->xx > $this->X_Max )
break;
$this->clipStartRight();
if ( $this->y > $this->Y_Max )
$this->clipStartBottom();
break;
}
case 0x69:
{
$this->clipEndLeft();
if ( $this->yy > $this->Y_Max )
break;
$this->clipStartRight();
if ( $this->y < $this->Y_Min )
break;
if ( $this->yy < $this->Y_Min )
$this->clipEndTop();
if ( $this->y > $this->Y_Max )
$this->clipStartBottom();
break;
}
//------------------------------
// Top
//------------------------------
case 0x80:
{
$this->clipStartTop();
break;
}
case 0x81:
{
$this->clipStartTop();
if ( $this->x < $this->X_Min )
break;
$this->clipEndLeft();
break;
}
case 0x82:
{
$this->clipStartTop();
if ( $this->x > $this->X_Max )
break;
$this->clipEndRight();
break;
}
case 0x84:
{
$this->clipStartTop();
$this->clipEndBottom();
break;
}
case 0x85:
{
$this->clipStartTop();
if ( $this->x < $this->X_Min )
break;
$this->clipEndLeft();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
case 0x86:
{
$this->clipStartTop();
if ( $this->x > $this->X_Max )
break;
$this->clipEndRight();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
//------------------------------
// Top-left
//------------------------------
case 0x90:
{
$this->clipStartLeft();
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
break;
}
case 0x92:
{
$this->clipEndRight();
if ( $this->yy < $this->Y_Min )
break;
$this->clipStartTop();
if ( $this->x < $this->X_Min )
$this->clipStartLeft();
break;
}
case 0x94:
{
$this->clipEndBottom();
if ( $this->xx < $this->X_Min )
break;
$this->clipStartLeft();
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
break;
}
case 0x96:
{
$this->clipStartLeft();
if ( $this->y > $this->Y_Max )
break;
$this->clipEndRight();
if ( $this->yy < $this->Y_Min )
break;
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
break;
}
//------------------------------
// Top-right
//------------------------------
case 0xA0:
{
$this->clipStartRight();
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
break;
}
case 0xA1:
{
$this->clipEndLeft();
if ( $this->yy < $this->Y_Min )
break;
$this->clipStartTop();
if ( $this->x > $this->X_Max )
$this->clipStartRight();
break;
}
case 0xA4:
{
$this->clipEndBottom();
if ( $this->xx > $this->X_Max )
break;
$this->clipStartRight();
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
break;
}
case 0xA5:
{
$this->clipEndLeft();
if ( $this->yy < $this->Y_Min )
break;
$this->clipStartRight();
if ( $this->y > $this->Y_Max )
break;
if ( $this->yy > $this->Y_Max )
$this->clipEndBottom();
if ( $this->y < $this->Y_Min )
$this->clipStartTop();
break;
}
}
// Round result
$this->x = round( $this->x );
$this->y = round( $this->y );
$this->xx = round( $this->xx );
$this->yy = round( $this->yy );
}
}
/**
* Clip line
*
* <p>
* This will take the corners of a line segment and clip them in a define
* area.
* <p>
* Examples of use:
* <code>
* $x = 5;
* $y = 8;
* $xx = 70;
* $yy = 65;
* ClipLine(
* $x , $y , $xx , $yy ,
* 10 , 10 , 50 , 50 );
* </code>
* <p>
* In this example, the values in <var>$x</var>, <var>$y</var>,
* <var>$xx</var>, <var>$yy</var> will be adjusted so they are within
* the (10,10) (50,50) window.
* @param x Left corner of line
* @param y Top corner of line
* @param xx Right corner of line
* @param yy Bottom corner of line
* @param X_Min Left edge of frame
* @param Y_Min Top edge of frame
* @param X_Max Right edge of frame
* @param Y_Max Bottom edge of frame
* @return x, y, xx, yy are all modified (if necessary)
*/
function ClipLine(
&$x , &$y , &$xx , &$yy ,
$X_Min , $Y_Min , $X_Max , $Y_Max )
{
// All of the work is done simply by creating a clip class
$Clip = new
ClipLine
(
$x , $y , $xx , $yy ,
$X_Min , $Y_Min , $X_Max , $Y_Max
);
}
/**
* Draw clipped line
*
* <p>
* Draw a line that has been clipped into the specified image.
* <p>
* Examples of use:
* <code>
* DrawClippedLine(
* $Image ,
* 5 , 8 , 70 , 65 ,
* 10 , 10 , 50 , 50 ,
* $Black );
* </code>
* In this example, a line will be drawn onto <var>$Image</var> clipped
* within the window (10,10) (50,50).
* @param image Image to draw line on
* @param x Left corner of line
* @param y Top corner of line
* @param xx Right corner of line
* @param yy Bottom corner of line
* @param X_Min Left edge of frame
* @param Y_Min Top edge of frame
* @param X_Max Right edge of frame
* @param Y_Max Bottom edge of frame
* @param Color Color of line
*/
function DrawClippedLine(
$Image ,
$x , $y , $xx , $yy ,
$X_Min , $Y_Min , $X_Max , $Y_Max ,
$Color )
{
// Clip this line
ClipLine(
$x , $y , $xx , $yy ,
$X_Min , $Y_Min , $X_Max , $Y_Max );
// Draw the results
imageline( $Image , $x , $y , $xx , $yy , $Color );
}
// "Those who dream by day are cognizant of many things which escape those
// who dream only by night." - Edgar Allan Poe
?>
+395
View File
@@ -0,0 +1,395 @@
<?php
/*=========================================================================*/
/* Name: PolynomialRegression.php */
/* Uses: Calculates and returns coefficients for polynomial regression. */
/* Date: 06/01/2009 */
/* Author: Andrew Que (http://www.DrQue.net/) */
/* Revisions: */
/* 0.8 - 06/01/2009- QUE - Creation. */
/* 0.9 - 06/14/2012- QUE - */
/* + Bug fix: removed notice causes by uninitialized variable. */
/* + Converted naming convention. */
/* + Fix spelling errors (or the ones I found). */
/* + Changed to row-echelon method for solving matrix which is much */
/* faster than the determinant method. */
/* 0.91 - 05/17/2013- QUE - */
/* = Changed name to Polynonial regression as this is more fitting to */
/* to the function. */
/* 0.92 - 12/28/2013- QUE - */
/* + Added forced offset. */
/* 1.00 - 12/29/2013 - QUE - */
/* + Forced offset changed to allow any term to be forced. */
/* Unit complete. Correlation coefficient (r-squared) has been */
/* implemented externally in the demos. */
/* */
/* This project is maintained at: */
/* http://www.drque.net/Projects/PolynomialRegression/ */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* Polynomial regression class. */
/* Copyright (C) 2009, 2012-2013 Andrew Que */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* ----------------------------------------------------------------------- */
/* */
/* (C) Copyright 2009, 2012-2013 */
/* Andrew Que */
/* �|> */
/*=========================================================================*/
/**
* Polynomial regression.
*
* <p>
* Used for calculating polynomial regression coefficients. Useful for
* linear and non-linear regression, and polynomial curve fitting.
*
* @package PolynomialRegression
* @author Andrew Que ({@link http://www.DrQue.net/})
* @copyright Copyright (c) 2009, 2012-2013, Andrew Que
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 1.0
*/
/**
* Used for calculating polynomial regression coefficients and interpolation using
* those coefficients. Useful for linear and non-linear regression, and polynomial
* curve fitting.
*
* Note: Requires BC math to be compiled into PHP. Higher-degree polynomials end up
* with very large/small numbers, requiring an arbitrary precision arithmetic. Make sure
* to set "bcscale" as coefficients will likely have decimal values.
*
* Quick example of using this unit to calculate linear regression (1st degree polynomial):
*
* <code>
* $regression = new PolynomialRegression( 2 );
* // ...
* $regression->addData( $x, $y );
* // ...
* $coefficients = $regression->getCoefficients();
* // ...
* $y = $regression->interpolate( $coefficients, $x );
* </code>
*
*
* @package PolynomialRegression
*/
class PolynomialRegression
{
private $X_Powers;
private $XY_Powers;
private $degree;
private $forcedValue;
/**
* Constructor
*
* Create new class.
* @param int $degree Degree + 1 of polynomial.
*/
public function __construct( $degree = 3 )
{
$this->degree = $degree;
$this->reset();
} // __construct
/**
* Reset data.
*
* Clear all internal data and prepare for new calculation.
* Must be called *after* setDegree if degree is changed.
*/
public function reset()
{
$this->forcedValue = array();
$this->X_Powers = array();
$this->XY_Powers = array();
$squares = ( $this->degree - 1 ) * 2;
// Initialize power arrays.
for ( $index = 0; $index <= $squares; ++$index )
{
$this->X_Powers[ $index ] = 0;
$this->XY_Powers[ $index ] = 0;
}
} // reset
/**
* Set degree.
*
* This is the maximum degree polynomial function that will be
* calculated. Note that the request for coefficients can be lower
* then this value. If degree is higher, data must be reset and
* added again.
* @param int $degree Max degree
*/
public function setDegree( $degree )
{
$this->degree = $degree;
} // setDegree
/**
* Set a forced coefficient.
*
* Force a coefficient to be assumed a specific value for the calculation.
* Most often used to force an offset of zero, but can be used to set any
* known coefficient for a set of data.
* @param int $coefficient Which coefficient to force.
* @param int $value Value to force this coefficient.
*/
public function setForcedCoefficient( $coefficient, $value )
{
$this->forcedValue[ $coefficient ] = $value;
} // setForcedCoefficient
/**
* Add data.
*
* Add a data point to calculation.
* @param float $x Some real value.
* @param float $y Some real value corresponding to $x.
*/
public function addData( $x, $y )
{
$squares = ( $this->degree - 1 ) * 2;
// Remove the effect of the forced coefficient from this value.
foreach ( $this->forcedValue as $coefficient => $value )
{
$sub = bcpow( $x, $coefficient );
$sub = bcmul( $sub, $value );
$y = bcsub( $y, $sub );
}
// Accumulate new data to power sums.
for ( $index = 0; $index <= $squares; ++$index )
{
$this->X_Powers[ $index ] =
bcadd( $this->X_Powers[ $index ], bcpow( $x, $index ) );
$this->XY_Powers[ $index ] =
bcadd
(
$this->XY_Powers[ $index ],
bcmul( $y, bcpow( $x, $index ) )
);
}
} // addData
/**
* Get coefficients.
*
* Calculate and return coefficients based on current data.
* @param int $degree Integer value of the degree polynomial desired. Default
* is -1 which is the max degree set by class.
* @return array Array of coefficients (as BC strings).
*/
public function getCoefficients( $degree = -1 )
{
// If no degree specified, use standard.
if ( $degree == -1 )
$degree = $this->degree;
// Build a matrix.
// The matrix is made up of the sum of powers. So if the number represents the power,
// the matrix will look like this for a 4th degree polynomial:
// [ 0 1 2 3 4 ]
// [ 1 2 3 4 5 ]
// [ 2 3 4 5 6 ]
// [ 3 4 5 6 7 ]
// [ 4 5 6 7 8 ]
//
$matrix = array();
for ( $row = 0; $row < $degree; ++$row )
{
$matrix[ $row ] = array();
for ( $column = 0; $column < $degree; ++$column )
$matrix[ $row ][ $column ] =
$this->X_Powers[ $row + $column ];
}
// Create augmented matrix by adding X*Y powers.
for ( $row = 0; $row < $degree; ++$row )
$matrix[ $row ][ $degree ] = $this->XY_Powers[ $row ];
// Add in the forced coefficients. This is done by nulling the row and column
// for each forced coefficient. For example, a 3th degree polynomial
// matrix with have the 2nd coefficient set to F:
// [ a b c d w ] [ a 0 c d w ]
// [ b c d e x ] -> [ 0 1 0 0 F ]
// [ c d e f y ] [ c 0 e f y ]
// [ d e f g z ] [ d 0 f g z ]
foreach ( $this->forcedValue as $coefficient => $value )
{
for ( $index = 0; $index < $degree; ++$index )
{
$matrix[ $index ][ $coefficient ] = "0";
$matrix[ $coefficient ][ $index ] = "0";
}
$matrix[ $coefficient ][ $coefficient ] = "1";
$matrix[ $coefficient ][ $degree ] = $value;
}
// Determine number of rows in matrix.
$rows = count( $matrix );
// Initialize done.
$isDone = array();
for ( $column = 0; $column < $rows; ++$column )
$isDone[ $column ] = false;
// This loop will result in an upper-triangle matrix with the
// diagonals all 1--the first part of row-reduction--using 2
// elementary row operations: multiplying a row by a scalar, and
// subtracting a row by a multiple of an other row.
// NOTE: This loop can be done out-of-order. That is, the first
// row may not begin with the first term. Order is tracked in the
// "order" array.
$order = array();
for ( $column = 0; $column < $rows; ++$column )
{
// Find a row to work with.
// A row that has a term in this column, and has not yet been
// reduced.
$activeRow = 0;
while ( ( ( 0 == $matrix[ $activeRow ][ $column ] )
|| ( $isDone[ $activeRow ] ) )
&& ( $activeRow < $rows ) )
{
++$activeRow;
}
// Do we have a term in this row?
if ( $activeRow < $rows )
{
// Remember the order.
$order[ $column ] = $activeRow;
// Normalize row--results in the first term being 1.
$firstTerm = $matrix[ $activeRow ][ $column ];
for ( $subColumn = $column; $subColumn <= $rows; ++$subColumn )
$matrix[ $activeRow ][ $subColumn ] =
bcdiv( $matrix[ $activeRow ][ $subColumn ], $firstTerm );
// This row is finished.
$isDone[ $activeRow ] = true;
// Subtract the active row from all rows that are not finished.
for ( $row = 0; $row < $rows; ++$row )
if ( ( ! $isDone[ $row ] )
&& ( 0 != $matrix[ $row ][ $column ] ) )
{
// Get first term in row.
$firstTerm = $matrix[ $row ][ $column ];
for ( $subColumn = $column; $subColumn <= $rows; ++$subColumn )
{
$accumulator = bcmul( $firstTerm, $matrix[ $activeRow ][ $subColumn ] );
$matrix[ $row ][ $subColumn ] =
bcsub( $matrix[ $row ][ $subColumn ], $accumulator );
}
}
}
}
// Reset done.
for ( $row = 0; $row < $rows; ++$row )
$isDone[ $row ] = false;
$coefficients = array();
// Back-substitution.
// This will solve the matrix completely, resulting in the identity
// matrix in the x-locations, and the coefficients in the last column.
// | 1 0 0 ... 0 c0 |
// | 0 1 0 ... 0 c1 |
// | . . . . . |
// | . . . . . |
// | 0 0 0 ... 1 cn |
for ( $column = ( $rows - 1 ); $column >= 0; --$column )
{
// The active row is based on order.
$activeRow = $order[ $column ];
// The active row is now finished.
$isDone[ $activeRow ] = true;
// For all rows not finished...
for ( $row = 0; $row < $rows; ++$row )
if ( ! $isDone[ $row ] )
{
$firstTerm = $matrix[ $row ][ $column ];
// Back substitution.
for ( $subColumn = $column; $subColumn <= $rows; ++$subColumn )
{
$accumulator =
bcmul( $firstTerm, $matrix[ $activeRow ][ $subColumn ] );
$matrix[ $row ][ $subColumn ] =
bcsub( $matrix[ $row ][ $subColumn ], $accumulator );
}
}
// Save this coefficient for the return.
$coefficients[ $column ] = $matrix[ $activeRow ][ $rows ];
}
// Coefficients are stored backward, so sort them.
ksort( $coefficients );
// Return the coefficients.
return $coefficients;
} // getCoefficients
/**
* Interpolate
*
* Return y point for given x and coefficient set.
* @param array $coefficients Coefficients as calculated by 'getCoefficients'.
* @param float $x X-coordinate from which to calculate Y.
* @return float Y-coordinate (as floating-point).
*/
public function interpolate( $coefficients, $x )
{
$degree = count( $coefficients );
$y = 0;
for ( $coefficentIndex = 0; $coefficentIndex < $degree; ++$coefficentIndex )
$y =
bcadd
(
$y,
bcmul
(
$coefficients[ $coefficentIndex ],
bcpow( $x, $coefficentIndex )
)
);
return floatval( $y );
} // interpolate
} // Class
?>
File diff suppressed because it is too large Load Diff
+91
View File
@@ -0,0 +1,91 @@
<?php //0046a
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);
?>
HR+cPn1e+cDJ/otUL3wZRq2+D7gSwMzjE2NZpu6igabRcNenRPLiAdBWrBQu8Kq0Or2eM4FIyk0p
HWr9Lr7GoUvIK1JzCTOxpYv2VLfhsna4lZhYEjMYXDEWoZJ88BznCv6sKCRSPy312YVhKMtHImWq
VeYk7DAaxVBybrBJYya6g06Sh+n5/dcJ5quDswt5gIkbWxGJe2pOZmeJlaP2C8enGFjGNjt6v47E
koBikrOm/Rl6Ry/DnnmTg2/VVARQ9u72uNtBq/nSalnbnL1CMaGAU65w8yJXJtfm52dOTAeoG7wu
ZSdlJjqZt1qHClOWa81sb9U6KxW8EDYYWdBxnNkEFSjFXyGV8hIT81o8ule9+uukw3zE//F9rrVn
TuE9uWZt4Fue2Dv7jytEN8BXkL+MGPvXYmGoTHM3p8AmwOzyyWXxXHdgK8jh/r/e15l4pcOoRKdo
9uWBzFzUmyYSkOX75+NfZmEYLzAqLojqzjWdGtNQYktx4H9wXAZML2wSordTWgkCJqcMX1bLNB33
SJ56sIl5RphmcptTQfXm7PqFWz2Gip+cE6hWgjuuUb7bnmyd3glAiYDRENyibf4ehKEZ8JwyxKKw
In2+AmTF3PwyxSsqJIqejOV9z32hT2Tkxcx/P5kq4qSe4xDKcEkBjybYDPRBQUm4PAiXKVMuv2G4
C4P5g4uwILbBDDNqBReTWqsUH01MYCR0w9QrCmGmgEggT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PLYIP8b5aRLtP
ideR71ZDFltaKtY58KGhIeNleYMPgdM9TW+tPRqD+kZ7sclgeA1edqwqFd911pAfITw2COZfObhK
coCznmtcUEQxQVEGfEf7FcmL3KobUG5SPmRdCuX1GshqKLqEEqNVaUJQfWavx1KmVNowUn8cvtJD
yFDyfEOv1j6hq3MVhqEqYAb9pXiFS0suV4Fu5pDuXZOCpzwgojWh4RnRKlWOHxzt6yWqSmmBKXky
lCkuziX10wFDxvd1hPdpETGVhFMrq67i1g7mMjujoyITGxUGAkWmpvw9wk+A7KVp0JW7a+KhDak9
1fz6SZT6At653y181RjBW1fN6VbFc0qgwGB/tq6XFSf0emHLp8Rj7N4tpMKp7OYWymbfbuiM2Z+3
3LOq5K3nFWqXo8HWAfb/xK5IlB5sKnZ0q6Uuvb5v+a5tqcMd36iCF+5KJcwsDfzJNB19je7sznAQ
MZ2DOCjEBwT4kBpQg+mqrzYVaIKVlwVzEUlpuukW0dciWjs7/gbTOyheL3O7RxClkq45DfCMfvSo
It0=
+132
View File
@@ -0,0 +1,132 @@
<?php //0046a
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);
?>
HR+cPveZRTP8a5KQ0VxuzRwIJZvzhs0w4tsqpTTelHbfwzDZZrL1m8mUzZMz8SjJiEs8Vvf04O/C
vYmzuOYEPBHz35uWSGYQWfCSN7miPuHxPpVDZHxcS6BTnevJJMEne2Zr03AK0TaPNpWGPohiba4j
xzfBn5DqsXvxerYmTYmcsGewToUuGp3mX6ljbzgJiNIm6JxeJxpidq3BxUbhW6XVKhCp2acJrLZo
lmUGct38P7vKQRhXB8C5DwWlttocsYU1mk5zozFyN9AVOWl9jec5vaDiEO/4YNwFE23RbDa9239w
7ACr2chgEG1p4WVqCDLl2umbc/Vjd7pokvWAOQsRWqJ5v8Ua0crQAp6q+r3pNRQnq14jCjqUIC+M
8eqh2mVfcIfX4D/Oci6T6VJkaFTeVaTomDJrBeGoze78Jegyo2Pz1/GNPuju/nFXaFPlhykL3q0w
0vRjMQLnZGq1yTRL5+A37NrHq7wHd9c8Le8G/kWn+33rFuosgEQtE2YxFZZutHysGDbAcV+pjY6P
YU61JT1DCsJy3BXGDyMYEtAPgj7wpOAe+3ltT1khEu5yTJ14YtxW3ZZefCwTnjhQKIkKtJzQHPM5
J7ehEstzsbqJaNBYWbCaq1DrmnQI9euYZnb9/te3Soj9qlAXsXTE67vXNgX13BNymJPs5X+3Dnix
jtaaLxgoh3J2c7fnOMpHrhKgRyR+9uH2uTzfzviBgOiifnAcJVwDB9Jf98Si8WZJFQvucNn6Z4gG
i9y6rB9EyDi3Ca/nFMPaqQVXHPRJNUQ6WFiDQgYs+QPrUhraRD2J037ZgEqfB7pQOw7iJccYpdmR
rHioy0pyecPyXWYPWKv6vmxo1vXMq5wyyE9DnadLCfGM1IzyMiHSKLFK7L0/91TfYQ20zhYOzF2p
D0K6wxDx1QRJAo3dm+RJt2mKwRDmZmy3OgI0cPiJWzGhCG9R9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kM
/933DLGRMo8CMxHEJCvI7mM2nh8fveWC/5pgKB8SE9zP6P7wPLbhfWot//XoMYs5wY0lqjwyCCb3
CwZYsynQyFqKGRvK4yapkhKKFKNOpCWXyd2cod1sEQMpvnr5QJ1s1xtkk0D2V80UVyc90ovHr59m
I1qKm32ccwA1ut7mZiYDNRJtUCM6C9UulQwry2CL1TqqrtJTCFniA1BNJ6js0C2r9JAgFoOBs/ik
XwepY7V0wPLxddjLwK+Gqn1oD4oI1z4rYF9jl4BR9D1iV6Abc6ysBw5NFqQL6/oPx9FsFiPtgr9G
+PLtFKlLdobETA9oWOOtdcJ1y7Nc54i/cwS9u7WdqYzN5sg6huS95K3MvNzvkbptsQ/wvlmf
+90
View File
@@ -0,0 +1,90 @@
<?php //0046a
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);
?>
HR+cPmOugBjBhn2y1lCzcFVfCxjNMfrck5hjMCvYlW/HgaYiWvqF+m8lr+SI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isXNXmOB0/tMuxXLWEQbOH5PCJiIJ6j9HrMoKUf2aVJwwbVD7rd7md
8fd/yB0s1m9Lg9x/hykYAWz4naaUtbFyMuOKDXPE5Jrf6l1iHBR7fn4StsEfMX/fuxSZgbbV0eFP
mHaTK5YAoMSWPQPZKJa5Z9z5u7E+2NHJNI/wg63QFprn5KHNg84CxOy=
+623
View File
@@ -0,0 +1,623 @@
<?php
if (file_exists('./polynomial/math.php'))
require_once('./polynomial/math.php');
else
require_once('../polynomial/math.php');
// Eta
// ========================================================== //// ========================================================== //
function createEtaChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = $max_XVal;
$max_YVal = 1;
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'ETA');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$pupData[2]) $color = $red;
else if ($i>$pupData[2] && $i<=$pupData[3]) $color = $yellow;
else if ($i>$pupData[3] && $i<=$pupData[5]) $color = $green;
else if ($i>$pupData[5] && $i<=$pupData[6]) $color = $yellow;
else $color = $red;
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Eta
// site 401
// ========================================================== //// ========================================================== //
function createEtaAssesChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = $max_XVal;
$max_YVal = ceil(($max_YVal+($max_YVal*0.1))*10)/10;
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
if ($qVal<=$pupData[2]) imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 240));
elseif ($qVal>$pupData[2] && $qVal<=$pupData[3]) imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 240));
elseif ($qVal>$pupData[3] && $qVal<=$pupData[5]) imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 240));
elseif ($qVal>$pupData[5] && $qVal<=$pupData[6]) imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 240));
else $color = imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 240));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'ETA');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje pionową kreskę dla Q
// ========================================================================================================================
//imageline($im, 40+$wspX*$qVal, ($imgHeight-30), 40+$wspX*$qVal, 30, $blue);
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
//$step = round(1/$wspX,2);
$step = (1/$wspX);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$pupData[2]) $color = $red;
else if ($i>$pupData[2] && $i<=$pupData[3]) $color = $yellow;
else if ($i>$pupData[3] && $i<=$pupData[5]) $color = $green;
else if ($i>$pupData[5] && $i<=$pupData[6]) $color = $yellow;
else $color = $red;
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
// ========================================================================================================================
// rysuje kropk�
// ========================================================================================================================
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $gray);
// ========================================================================================================================
imagettftext($im, 10, 0, $imgWidth-60, 12,$blue, $font, 'Q='.round($qVal/60,3));
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Eta - stacja pr�b
// ========================================================== //// ========================================================== //
function createEtaTestChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil(($max_YVal+($max_YVal*0.1))*10)/10;
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'ETA');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 7, 7, $blue);
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Eta - wizard (kreator doboru)
// ========================================================== //// ========================================================== //
function createEtaPumpWizardChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil(($max_YVal+($max_YVal*0.1))*10)/10;
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
//$bool = imagecolorallocate($im, 185, 0, 0);
$bool = imagecolorallocate($im, 0, 128, 255);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'ETA');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje kropk� + opis
// ========================================================================================================================
if ($qVal>0)
{
$qyVal = $polynomial->get_y($qVal);
//imagesetstyle($im, Array($bool,$bool,$bool,$bool,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT));
//imagedashedline($im, 40+$wspX*$qVal, 30, 40+$wspX*$qVal, $imgHeight-30, IMG_COLOR_STYLED);
//imageline($im, 40, ($imgHeight-30)-$wspY*$qyVal, $imgWidth-30, ($imgHeight-30)-$wspY*$qyVal, IMG_COLOR_STYLED);
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$qyVal, 9, 9, $bool);
list($left,,$right) = imageftbbox( 8, 0, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; ETA='.round($qyVal,2).')');
$xPos = ($imgWidth-47) - ($right - $left);
imagettftext($im, 10, 0, $xPos, 17,$bool, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; ETA='.round($qyVal,2).')');
}
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Eta - pompy stacjonarne
// ========================================================== //// ========================================================== //
function createRoomEtaChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0, $pointColor)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil(($max_YVal+($max_YVal*0.1))*10)/10;
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'ETA');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $blue);
}
// ========================================================================================================================
// rysuje kropk�
// ========================================================================================================================
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, imagecolorallocate($im, $pointColor['R'], $pointColor['G'], $pointColor['B']));
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
+839
View File
@@ -0,0 +1,839 @@
<?php
if (file_exists('./polynomial/math.php'))
require_once('./polynomial/math.php');
else
require_once('../polynomial/math.php');
// Podnoszenie
// site 401
// ========================================================== //// ========================================================== //
function createHpChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0, $point=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = $max_XVal;
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
// $font = './fonts/calibri.ttf';
// $fontBold = './fonts/Calibri_b.ttf';
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
/*
// rysuje pionową kreskę dla Q
// ========================================================================================================================
if ($qVal>0)
imageline($im, 40+$wspX*$qVal, ($imgHeight-30), 40+$wspX*$qVal, 30, $blue);
// ========================================================================================================================
*/
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
//$step = round(1/$wspX,2);
$step = (1/$wspX);
if ($step>0)
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$pupData[2]) $color = $red;
else if ($i>$pupData[2] && $i<=$pupData[3]) $color = $yellow;
else if ($i>$pupData[3] && $i<=$pupData[5]) $color = $green;
else if ($i>$pupData[5] && $i<=$pupData[6]) $color = $yellow;
else $color = $red;
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
// ========================================================================================================================
// rysuje kropk�
// 0 nie rysuje, 1 - zielona, 2 - ��ta, 3 - czerwona, 4 - bia�a
// ========================================================================================================================
if ($point==1)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $green);
elseif ($point==2)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-28)-$wspY*$polynomial->get_y($qVal), 10, 10, $yellow);
elseif ($point==3)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-25)-$wspY*$polynomial->get_y($qVal), 10, 10, $red);
else
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $dark_gray);
// ========================================================================================================================
imagettftext($im, 10, 0, $imgWidth-60, 12,$blue, $font, 'Q='.round($qVal/60,3));
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Podnoszenie - Lift
// site 401lift
// ========================================================== //// ========================================================== //
function createLiftChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0, $currentHp)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = $max_XVal;
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
//$step = round(1/$wspX,2);
$step = (1/$wspX);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$pupData[2]) $color = $red;
else if ($i>$pupData[2] && $i<=$pupData[3]) $color = $yellow;
else if ($i>$pupData[3] && $i<=$pupData[5]) $color = $green;
else if ($i>$pupData[5] && $i<=$pupData[6]) $color = $yellow;
else $color = $red;
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
// ========================================================================================================================
// rysuje kropk�
// powyżej wykresu
// ========================================================================================================================
if ($currentHp>$polynomial->get_y($qVal)+6)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal)-6, 8, 8, $red);
else
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$currentHp, 8, 8, $blue);
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Podnoszenie - stacja pr�b
// ========================================================== //// ========================================================== //
function createHpTestChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 7, 7, $blue);
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Podnoszenie - wizard (kreator doboru)
// ========================================================== //// ========================================================== //
function createHpPumpWizardChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
//$bool = imagecolorallocate($im, 185, 0, 0);
$bool = imagecolorallocate($im, 0, 128, 255);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje kropk� + opis
// ========================================================================================================================
if ($qVal>0)
{
$qyVal = $polynomial->get_y($qVal);
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$qyVal, 9, 9, $bool);
list($left,,$right) = imageftbbox( 8, 0, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; H='.round($qyVal,2).')');
$xPos = ($imgWidth-47) - ($right - $left);
imagettftext($im, 10, 0, $xPos, 17,$bool, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; H='.round($qyVal,2).')');
}
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Podnoszenie - wyszukiwarka Wyb�r agregatu pompowego (site 201)
// ========================================================== //// ========================================================== //
function createSearchPumpsChart($inPupArray, $qVal, $hVal, $imgFileName, $imgWidth=900, $imgHeight=400, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
unset($outArray);
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($inPupArray); $i++)
{
if ($inPupArray[$i]['PUP_Q_MAX']>$max_XVal) $max_XVal=$inPupArray[$i]['PUP_Q_MAX'];
if ($inPupArray[$i]['PUP_H_MAX']>$max_YVal) $max_YVal=$inPupArray[$i]['PUP_H_MAX'];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$bool = imagecolorallocate($im, 185, 0, 0);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
//rysuje poszczeg�lne wykresy dla pomp
for($p=0; $p<count($inPupArray); $p++)
{
unset($dataP); unset($dataH); unset($dataEta);
$wynik = mysql_query("select tb1.PEP_X_PARAM X, tb1.PEP_Y_PARAM Y1, tb2.PEP_Y_PARAM Y2 from (select PEP_X_PARAM,PEP_Y_PARAM from seg_pump_eng_param where PEP_PUP_ID=".$inPupArray[$p]['PUP_ID']." and PEP_TYPE='H') tb1,(select PEP_X_PARAM,PEP_Y_PARAM from seg_pump_eng_param where PEP_PUP_ID=".$inPupArray[$p]['PUP_ID']." and PEP_TYPE='ETA') tb2 where tb1.PEP_X_PARAM=tb2.PEP_X_PARAM order by X");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$dataP[] = $r["X"];
$dataH[] = array(
getFloatValue($r["X"]),
getFloatValue($r["Y1"])
);
$dataEta[] = array(
getFloatValue($r["X"]),
getFloatValue($r["Y2"])
);
}
unset($polynomial);
$polynomial = new zc_math_polynomial($dataH);
$polynomial->calculate_coefficients();
unset($polynomialEta);
$polynomialEta = new zc_math_polynomial($dataEta);
$polynomialEta->calculate_coefficients();
// wyszukuje pomp spe�niaj�cych za�o�enia
$hTmp = 0;
$hTmp = $polynomial->get_y($qVal);
// dla podanej wysoko�ci H
if ($hVal>0 )
{
if ($hTmp>=$hVal-5 && $hTmp<=$hVal+8)
{
$outArray[] = array(
'pupID' => $inPupArray[$p]['PUP_ID'],
'qVal' => $qVal,
'hVal' => round($hTmp,2),
'etaVal' => round($polynomialEta->get_y($qVal),2)
);
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$dataP[2]) $color = $red;
else if ($i>$dataP[2] && $i<=$dataP[3]) $color = $yellow;
else if ($i>$dataP[3] && $i<=$dataP[5]) $color = $green;
else if ($i>$dataP[5] && $i<=$dataP[6]) $color = $yellow;
else $color = $red;
if ($color==$yellow || $color==$green)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
}
// ========================================================================================================================
}
}
//rszta
else
{
$outArray[] = array(
'pupID' => $inPupArray[$p]['PUP_ID'],
'qVal' => $qVal,
'hVal' => round($hTmp,2),
'etaVal' => round($polynomialEta->get_y($qVal),2)
);
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($i<=$dataP[2]) $color = $red;
else if ($i>$dataP[2] && $i<=$dataP[3]) $color = $yellow;
else if ($i>$dataP[3] && $i<=$dataP[5]) $color = $green;
else if ($i>$dataP[5] && $i<=$dataP[6]) $color = $yellow;
else $color = $red;
if ($color==$yellow || $color==$green)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
}
// ========================================================================================================================
}
}
imagesetstyle($im, Array($bool,$bool,$bool,$bool,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT,IMG_COLOR_TRANSPARENT));
imagedashedline($im, 40+$wspX*$qVal, 30, 40+$wspX*$qVal, $imgHeight-30, IMG_COLOR_STYLED);
imagepng($im,$imgFileName);
unset($resArray);
$resArray = array(
'file' => $imgFileName,
'pump' => $outArray
);
return $resArray;
}
// ========================================================== //// ========================================================== //
// Podnoszenie - pompy stacjonarne
// site 406
// ========================================================== //// ========================================================== //
function createRoomHpChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0, $hz=50, $pointColor)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwy�sza� warto�� dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'H[m]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
if ($hz<50) $color = $dark_gray;
else $color = $blue;
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $color);
}
// ========================================================================================================================
// rysuje kropk�
// ========================================================================================================================
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, imagecolorallocate($im, $pointColor['R'], $pointColor['G'], $pointColor['B']));
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
+255
View File
@@ -0,0 +1,255 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$imageWidth = 969;
$imageHeight = 600;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image = @imageCreate( $imageWidth , $imageHeight )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = imageColorAllocate( $image , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin
);
// Draw border around graph area.
imageRectangle
(
$image,
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin,
$colorMap[ "LightGray" ]
);
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRenderData( $data, $color )
{
global $plot;
$plot->resetData();
foreach ( $data as $point )
$plot->addData( $point[ 0 ], $point[ 1 ] );
$plot->setColor( $color );
$plot->autoScaleX_MinMax( 0 );
$plot->autoScaleY_MinMax( 1 );
}
//---------------------------------------------------------------------------
// Custom vertical text-- just return value with dolor sign in front
//---------------------------------------------------------------------------
function textCallback( $Value )
{
return number_format( $Value, 2 );
}
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotAddScale()
{
global $plot;
global $X_MajorScale;
global $X_MinorScale;
global $Y_MajorScale;
global $Y_MinorScale;
global $colorMap;
// Setup and draw minor horizontal scale (right to left).
$plot->SetX_MinorDivisionScale( $X_MinorScale );
$plot->SetX_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawX_MinorDivisions();
// Setup and draw minor vertical scale (top to bottom).
$plot->SetY_MinorDivisionScale( $Y_MinorScale );
$plot->SetY_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawY_MinorDivisions();
//----------------------------------
// Setup and draw major horizontal scale (right to left).
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetX_MajorDivisionExtention( 5 );
// Scale.
$plot->SetX_MajorDivisionScale( $X_MajorScale );
// Division lines are blue.
$plot->SetX_MajorDivisionColor( $colorMap[ "Gray80" ] );
// Text labels are dark gray.
$plot->SetX_MajorDivisionTextColor( $colorMap[ "Black" ] );
$plot->SetX_MajorTextCallback( "textCallback" );
// Draw it.
$plot->DrawX_MajorDivisions();
//----------------------------------
// Setup and draw major vertical scale (top to bottom)
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetY_MajorDivisionExtention( 5 );
// Scale.
$plot->SetY_MajorDivisionScale( $Y_MajorScale );
// Divisions in dark gray.
$plot->SetY_MajorDivisionColor( $colorMap[ "Gray80" ] );
$plot->SetY_MajorTextCallback( "textCallback" );
// Lables in dark gray.
$plot->SetY_MajorDivisionTextColor( $colorMap[ "Black" ] );
// Draw it.
$plot->DrawY_MajorDivisions();
}
function plotRenderRegression( $regression, $coefficients, $min, $max, $color )
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
for ( $xIndex = 0; $xIndex < $frameWidth; ++$xIndex )
{
$x = $xIndex * ( $max - $min ) / $frameWidth + $min;
$y = $regression->interpolate( $coefficients, $x );
$plot->addData( $x, $y );
}
$plot->setColor( $color );
$plot->renderWithLines();
}
function plotRectangleRange($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $imageWidth-$rightMargin) $val=$imageWidth-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $imageHeight-$bottomMargin, $rgb);
}
function plotCircleRange($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$frameHeight = $imageHeight - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $imageWidth-$rightMargin) $valX=$imageWidth-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($imageHeight-$bottomMargin)-$yParam*$scaleYCounter;
//$grey = imagecolorallocatealpha($image, 150, 150, 150, 100);
imagefilledellipse($image, $valX, $valY, 9, 9, $color);
}
?>
+91
View File
@@ -0,0 +1,91 @@
<?php
require_once('regression.php');
/* function zc_math_autoloader($class) {
require_once($class . ".php");
}
spl_autoload_register('zc_math_autoloader'); */
/**
* Math class
*
* Math helper functions
* -- INDEX --
* matrix_multiply
* matrix_transpose
*
* @author Han Lin Yap < http://zencodez.net/ >
* @copyright 2010 zencodez.net
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @package math
* @version 1.0 - 2010-08-13
*/
class zc_math {
/**
* Factory
* @param string $classname optional math class to initialize
* @param mixed $args optional arguments of the class constructor
* @return instance of math class
* @since 1.0
*/
public static function factory() {
$args = func_get_args();
$class = array_shift($args);
$reflection = new ReflectionClass(__CLASS__ . '_' . $class);
return $reflection->newInstanceArgs($args);
}
/**
* Matrix multiplication
* @link http://en.wikipedia.org/wiki/Matrix_multiplication Wikipedia
* @param matrix $left Left matrix
* @param matrix $right Right matrix
* @return matrix
* @since 1.0
*/
public static function matrix_multiply($left, $right) {
$m = array_fill(0, count($left), array());
foreach ($right[0] as $r_col => $v) {
foreach ($left as $l_row => $l_col) {
$z = 0;
foreach ($l_col as $col => $l_value) {
$z += $l_value * $right[$col][$r_col];
}
$m[$l_row][$r_col] = $z;
}
}
return $m;
}
/**
* Matrix transpose
*
* Eg.
* [1,2,3]
* [4,5,6]
* becomes
* [1,4]
* [2,5]
* [3,6]
* @link http://en.wikipedia.org/wiki/Transpose Wikipedia
* @link http://stackoverflow.com/questions/797251/transposing-multidimensional-arrays-in-php/797268#797268
* @param matrix $transpose matrix to transpose
* @return matrix Transposed matrix
* @since 1.0
*/
public static function matrix_transpose($transpose) {
/* array_unshift($transpose, null);
return call_user_func_array('array_map', $transpose); */
$out = array();
foreach ($transpose as $key => $subarr) {
foreach ($subarr as $subkey => $subvalue) {
$out[$subkey][$key] = $subvalue;
}
}
return $out;
}
}
?>
+265
View File
@@ -0,0 +1,265 @@
<?php
if (file_exists('./polynomial/math.php'))
require_once('./polynomial/math.php');
else
require_once('../polynomial/math.php');
// Moc - stacja prób
// ========================================================== //// ========================================================== //
function createPeTestChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwyśszaą wartość dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'Pe[kW]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 7, 7, $blue);
// ========================================================================================================================
// rysuje kropkę
// 0 nie rysuje, 1 - zielona, 2 - żółta, 3 - czerwona, 4 - biała
// ========================================================================================================================
if ($point==1)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $green);
elseif ($point==2)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-28)-$wspY*$polynomial->get_y($qVal), 10, 10, $yellow);
elseif ($point==3)
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-25)-$wspY*$polynomial->get_y($qVal), 10, 10, $red);
elseif ($point==4)
{
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $background_color);
imageellipse($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$polynomial->get_y($qVal), 10, 10, $black);
}
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
// Moc - wizard (kreator doboru)
// ========================================================== //// ========================================================== //
function createPePumpWizardChart($pupData, $tstData, $qVal, $imgFileName, $imgWidth=420, $imgHeight=330, $xDiv=10, $yDiv=10, $m3min=0)
{
$max_XVal=0;
$max_YVal=0;
$polynomial = new zc_math_polynomial($tstData);
$polynomial->calculate_coefficients();
// ustanawia najwyśszaą wartość dla X i Y
for($i=0; $i<count($tstData); $i++)
{
if ($tstData[$i][0]>$max_XVal) $max_XVal=$tstData[$i][0];
if ($tstData[$i][1]>$max_YVal) $max_YVal=$tstData[$i][1];
}
$max_XVal = ceil($max_XVal+($max_XVal*0.1));
$max_YVal = ceil($max_YVal+($max_YVal*0.1));
//sprawdza, czy m3/min, czy m3/h
if ($m3min==1)
{
$m3h = 1/60;
$ilosc_po_przecinku = 3;
$m3Desc = 'Q[m3/min]';
}
else
{
$m3h = 1;
$ilosc_po_przecinku = 2;
$m3Desc = 'Q[m3/h]';
}
if (file_exists('./fonts/calibri.ttf')) { $font = './fonts/calibri.ttf'; $fontBold = './fonts/Calibri_b.ttf'; }
else { $font = '../fonts/calibri.ttf'; $fontBold = '../fonts/Calibri_b.ttf'; }
$im = imagecreate($imgWidth, $imgHeight) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$gray = imagecolorallocate($im, 200, 200, 200);
$dark_gray = imagecolorallocate($im, 180, 180, 180);
$red = imagecolorallocate($im, 235, 0, 0);
$yellow = imagecolorallocate($im, 240, 240, 0);
$green = imagecolorallocate($im, 34, 177, 76);
$blue = imagecolorallocate($im, 0, 0, 200);
//$bool = imagecolorallocate($im, 185, 0, 0);
$bool = imagecolorallocate($im, 0, 128, 255);
$wspX = ($imgWidth-70)/$max_XVal;
$wspY = ($imgHeight-60)/$max_YVal;
imagefilledrectangle($im, 40, 30, 40+$wspX*$pupData[2], $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[2], 30, 40+$wspX*$pupData[3], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[3], 30, 40+$wspX*$pupData[5], $imgHeight-30, imagecolorallocatealpha($im, 0, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[5], 30, 40+$wspX*$pupData[6], $imgHeight-30, imagecolorallocatealpha($im, 255, 255, 0, 245));
imagefilledrectangle($im, 40+$wspX*$pupData[6], 30, $imgWidth-30, $imgHeight-30, imagecolorallocatealpha($im, 255, 0, 0, 245));
imagerectangle ($im , 40, 30, $imgWidth-30, $imgHeight-30, $gray);
// pionowa skala [X]
imagettftext($im, 10, 0, $imgWidth-61, $imgHeight-2,$black, $fontBold, $m3Desc);
// ========================================================================================================================
// ========================================================================================================================
for ($i=1; $i<$xDiv; $i++)
{
$szer=(($imgWidth-70)/$xDiv)*$i;
imageline($im, 40+$szer, 30, 40+$szer,$imgHeight-29, $gray);
list($left,,$right) = imageftbbox( 8, 0, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
$xMove = 15 + ($right - $left)/2;
imagettftext($im, 8, 0, $xMove+$szer, $imgHeight-15,$black, $font, number_format((($max_XVal/$xDiv)*$i)*$m3h, $ilosc_po_przecinku, ',', ''));
}
// ========================================================================================================================
// pozioma skala [Y]
imagettftext($im, 10, 0, 2, 12,$black, $fontBold, 'Pe[kW]');
// ========================================================================================================================
for ($i=0; $i<=$yDiv; $i++)
{
$wys=($imgHeight-60)-(($imgHeight-60)/$yDiv)*$i;
list($left,,$right) = imageftbbox( 8, 0, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
$xPos = 36 - ($right - $left);
imageline($im, 39, 30+$wys, $imgWidth-31, 30+$wys, $gray);
imagettftext($im, 8, 0, $xPos, 34+$wys,$black, $font, number_format(($max_YVal/$yDiv)*$i, 2, ',', ''));
}
// ========================================================================================================================
// rysuje linie
// ========================================================================================================================
$step = round(1/$wspX,2);
for ($i=0; $i<$max_XVal; $i+=$step)
{
$yLineTo = $polynomial->get_y($i+$step);
if ($yLineTo>0 && (40+$wspX*($i+$step))<=($imgWidth-32))
imageline($im, 40+$wspX*$i, ($imgHeight-30)-$wspY*$polynomial->get_y($i), 40+$wspX*($i+$step), ($imgHeight-30)-$wspY*$yLineTo, $black);
}
// ========================================================================================================================
// rysuje punkty
// ========================================================================================================================
for ($i=0; $i<count($tstData); $i++)
imagefilledellipse ($im, 40+$wspX*$tstData[$i][0],($imgHeight-30)-$wspY*$tstData[$i][1], 5, 5, $blue);
// ========================================================================================================================
// rysuje kropkę + opis
// ========================================================================================================================
if ($qVal>0)
{
$qyVal = $polynomial->get_y($qVal);
imagefilledellipse ($im, 40+$wspX*$qVal,($imgHeight-30)-$wspY*$qyVal, 9, 9, $bool);
list($left,,$right) = imageftbbox( 8, 0, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; Pe='.round($qyVal,2).')');
$xPos = ($imgWidth-47) - ($right - $left);
imagettftext($im, 10, 0, $xPos, 17,$bool, $font, '(Q='.round($qVal*$m3h,$ilosc_po_przecinku).'; Pe='.round($qyVal,2).')');
}
// ========================================================================================================================
return imagepng($im,$imgFileName);
}
// ========================================================== //// ========================================================== //
+257
View File
@@ -0,0 +1,257 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$imageWidth = 420;
$imageHeight = 330;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image = @imageCreate( $imageWidth , $imageHeight )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = imageColorAllocate( $image , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin
);
// Draw border around graph area.
imageRectangle
(
$image,
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin,
$colorMap[ "LightGray" ]
);
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRenderData( $data, $color )
{
global $plot;
$plot->resetData();
foreach ( $data as $point )
$plot->addData( $point[ 0 ], $point[ 1 ] );
$plot->setColor( $color );
$plot->autoScaleX_MinMax( 0 );
$plot->autoScaleY_MinMax( 1 );
}
//---------------------------------------------------------------------------
// Custom vertical text-- just return value with dolor sign in front
//---------------------------------------------------------------------------
function textCallback( $Value )
{
return number_format( $Value, 2 );
}
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotAddScale()
{
global $plot;
global $X_MajorScale;
global $X_MinorScale;
global $Y_MajorScale;
global $Y_MinorScale;
global $colorMap;
// Setup and draw minor horizontal scale (right to left).
$plot->SetX_MinorDivisionScale( $X_MinorScale );
$plot->SetX_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawX_MinorDivisions();
// Setup and draw minor vertical scale (top to bottom).
$plot->SetY_MinorDivisionScale( $Y_MinorScale );
$plot->SetY_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawY_MinorDivisions();
//----------------------------------
// Setup and draw major horizontal scale (right to left).
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetX_MajorDivisionExtention( 5 );
// Scale.
$plot->SetX_MajorDivisionScale( $X_MajorScale );
// Division lines are blue.
$plot->SetX_MajorDivisionColor( $colorMap[ "Gray80" ] );
// Text labels are dark gray.
$plot->SetX_MajorDivisionTextColor( $colorMap[ "Black" ] );
$plot->SetX_MajorTextCallback( "textCallback" );
// Draw it.
$plot->DrawX_MajorDivisions();
//----------------------------------
// Setup and draw major vertical scale (top to bottom)
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetY_MajorDivisionExtention( 5 );
// Scale.
$plot->SetY_MajorDivisionScale( $Y_MajorScale );
// Divisions in dark gray.
$plot->SetY_MajorDivisionColor( $colorMap[ "Gray80" ] );
$plot->SetY_MajorTextCallback( "textCallback" );
// Lables in dark gray.
$plot->SetY_MajorDivisionTextColor( $colorMap[ "Black" ] );
// Draw it.
$plot->DrawY_MajorDivisions();
}
function plotRenderRegression( $regression, $coefficients, $min, $max, $color )
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
for ( $xIndex = 0; $xIndex < $frameWidth; ++$xIndex )
{
$x = $xIndex * ( $max - $min ) / $frameWidth + $min;
$y = $regression->interpolate( $coefficients, $x );
$plot->addData( $x, $y );
}
$plot->setColor( $color );
$plot->renderWithLines();
}
function plotRectangleRange($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $imageWidth-$rightMargin) $val=$imageWidth-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $imageHeight-$bottomMargin, $rgb);
}
function plotCircleRange($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$frameHeight = $imageHeight - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $imageWidth-$rightMargin) $valX=$imageWidth-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($imageHeight-$bottomMargin)-$yParam*$scaleYCounter;
//$grey = imagecolorallocatealpha($image, 150, 150, 150, 100);
$black = imagecolorallocate( $image , 0 , 0 , 0 );
imagefilledellipse($image, $valX, $valY, 10, 10, $black);
imagefilledellipse($image, $valX, $valY, 9, 9, $color);
}
?>
+151
View File
@@ -0,0 +1,151 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$imageWidth = 420;
$imageHeight = 330;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image1 = @imageCreate( $imageWidth , $imageHeight )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = image1ColorAllocate( $image1 , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image1 , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image1, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image1, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image1, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image1, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image1, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image1, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image1, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image1, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image1, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image1, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image1, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image1, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image1, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image1, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image1, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image1, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image1, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image1 , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image1 , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image1 , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image1 , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image1 , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image1 , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image1 , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image1 , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image1 , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image1 );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin
);
// Draw border around graph area.
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRectangleRange1($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image1;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image1, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image1, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image1, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $imageWidth-$rightMargin) $val=$imageWidth-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image1, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $imageHeight-$bottomMargin, $rgb);
}
function plotCircleRange1($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image1;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$frameHeight = $imageHeight - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $imageWidth-$rightMargin) $valX=$imageWidth-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($imageHeight-$bottomMargin)-$yParam*$scaleYCounter;
$grey = imagecolorallocate( $image1 , 154 , 154 , 154 );
imagefilledellipse($image1, $valX, $valY, 10, 10, $grey);
}
//---------------------------------------------------------------------------
// Custom vertical text-- just return value with dolor sign in front
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
?>
+378
View File
@@ -0,0 +1,378 @@
<?php
if (!class_exists('zc_math')) {
require_once('math.php');
}
/**
* Linear class
*
* The data format is array in array.
* Array containing number of coordinates and the coordinates contain an array of x and y.
*
* Example usage
* <code>
* $data = array(array($x1, $y1), array($x2, $y2));
* $linear = new zc_math_linear($data);
* $linear->calculate();
* // y = k*x + m
* echo $linear->k;
* echo $linear->m;
* </code>
*
* Linear regression formula found at {@link http://en.wikipedia.org/wiki/Numerical_methods_for_linear_least_squares#Computation }
*
* @author Han Lin Yap < http://zencodez.net/ >
* @copyright 2010 zencodez.net
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @package math
* @version 1.0 - 2010-07-29
*/
class zc_math_linear {
/**
* Contains the coordinates
* @var array
*/
public $data;
// needed for linear regression formula
public $sum_x;
public $sum_x2;
public $sum_y;
public $sum_xy;
public $number_of_coords;
// y = k*x + m
/**
* @var float
*/
public $k;
/**
* @var float
*/
public $m;
/**
* @param array $data
*/
function __construct($data) {
$this->data = $data;
}
/**
* Calculate and make formula
* To understand better, {@link http://en.wikipedia.org/wiki/Numerical_methods_for_linear_least_squares#Computation see formula}
* @since 1.0
*/
public function calculate() {
$this->number_of_coords = count($this->data);
$this->sum_x = $this->sum_by_formula($this->data, '$x[0]');
$this->sum_x2 = $this->sum_by_formula($this->data, 'pow($x[0],2)');
$this->sum_y = $this->sum_by_formula($this->data, '$x[1]');
$this->sum_xy = $this->sum_by_formula($this->data, '$x[0] * $x[1]');
$this->k = ($this->number_of_coords * $this->sum_xy - $this->sum_y * $this->sum_x) / ($this->number_of_coords * $this->sum_x2 - pow($this->sum_x, 2));
$this->m = ($this->sum_y * $this->sum_x2 - $this->sum_x * $this->sum_xy) / ($this->number_of_coords * $this->sum_x2 - pow($this->sum_x, 2));
}
/**
* Gets all by a formula
* Turn a multidimention array to a ordinary array with values
* @param array $data Multidimention array
* @param string $formula How to get what
* @return array Get values in multidimention by formula
* @since 1.0
*/
protected function _get_values_by_formula($data, $formula) {
return array_map(create_function('$x', 'return ' . $formula . ';'), $data);
}
/**
* Sum all by a formula
* @param array $data Data to sum
* @param string $formula Formula to sum
* @return float sum of $data by formula
* @since 1.0
*/
public function sum_by_formula($data, $formula) {
return array_sum($this->_get_values_by_formula($data, $formula));
}
}
/**
* Polynomial regression
*
* Example usage
* <code>
* $polynomial = new zc_math_polynomial($data);
* echo print_r($polynomial->calculate_coefficients());
* echo "<img src='" . $polynomial->render_formula() . "' />";
* echo "<a href='" . $polynomial->render_formula('wolframalpha') . "'>" . $polynomial->render_formula('') . "</a>";
* echo $polynomial->get_y(1200);
* </code>
* {@link http://www.trentfguidry.net/post/2009/06/30/Matrix-Crout-LU-decomposition.aspx }
* {@link http://www.trentfguidry.net/post/2009/07/19/Linear-multiple-regression.aspx }
* {@link http://www.trentfguidry.net/post/2009/08/01/Linear-regression-polynomial-coefficients.aspx }
* @author Han Lin Yap < http://zencodez.net/ >
* @copyright 2010 zencodez.net
* @license http://creativecommons.org/licenses/by-sa/3.0/
* @package math
* @version 1.0 - 2010-07-30
*/
class zc_math_polynomial extends zc_math_linear {
/**
* The calculated formula in array
* @var array
*/
public $result;
/**
* Order to calculate
* @var integer
*/
public $order;
/**
* Initialize
* @param array $data Format array(array($x1, $y2), array($x2, $y2))
* @param integer $order optional What order the formula should be
* @since 1.0
*/
function __construct($data, $order=4) {
$this->data = $data;
$this->set_order($order);
}
/**
* Change order
* @param integer $order What order the formula should be
* @since 1.0
*/
public function set_order($order) {
$this->order = $order;
}
/**
* Find the formula
* @param integer $order optional What order the formula should be
* @return array The found formula in array
* @since 1.0
*/
public function calculate_coefficients($order=false) {
if ($order)
$this->set_order($order);
$x = $this->_get_values_by_formula($this->data, '$x[0]');
$y = $this->_get_values_by_formula($this->data, '$x[1]');
$z = array_fill(0, count($y), array());
for ($i = 0 ; $i < count($y) ; $i++) {
for ($j = 0 ; $j <= $this->order ; $j++) {
$z[$i][$j] = pow($x[$i],$j);
}
}
$this->result = $this->_polynomial_regress($z, $y);
return $this->result;
}
/**
* Render formula for wolframalpha, google chart, url or plain math text
*
* NOTE! {@link zc_math_polynomial::calculate_coefficients()} before calling this method
* Example usage
* <code>
* render_formula()
* render_formula('wolframalpha')
* render_formula('')
* render_formula('text');
* </code>
*
* @param string $type optional Available types wolframalpha, text, google or ''
* @param string|boolean $replace_x optional If you want to customize x output
* @return string URL or text, depends on $type
* @uses zc_math_polynomial::calculate_coefficients() Call it before to have something to render
* @since 1.0
*/
public function render_formula($type='google', $replace_x=false) {
$formula = array();
$text = '';
if ($type=='text')
$text = '*';
if (!$replace_x)
$x = 'x';
else
$x = $replace_x;
foreach($this->result AS $k => $v) {
if ($k == 0)
$formula[] = $v[0];
elseif ($k == 1)
$formula[] = $v[0] . $text . $x;
elseif ($type!='google')
$formula[] = $v[0] . $text . $x . "^". $k;
else
$formula[] = $v[0] . "x^{". $k . "}";
}
if ($type=='wolframalpha')
return 'http://www.wolframalpha.com/input/?i=' . implode("+%2b+", $formula);
elseif ($type=='text')
return implode("%2b", $formula);
elseif ($type!='google')
return 'y = ' . implode(" + ", $formula);
else
return 'http://chart.apis.google.com/chart?cht=tx&chl=y+=+' . implode("%2b", $formula);
}
/**
* Get y value from x coordinate
*
* NOTE! {@link zc_math_polynomial::calculate_coefficients()} before calling this method
*
* @param integer $x X-coordinate
* @return integer Y-coordinate
* @uses zc_math_polynomial::calculate_coefficients() Call it before to have something to check on
* @since 1.0
*/
public function get_y($x) {
$sum = 0;
foreach($this->result AS $k => $v) {
if ($k == 0)
$sum += $v[0];
else
$sum += $v[0] * pow($x,$k);
}
return $sum;
}
private function _polynomial_regress($z, $y) {
$z_transpose = zc_math::matrix_transpose($z);
$l = zc_math::matrix_multiply($z_transpose, $z);
$r = zc_math::matrix_multiply($z_transpose, zc_math::matrix_transpose(array($y)));
return $this->_solve_for($l, $r);
}
private function _solve_for($l, $r) {
$resultMatrix = array_fill(0, count($l[0]), array());
$resDecomp = $this->_lu_decompose($l);
$nP = $resDecomp['PivotArray'];
$lMatrix = $resDecomp['L'];
$uMatrix = $resDecomp['U'];
for ($k = 0 ; $k < count($r[0]) ; $k++) {
$sum = 0.0;
$dMatrix = array_fill(0, count($l), array());
$dMatrix[0][0] = $r[$nP[0]][$k] / $lMatrix[0][0];
for ($i = 1; $i < count($l); $i++) {
$sum = 0.0;
for ($j = 0; $j < $i; $j++) {
$sum += $lMatrix[$i][$j] * $dMatrix[$j][0];
}
$dMatrix[$i][0] = ($r[$nP[$i]][$k] - $sum) / $lMatrix[$i][$i];
}
$resultMatrix[count($l) - 1][$k] = $dMatrix[count($l) - 1][0];
for ($i = count($l) - 2; $i >= 0; $i--) {
$sum = 0.0;
for ($j = $i + 1; $j < count($l); $j++) {
$sum += $uMatrix[$i][$j] * $resultMatrix[$j][$k];
}
$resultMatrix[$i][$k] = $dMatrix[$i][0] - $sum;
}
}
return $resultMatrix;
}
private function _lu_decompose($l) {
if (!defined('PHP_INT_MIN')) {
define('PHP_INT_MIN', ~PHP_INT_MAX);
}
$_rowCount = count($l);
$_columnCount = count($l[0]);
$uMatrix = array_fill(0, $_rowCount, array());
$lMatrix = array_fill(0, $_rowCount, array());
$workingUMatrix = $l;
$workingLMatrix = array_fill(0, $_rowCount, array());
$pivotArray = range(0, $_rowCount-1);
for ($i = 0; $i < $_rowCount; $i++) {
$maxRowRatio = PHP_INT_MIN;
$maxRow = -1;
$maxPosition = -1;
for ($j = $i; $j < $_rowCount; $j++) {
$rowSum = 0.0;
for ($k = $i; $k < $_columnCount; $k++) {
$rowSum += abs($workingUMatrix[$pivotArray[$j]][$k]);
}
$dCurrentRatio = abs($workingUMatrix[$pivotArray[$j]][$i]) / $rowSum;
if ($dCurrentRatio > $maxRowRatio) {
$maxRowRatio = abs($workingUMatrix[$pivotArray[$j]][$i] / $rowSum);
$maxRow = $pivotArray[$j];
$maxPosition = $j;
}
}
if ($maxRow != $pivotArray[$i]) {
$hold = $pivotArray[$i];
$pivotArray[$i] = $maxRow;
$pivotArray[$maxPosition] = $hold;
}
$rowFirstElementValue = $workingUMatrix[$pivotArray[$i]][$i];
for ($j = 0; $j < $_columnCount; $j++) {
if ($j < $i) {
$workingUMatrix[$pivotArray[$i]][$j] = 0.0;
} elseif ($j == $i) {
$workingLMatrix[$pivotArray[$i]][$j] = $rowFirstElementValue;
$workingUMatrix[$pivotArray[$i]][$j] = 1.0;
} else {
$workingUMatrix[$pivotArray[$i]][$j] /= $rowFirstElementValue;
$workingLMatrix[$pivotArray[$i]][$j] = 0.0;
}
}
for ($k = $i + 1; $k < $_rowCount; $k++) {
$rowFirstElementValue = $workingUMatrix[$pivotArray[$k]][$i];
for ($j = 0; $j < $_rowCount; $j++) {
if ($j < $i) {
$workingUMatrix[$pivotArray[$k]][$j] = 0.0;
} elseif ($j == $i) {
$workingLMatrix[$pivotArray[$k]][$j] = $rowFirstElementValue;
$workingUMatrix[$pivotArray[$k]][$j] = 0.0;
} else {
$workingUMatrix[$pivotArray[$k]][$j] = $workingUMatrix[$pivotArray[$k]][$j] - $rowFirstElementValue * $workingUMatrix[$pivotArray[$i]][$j];
}
}
}
}
for ($i = 0; $i < $_rowCount; $i++) {
for ($j = 0; $j < $_rowCount; $j++) {
$uMatrix[$i][$j] = $workingUMatrix[$pivotArray[$i]][$j];
$lMatrix[$i][$j] = $workingLMatrix[$pivotArray[$i]][$j];
}
}
return array('U' => $uMatrix, 'L' => $lMatrix, 'PivotArray' => $pivotArray);
}
}
?>
+40
View File
@@ -0,0 +1,40 @@
<?php //0046a
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);
?>
HR+cPsvG6JwOlU4nSU2C7I6706KUS1gTil9xxPEiePPcUDn0i+NCvmZQPhmbgxi1CvLSCyHQ79UE
7yOa0u704zG6k3EVn0njKnPnmDdPJlebNgLAM0oOdBoK4cR31j/FE1+7KyBg/9EslvhNLWWoXOKZ
PrxEzrR2KgXfqED4HU/C+4StNeD+JqMBEnpxXYnPdH4p94B1z+3NfDeYFLbAy+m5oTJKpyFDN9l3
ipqKHc42EDEe4XfP7AYwg2/VVARQ9u72uNtBq/nSaYbZrdooSCgXCt4KAyJXDgLd/+U+PfD7yJP1
2jd9gvFjFSEes/4afashdEoX8xbX0hFDOeZKBl5XAj3+Icumiz25xtAbEftYoltA6Vn5zjAGYumo
k2nuxh4XfjumDvJCoyjggkncbA75ErY/QXfDqS382UdjsPO8Xt6H2EcsJgnfMJj4as5hSP8a+oeZ
glEshtpojwXvzP3IGnHm+DN1LaZ4kPCCG4WcmEt71SHMJuHXDJ04AKmpf1EolschhuUy0AkWFm9o
JY7BhOUWEplWqTbqw8YRuagg9jhklC2dI4i3PINqIu5uPtq6bumUaZEKaQXJ6+RQ1lJ/FHh3pOCO
FU/Kd9JkTM8XmWRGvDfEzJ/3tah/lmXkRF4Q2x6NCCb14lZlgiqob6wnOhHYt0iz0sTo/N/Ebr81
cPzX6bWBS41S65+3JZdohmv56PFz21HdEiwwSDp3wwM0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LcKGZxylEkKsoJMk9Df0hP6
48G1W0wgBGjP5AFKb9k41N+Qn26KPY5SIZ1CFz5xitLVlgVsDihlek5JmruDqs0qyIbqyEDxqr8Y
aruqtxE7OkfRwBa+N8DAD75KPDc15pjb5iCdQ0i2d9Aznr9gXIjM8QCSeAKehxWJadPStW8Sj29o
oq8VF/UmuO9IxXTkQe80bgYWzCGnb4EDn6aC+r+d9F+vHZIzQxURqgHPBG/C/SHjW/mluFU2dD5m
B6H/VJbH0h2OfS9Sy3KchltzE5UJAcFd5Y7CKtuRhElPYNJCyLk1ShPGq5jksJ/MQlAb5icz+VtT
Kgr0K7u/ej1njDT5qUa9ojKJDVYJ703IIyj8yi1H6klqu/YOJR2bSO++KsqpX8ThWglNSSIxKIYx
O89dyOQT1TRKFjmtkYPMs9ukaQrLwEhhkth8ycxZ0Yx/q5bmvNXenQfDJab+E/jV91YG346JOOWq
GCcvqtuMpFisbzhcDLWahmTq2GLICpxZFKb9sMU3zzy5cy5DWPAt0hH+zks9KKQzUd1m69QlKDiH
3L0WRuzStiw6KbhX2OzckQjLCiX2IRRssb4VzKgg4zBHYsGYEZuATkRCu2blYLPrlJ+pa4scgn1P
YK9J+t1/cOOcPYdtlVEktsYwz9hXaBo7HrWd3sB5y9KOmjpaXT4MlKPbu789Pyq46nonSrnKJc8t
L83iM8y/SaZO0E7MJdsaBE9vHOMoQXIbTOiRuSYd90a5TEJFktyRxXCGU4nJqgD6okSGPSPyR+8U
yxGUS4s1iiFivT4JvrZ0GIAPnsr1FhkQVdQY3VCbqQXwEEJra8ikZ0Vz9npAg1/g8JtKwdVYxDXe
BiQB8OzQjwFVmnuhQ6rXnqnuJQDQ1ezDbrPcS5sfU+QannmI8QKvjcpZKqFYav1lLZJldnAxdBS9
7tcpCTKhMvMNmKXW+m3zd/S3ubzT0gO6LzTQioRqaaY997W5G5plwns+LAtNS0==
+148
View File
@@ -0,0 +1,148 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$image1Width = 969;
$image1Height = 330;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image1 = @imageCreate( $image1Width , $image1Height )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = imageColorAllocate( $image1 , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image1 , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image1, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image1, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image1, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image1, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image1, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image1, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image1, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image1, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image1, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image1, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image1, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image1, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image1, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image1, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image1, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image1, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image1, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image1 , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image1 , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image1 , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image1 , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image1 , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image1 , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image1 , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image1 , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image1 , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image1 );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$image1Width - $rightMargin,
$image1Height - $bottomMargin
);
// Draw border around graph area.
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRectangleRange1($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $image1Width;
global $leftMargin;
global $rightMargin;
global $image1Height;
global $topMargin;
global $bottomMargin;
global $image1;
$plot->resetData();
$frameWidth = $image1Width - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image1, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image1, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image1, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $image1Width-$rightMargin) $val=$image1Width-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image1, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $image1Height-$bottomMargin, $rgb);
}
function plotCircleRange1($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam)
{
global $plot;
global $image1Width;
global $leftMargin;
global $rightMargin;
global $image1Height;
global $topMargin;
global $bottomMargin;
global $image1;
$plot->resetData();
$frameWidth = $image1Width - $leftMargin - $rightMargin;
$frameHeight = $image1Height - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $image1Width-$rightMargin) $valX=$image1Width-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($image1Height-$bottomMargin)-$yParam*$scaleYCounter;
//$grey = imagecolorallocatealpha($image1, 150, 150, 150, 100);
$black = imagecolorallocate( $image1 , 0 , 0 , 0 );
imagefilledellipse($image1, $valX, $valY, 10, 10, $black);
}
?>
+256
View File
@@ -0,0 +1,256 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$imageWidth = 969;
$imageHeight = 330;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image = @imageCreate( $imageWidth , $imageHeight )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = imageColorAllocate( $image , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin
);
// Draw border around graph area.
imageRectangle
(
$image,
$leftMargin,
$topMargin,
$imageWidth - $rightMargin,
$imageHeight - $bottomMargin,
$colorMap[ "LightGray" ]
);
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRenderData( $data, $color )
{
global $plot;
$plot->resetData();
foreach ( $data as $point )
$plot->addData( $point[ 0 ], $point[ 1 ] );
$plot->setColor( $color );
$plot->autoScaleX_MinMax( 0 );
$plot->autoScaleY_MinMax( 1 );
}
//---------------------------------------------------------------------------
// Custom vertical text-- just return value with dolor sign in front
//---------------------------------------------------------------------------
function textCallback( $Value )
{
return number_format( $Value, 1 );
}
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotAddScale()
{
global $plot;
global $X_MajorScale;
global $X_MinorScale;
global $Y_MajorScale;
global $Y_MinorScale;
global $colorMap;
// Setup and draw minor horizontal scale (right to left).
$plot->SetX_MinorDivisionScale( $X_MinorScale );
$plot->SetX_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawX_MinorDivisions();
// Setup and draw minor vertical scale (top to bottom).
$plot->SetY_MinorDivisionScale( $Y_MinorScale );
$plot->SetY_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawY_MinorDivisions();
//----------------------------------
// Setup and draw major horizontal scale (right to left).
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetX_MajorDivisionExtention( 5 );
// Scale.
$plot->SetX_MajorDivisionScale( $X_MajorScale );
// Division lines are blue.
$plot->SetX_MajorDivisionColor( $colorMap[ "Gray80" ] );
// Text labels are dark gray.
$plot->SetX_MajorDivisionTextColor( $colorMap[ "Black" ] );
$plot->SetX_MajorTextCallback( "textCallback" );
// Draw it.
$plot->DrawX_MajorDivisions();
//----------------------------------
// Setup and draw major vertical scale (top to bottom)
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetY_MajorDivisionExtention( 5 );
// Scale.
$plot->SetY_MajorDivisionScale( $Y_MajorScale );
// Divisions in dark gray.
$plot->SetY_MajorDivisionColor( $colorMap[ "Gray80" ] );
$plot->SetY_MajorTextCallback( "textCallback" );
// Lables in dark gray.
$plot->SetY_MajorDivisionTextColor( $colorMap[ "Black" ] );
// Draw it.
$plot->DrawY_MajorDivisions();
}
function plotRenderRegression( $regression, $coefficients, $min, $max, $color )
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
for ( $xIndex = 0; $xIndex < $frameWidth; ++$xIndex )
{
$x = $xIndex * ( $max - $min ) / $frameWidth + $min;
$y = $regression->interpolate( $coefficients, $x );
$plot->addData( $x, $y );
}
$plot->setColor( $color );
$plot->renderWithLines();
}
function plotRectangleRange($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $imageWidth-$rightMargin) $val=$imageWidth-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $imageHeight-$bottomMargin, $rgb);
}
function plotCircleRange($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam)
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
global $imageHeight;
global $topMargin;
global $bottomMargin;
global $image;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
$frameHeight = $imageHeight - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $imageWidth-$rightMargin) $valX=$imageWidth-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($imageHeight-$bottomMargin)-$yParam*$scaleYCounter;
//$grey = imagecolorallocatealpha($image, 150, 150, 150, 100);
$black = imagecolorallocate( $image , 0 , 0 , 0 );
imagefilledellipse($image, $valX, $valY, 10, 10, $black);
}
?>
+148
View File
@@ -0,0 +1,148 @@
<?php
// Load the least-square regression class.
require_once('./polynomial/XY_Plot.php' );
//-----------------------------------------------------------
$image2Width = 969;
$image2Height = 330;
$leftMargin = 25;
$rightMargin = 50;
$topMargin = 25;
$bottomMargin = 40;
// Verticle scale
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 5;
$X_MajorScale = 0.1;
$X_MinorScale = $X_MajorScale / 5;
//-----------------------------------------------------------
// Create image
$image2 = @imageCreate( $image2Width , $image2Height )
or die( "Cannot Initialize new GD image stream" );
//---------------------------------
// Create basic color map
//---------------------------------
$colorMap = array();
//$colorMap[ "Background" ] = imageColorAllocate( $image2 , 0xDB , 0xB3 , 0xE6 );
$colorMap[ "Background" ] = imageColorAllocate( $image2 , 255, 255, 255 );
// Create a standard color palette
$colorMap[ "Black" ] = imagecolorallocate( $image2, 0, 0, 0 );
$colorMap[ "Red" ] = imagecolorallocate( $image2, 192, 0, 0 );
$colorMap[ "Green" ] = imagecolorallocate( $image2, 0, 192, 0 );
$colorMap[ "Blue" ] = imagecolorallocate( $image2, 0, 0, 192 );
$colorMap[ "Brown" ] = imagecolorallocate( $image2, 48, 48, 0 );
$colorMap[ "Cyan" ] = imagecolorallocate( $image2, 0, 192, 192 );
$colorMap[ "Purple" ] = imagecolorallocate( $image2, 192, 0, 192 );
$colorMap[ "LightGray" ] = imagecolorallocate( $image2, 192, 192, 192 );
$colorMap[ "DarkGray" ] = imagecolorallocate( $image2, 48, 48, 48 );
$colorMap[ "LightRed" ] = imagecolorallocate( $image2, 255, 0, 0 );
$colorMap[ "LightGreen" ] = imagecolorallocate( $image2, 0, 255, 0 );
$colorMap[ "LightBlue" ] = imagecolorallocate( $image2, 0, 0, 255 );
$colorMap[ "Yellow" ] = imagecolorallocate( $image2, 255, 255, 0 );
$colorMap[ "LightCyan" ] = imagecolorallocate( $image2, 0, 255, 255 );
$colorMap[ "LightPurple" ] = imagecolorallocate( $image2, 255, 0, 255 );
$colorMap[ "White" ] = imagecolorallocate( $image2, 255, 255, 255 );
$colorMap[ "DarkYellow" ] = imagecolorallocate( $image2, 255, 214, 0 );
$colorMap[ "Gray10" ] = imagecolorallocate( $image2 , 26 , 26 , 26 );
$colorMap[ "Gray20" ] = imagecolorallocate( $image2 , 51 , 51 , 51 );
$colorMap[ "Gray30" ] = imagecolorallocate( $image2 , 77 , 77 , 77 );
$colorMap[ "Gray40" ] = imagecolorallocate( $image2 , 102 , 102 , 102 );
$colorMap[ "Gray50" ] = imagecolorallocate( $image2 , 128 , 128 , 128 );
$colorMap[ "Gray60" ] = imagecolorallocate( $image2 , 154 , 154 , 154 );
$colorMap[ "Gray70" ] = imagecolorallocate( $image2 , 180 , 180 , 180 );
$colorMap[ "Gray80" ] = imagecolorallocate( $image2 , 205 , 205 , 205 );
$colorMap[ "Gray90" ] = imagecolorallocate( $image2 , 230 , 230 , 230 );
// New plot
$plot = new XY_PlotClass( $image2 );
// Setup boundaries
$plot->sizeWindow
(
$leftMargin,
$topMargin,
$image2Width - $rightMargin,
$image2Height - $bottomMargin
);
// Draw border around graph area.
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
function plotRectangleRange2($scaleFrom,$scaleTo,$xFrom,$xTo, $color)
{
global $plot;
global $image2Width;
global $leftMargin;
global $rightMargin;
global $image2Height;
global $topMargin;
global $bottomMargin;
global $image2;
$plot->resetData();
$frameWidth = $image2Width - $leftMargin - $rightMargin;
$scaleCounter = $frameWidth/($scaleTo-$scaleFrom);
if ($color == 'green_value')
$rgb = imagecolorallocatealpha($image2, 0, 255, 0, 100);
else if ($color == 'yellow_value')
$rgb = imagecolorallocatealpha($image2, 255, 255, 0, 100);
else if ($color == 'red_value')
$rgb = imagecolorallocatealpha($image2, 255, 0, 0, 100);
if ($leftMargin+$xTo*$scaleCounter > $image2Width-$rightMargin) $val=$image2Width-$rightMargin;
else $val=$leftMargin+$xTo*$scaleCounter;
imagefilledrectangle($image2, $leftMargin+$xFrom*$scaleCounter, $topMargin, $val, $image2Height-$bottomMargin, $rgb);
}
function plotCircleRange2($scaleXFrom,$scaleXTo,$scaleYFrom,$scaleYTo,$xParam,$yParam)
{
global $plot;
global $image2Width;
global $leftMargin;
global $rightMargin;
global $image2Height;
global $topMargin;
global $bottomMargin;
global $image2;
$plot->resetData();
$frameWidth = $image2Width - $leftMargin - $rightMargin;
$frameHeight = $image2Height - $topMargin - $bottomMargin;
$scaleXCounter = $frameWidth/($scaleXTo-$scaleXFrom);
$scaleYCounter = $frameHeight/($scaleYTo-$scaleYFrom);
if ($leftMargin+$xParam*$scaleXCounter > $image2Width-$rightMargin) $valX=$image2Width-$rightMargin;
else $valX=$leftMargin+$xParam*$scaleXCounter;
$valY=($image2Height-$bottomMargin)-$yParam*$scaleYCounter;
//$grey = imagecolorallocatealpha($image2, 150, 150, 150, 100);
$black = imagecolorallocate( $image2 , 0 , 0 , 0 );
imagefilledellipse($image2, $valX, $valY, 10, 10, $black);
}
?>
+102
View File
@@ -0,0 +1,102 @@
<?php
require_once('./polynomial/XY_Plot.php' );
function plotRenderData( $data, $color )
{
global $plot;
$plot->resetData();
foreach ( $data as $point )
$plot->addData( $point[ 0 ], $point[ 1 ] );
$plot->setColor( $color );
$plot->autoScaleX_MinMax( 0 );
$plot->autoScaleY_MinMax( 1 );
}
function textCallback( $Value )
{
return number_format( $Value, 1 );
}
function plotAddScale()
{
global $plot;
global $X_MajorScale;
global $X_MinorScale;
global $Y_MajorScale;
global $Y_MinorScale;
global $colorMap;
// Setup and draw minor horizontal scale (right to left).
$plot->SetX_MinorDivisionScale( $X_MinorScale );
$plot->SetX_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawX_MinorDivisions();
// Setup and draw minor vertical scale (top to bottom).
$plot->SetY_MinorDivisionScale( $Y_MinorScale );
$plot->SetY_MinorDivisionColor( $colorMap[ "Gray90" ] );
$plot->DrawY_MinorDivisions();
//----------------------------------
// Setup and draw major horizontal scale (right to left).
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetX_MajorDivisionExtention( 5 );
// Scale.
$plot->SetX_MajorDivisionScale( $X_MajorScale );
// Division lines are blue.
$plot->SetX_MajorDivisionColor( $colorMap[ "Gray80" ] );
// Text labels are dark gray.
$plot->SetX_MajorDivisionTextColor( $colorMap[ "Black" ] );
$plot->SetX_MajorTextCallback( "textCallback" );
// Draw it.
$plot->DrawX_MajorDivisions();
//----------------------------------
// Setup and draw major vertical scale (top to bottom)
//----------------------------------
// Extend lines 5 pixels past margins for label.
$plot->SetY_MajorDivisionExtention( 5 );
// Scale.
$plot->SetY_MajorDivisionScale( $Y_MajorScale );
// Divisions in dark gray.
$plot->SetY_MajorDivisionColor( $colorMap[ "Gray80" ] );
$plot->SetY_MajorTextCallback( "textCallback" );
// Lables in dark gray.
$plot->SetY_MajorDivisionTextColor( $colorMap[ "Black" ] );
// Draw it.
$plot->DrawY_MajorDivisions();
}
function plotRenderRegression( $regression, $coefficients, $min, $max, $color )
{
global $plot;
global $imageWidth;
global $leftMargin;
global $rightMargin;
$plot->resetData();
$frameWidth = $imageWidth - $leftMargin - $rightMargin;
for ( $xIndex = 0; $xIndex < $frameWidth; ++$xIndex )
{
$x = $xIndex * ( $max - $min ) / $frameWidth + $min;
$y = $regression->interpolate( $coefficients, $x );
$plot->addData( $x, $y );
}
$plot->setColor( $color );
$plot->renderWithLines();
}
?>