⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpgraph.php

📁 极限网络智能办公系统 - Office Automation 2008 官方100% 源码
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
 

class LanguageConv
{

	private $g2312 = null;

	public function Convert( $aTxt, $aFF )
	{
		if ( LANGUAGE_GREEK )
		{
			if ( GREEK_FROM_WINDOWS )
			{
				$unistring = LanguageConv::gr_win2uni( $aTxt );
				return $unistring;
			}
			$unistring = LanguageConv::gr_iso2uni( $aTxt );
			return $unistring;
		}
		if ( LANGUAGE_CYRILLIC )
		{
			if ( CYRILLIC_FROM_WINDOWS && ( !defined( "LANGUAGE_CHARSET" ) && stristr( LANGUAGE_CHARSET, "windows-1251" ) ) )
			{
				$aTxt = convert_cyr_string( $aTxt, "w", "k" );
			}
			if ( !defined( "LANGUAGE_CHARSET" ) && stristr( LANGUAGE_CHARSET, "koi8-r" ) || stristr( LANGUAGE_CHARSET, "windows-1251" ) )
			{
				$isostring = convert_cyr_string( $aTxt, "k", "i" );
				$unistring = LanguageConv::iso2uni( $isostring );
				return $unistring;
			}
			$unistring = $aTxt;
			return $unistring;
		}
		if ( $aFF === FF_SIMSUN )
		{
			if ( $this->g2312 == null )
			{
				include_once( "jpgraph_gb2312.php" );
				$this->g2312 = new GB2312toUTF8( );
			}
			return $this->g2312->gb2utf8( $aTxt );
		}
		if ( $aFF === FF_CHINESE )
		{
			if ( !function_exists( "iconv" ) )
			{
				JpGraphError::raisel( 25006 );
			}
			return iconv( "BIG5", "UTF-8", $aTxt );
		}
		if ( ASSUME_EUCJP_ENCODING && ( $aFF == FF_MINCHO || $aFF == FF_GOTHIC || $aFF == FF_PMINCHO || $aFF == FF_PGOTHIC ) )
		{
			if ( !function_exists( "mb_convert_encoding" ) )
			{
				JpGraphError::raisel( 25127 );
			}
			return mb_convert_encoding( $aTxt, "UTF-8", "EUC-JP" );
		}
		return $aTxt;
	}

	public static function iso2uni( $isoline )
	{
		$uniline = "";
		$i = 0;
		for ( ;	$i < strlen( $isoline );	++$i	)
		{
			$thischar = substr( $isoline, $i, 1 );
			$charcode = ord( $thischar );
			$uniline .= 175 < $charcode ? "&#".( 1040 + ( $charcode - 176 ) ).";" : $thischar;
		}
		return $uniline;
	}

	public static function gr_iso2uni( $isoline )
	{
		$uniline = "";
		$i = 0;
		for ( ;	$i < strlen( $isoline );	++$i	)
		{
			$thischar = substr( $isoline, $i, 1 );
			$charcode = ord( $thischar );
			$uniline .= 179 < $charcode && $charcode != 183 && $charcode != 187 && $charcode != 189 ? "&#".( 900 + ( $charcode - 180 ) ).";" : $thischar;
		}
		return $uniline;
	}

	public static function gr_win2uni( $winline )
	{
		$uniline = "";
		$i = 0;
		for ( ;	$i < strlen( $winline );	++$i	)
		{
			$thischar = substr( $winline, $i, 1 );
			$charcode = ord( $thischar );
			if ( $charcode == 161 || $charcode == 162 )
			{
				$uniline .= "&#".( 740 + $charcode ).";";
			}
			else
			{
				$uniline .= !( 183 < $charcode ) && !( $charcode != 187 ) && $charcode != 189 || $charcode == 180 ? "&#".( 900 + ( $charcode - 180 ) ).";" : $thischar;
			}
		}
		return $uniline;
	}

}

class JpgTimer
{

	private $start = NULL;
	private $idx = NULL;

	public function JpgTimer( )
	{
		$this->idx = 0;
	}

	public function Push( )
	{
		list( $ms, $s ) = explode( " ", microtime( ) );
		$this->start[$this->idx++] = floor( $ms * 1000 ) + 1000 * $s;
	}

	public function Pop( )
	{
		assert( 0 < $this->idx );
		list( $ms, $s ) = explode( " ", microtime( ) );
		$etime = floor( $ms * 1000 ) + 1000 * $s;
		$this->idx--;
		return $etime - $this->start[$this->idx];
	}

}

class DateLocale
{

	public $iLocale = "C";
	private $iDayAbb = null;
	private $iShortDay = null;
	private $iShortMonth = null;
	private $iMonthName = null;

	public function DateLocale( )
	{
		settype( &$this->iDayAbb, "array" );
		settype( &$this->iShortDay, "array" );
		settype( &$this->iShortMonth, "array" );
		settype( &$this->iMonthName, "array" );
		$this->Set( "C" );
	}

	public function Set( $aLocale )
	{
		if ( in_array( $aLocale, array_keys( $this->iDayAbb ) ) )
		{
			$this->iLocale = $aLocale;
			return TRUE;
		}
		$pLocale = setlocale( LC_TIME, 0 );
		$res = @setlocale( LC_TIME, $aLocale );
		if ( !$res )
		{
			JpGraphError::raisel( 25007, $aLocale );
			return FALSE;
		}
		$this->iLocale = $aLocale;
		$i = 0;
		$ofs = 0 - strftime( "%w" );
		for ( ;	$i < 7;	++$i,	++$ofs	)
		{
			$day = strftime( "%a", strtotime( "{$ofs} day" ) );
			$day[0] = strtoupper( $day[0] );
			$this->iDayAbb[$aLocale][] = $day[0];
			$this->iShortDay[$aLocale][] = $day;
		}
		$i = 1;
		for ( ;	$i <= 12;	++$i	)
		{
			list( $short, $full ) = explode( "|", strftime( "%b|%B", strtotime( "2001-".$i."-01" ) ) );
			$this->iShortMonth[$aLocale][] = ucfirst( $short );
			$this->iMonthName[$aLocale][] = ucfirst( $full );
		}
		setlocale( LC_TIME, $pLocale );
		return TRUE;
	}

	public function GetDayAbb( )
	{
		return $this->iDayAbb[$this->iLocale];
	}

	public function GetShortDay( )
	{
		return $this->iShortDay[$this->iLocale];
	}

	public function GetShortMonth( )
	{
		return $this->iShortMonth[$this->iLocale];
	}

	public function GetShortMonthName( $aNbr )
	{
		return $this->iShortMonth[$this->iLocale][$aNbr];
	}

	public function GetLongMonthName( $aNbr )
	{
		return $this->iMonthName[$this->iLocale][$aNbr];
	}

	public function GetMonth( )
	{
		return $this->iMonthName[$this->iLocale];
	}

}

class Footer
{

	public $iLeftMargin = 3;
	public $iRightMargin = 3;
	public $iBottomMargin = 3;
	public $left = NULL;
	public $center = NULL;
	public $right = NULL;

	public function Footer( )
	{
		$this->left = new Text( );
		$this->left->ParagraphAlign( "left" );
		$this->center = new Text( );
		$this->center->ParagraphAlign( "center" );
		$this->right = new Text( );
		$this->right->ParagraphAlign( "right" );
	}

	public function SetMargin( $aLeft = 3, $aRight = 3, $aBottom = 3 )
	{
		$this->iLeftMargin = $aLeft;
		$this->iRightMargin = $aRight;
		$this->iBottomMargin = $aBottom;
	}

	public function Stroke( $aImg )
	{
		$y = $aImg->height - $this->iBottomMargin;
		$x = $this->iLeftMargin;
		$this->left->Align( "left", "bottom" );
		$this->left->Stroke( $aImg, $x, $y );
		$x = ( $aImg->width - $this->iLeftMargin - $this->iRightMargin ) / 2;
		$this->center->Align( "center", "bottom" );
		$this->center->Stroke( $aImg, $x, $y );
		$x = $aImg->width - $this->iRightMargin;
		$this->right->Align( "right", "bottom" );
		$this->right->Stroke( $aImg, $x, $y );
	}

}

class Graph
{

	public $cache = null;
	public $img = null;
	public $plots = array( );
	public $y2plots = array( );
	public $ynplots = array( );
	public $xscale = null;
	public $yscale = null;
	public $y2scale = null;
	public $ynscale = array( );
	public $iIcons = array( );
	public $cache_name = NULL;
	public $xgrid = null;
	public $ygrid = null;
	public $y2grid = null;
	public $doframe = true;
	public $frame_color = array
	(
		0 => 0,
		1 => 0,
		2 => 0
	);
	public $frame_weight = 1;
	public $boxed = false;
	public $box_color = array
	(
		0 => 0,
		1 => 0,
		2 => 0
	);
	public $box_weight = 1;
	public $doshadow = false;
	public $shadow_width = 4;
	public $shadow_color = array
	(
		0 => 102,
		1 => 102,
		2 => 102
	);
	public $xaxis = null;
	public $yaxis = null;
	public $y2axis = null;
	public $ynaxis = array( );
	public $margin_color = array
	(
		0 => 200,
		1 => 200,
		2 => 200
	);
	public $plotarea_color = array
	(
		0 => 255,
		1 => 255,
		2 => 255
	);
	public $title = NULL;
	public $subtitle = NULL;
	public $subsubtitle = NULL;
	public $axtype = "linlin";
	public $xtick_factor = NULL;
	public $texts = null;
	public $y2texts = null;
	public $lines = null;
	public $y2lines = null;
	public $bands = null;
	public $y2bands = null;
	public $text_scale_off = 0;
	public $text_scale_abscenteroff = -1;
	public $background_image = "";
	public $background_image_type = -1;
	public $background_image_format = "png";
	public $background_image_bright = 0;
	public $background_image_contr = 0;
	public $background_image_sat = 0;
	public $image_bright = 0;
	public $image_contr = 0;
	public $image_sat = 0;
	public $inline = NULL;
	public $showcsim = 0;
	public $csimcolor = "red";
	public $grid_depth = DEPTH_BACK;
	public $iAxisStyle = AXSTYLE_SIMPLE;
	public $iCSIMdisplay = false;
	public $iHasStroked = false;
	public $footer = NULL;
	public $csimcachename = "";
	public $csimcachetimeout = 0;
	public $iDoClipping = false;
	public $y2orderback = true;
	public $tabtitle = NULL;
	public $bkg_gradtype = -1;
	public $bkg_gradstyle = BGRAD_MARGIN;
	public $bkg_gradfrom = "navy";
	public $bkg_gradto = "silver";
	public $titlebackground = false;
	public $titlebackground_color = "lightblue";
	public $titlebackground_style = 1;
	public $titlebackground_framecolor = "blue";
	public $titlebackground_framestyle = 2;
	public $titlebackground_frameweight = 1;
	public $titlebackground_bevelheight = 3;
	public $titlebkg_fillstyle = TITLEBKG_FILLSTYLE_SOLID;
	public $titlebkg_scolor1 = "black";
	public $titlebkg_scolor2 = "white";
	public $framebevel = false;
	public $framebeveldepth = 2;
	public $framebevelborder = false;
	public $framebevelbordercolor = "black";
	public $framebevelcolor1 = "white@0.4";
	public $framebevelcolor2 = "black@0.4";
	public $background_image_mix = 100;
	public $background_cflag = "";
	public $background_cflag_type = BGIMG_FILLPLOT;
	public $background_cflag_mix = 100;
	public $iImgTrans = false;
	public $iImgTransHorizon = 100;
	public $iImgTransSkewDist = 150;
	public $iImgTransDirection = 1;
	public $iImgTransMinSize = true;
	public $iImgTransFillColor = "white";
	public $iImgTransHighQ = false;
	public $iImgTransBorder = false;
	public $iImgTransHorizonPos = 0.5;
	protected $iYAxisDeltaPos = 50;
	protected $iIconDepth = DEPTH_BACK;
	protected $iAxisLblBgType = 0;
	protected $iXAxisLblBgFillColor = "lightgray";
	protected $iXAxisLblBgColor = "black";
	protected $iYAxisLblBgFillColor = "lightgray";
	protected $iYAxisLblBgColor = "black";
	protected $iTables = NULL;

	public function Graph( $aWidth = 300, $aHeight = 200, $aCachedName = "", $aTimeOut = 0, $aInline = true )
	{
		global $gJpgBrandTiming;
		if ( $gJpgBrandTiming )
		{
			global $tim;
			$tim = new JpgTimer( );
			$tim->Push( );
		}
		if ( is_numeric( $aWidth ) )
		{
		}
		if ( !is_numeric( $aHeight ) )
		{
			JpGraphError::raisel( 25008 );
		}
		if ( $aCachedName == "auto" )
		{
			$aCachedName = genimgname( );
		}
		$this->inline = $aInline;
		$this->img = new RotImage( $aWidth, $aHeight );
		$this->cache = new ImgStreamCache( $this->img );
		$this->cache->SetTimeOut( $aTimeOut );
		$this->title = new Text( );
		$this->title->ParagraphAlign( "center" );
		$this->title->SetFont( FF_FONT2, FS_BOLD );
		$this->title->SetMargin( 3 );
		$this->title->SetAlign( "center" );
		$this->subtitle = new Text( );
		$this->subtitle->ParagraphAlign( "center" );
		$this->subtitle->SetMargin( 2 );
		$this->subtitle->SetAlign( "center" );
		$this->subsubtitle = new Text( );
		$this->subsubtitle->ParagraphAlign( "center" );
		$this->subsubtitle->SetMargin( 2 );
		$this->subsubtitle->SetAlign( "center" );
		$this->legend = new Legend( );
		$this->footer = new Footer( );
		$aCachedName = str_replace( "?", "_", $aCachedName );
		if ( $aCachedName != "" && READ_CACHE && $aInline && $this->cache->GetAndStream( $aCachedName ) )
		{
			exit( );
		}
		$this->cache_name = $aCachedName;
		$this->SetTickDensity( );
		$this->tabtitle = new GraphTabTitle( );
	}

	public function Set3DPerspective( $aDir = 1, $aHorizon = 100, $aSkewDist = 120, $aQuality = false, $aFillColor = "#FFFFFF", $aBorder = false, $aMinSize = true, $aHorizonPos = 0.5 )
	{
		$this->iImgTrans = true;
		$this->iImgTransHorizon = $aHorizon;
		$this->iImgTransSkewDist = $aSkewDist;
		$this->iImgTransDirection = $aDir;
		$this->iImgTransMinSize = $aMinSize;
		$this->iImgTransFillColor = $aFillColor;
		$this->iImgTransHighQ = $aQuality;
		$this->iImgTransBorder = $aBorder;
		$this->iImgTransHorizonPos = $aHorizonPos;
	}

	public function SetImgFormat( $aFormat, $aQuality = 75 )
	{
		$this->img->SetImgFormat( $aFormat, $aQuality );
	}

	public function SetGridDepth( $aDepth )
	{
		$this->grid_depth = $aDepth;
	}

	public function SetIconDepth( $aDepth )
	{
		$this->iIconDepth = $aDepth;
	}

	public function SetAngle( $aAngle )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -