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

📄 phplot.php

📁 每个RFC 3261信息头有一个相应的存取标识. 但是,许多信息头拥有同样的形式。 例如。To和From的信息头都是由显示名和一个URI组成。 To和From信息头用来管理与处理NameAddr实例的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
		$this->ndx_bg_color= $this->SetIndexColor($this->bg_color);		$this->ndx_plot_bg_color= $this->SetIndexColor($this->plot_bg_color);		$this->ndx_title_color= $this->SetIndexColor($this->title_color);		$this->ndx_tick_color= $this->SetIndexColor($this->tick_color);		$this->ndx_label_color= $this->SetIndexColor($this->label_color);		$this->ndx_text_color= $this->SetIndexColor($this->text_color);		$this->ndx_light_grid_color= $this->SetIndexColor($this->light_grid_color);		$this->ndx_grid_color= $this->SetIndexColor($this->grid_color);		reset($this->error_bar_color);  		unset($ndx_error_bar_color);		$i = 0; 		while (list(, $col) = each($this->error_bar_color)) {		  $this->ndx_error_bar_color[$i] = $this->SetIndexColor($col);			$i++;		}		//reset($this->data_border_color);		unset($ndx_data_border_color);		$i = 0;		while (list(, $col) = each($this->data_border_color)) {			$this->ndx_data_border_color[$i] = $this->SetIndexColor($col);			$i++;		}		//reset($this->data_color); 		unset($ndx_data_color);		$i = 0;		while (list(, $col) = each($this->data_color)) {			$this->ndx_data_color[$i] = $this->SetIndexColor($col);			$i++;		}		return true;	}	function SetDefaultColors() {		$this->i_light = array(194,194,194);		$this->i_dark =  array(100,100,100);		$this->SetPlotBgColor(array(222,222,222));		$this->SetBackgroundColor(array(200,222,222)); //can use rgb values or "name" values		$this->SetLabelColor('black');		$this->SetTextColor('black');		$this->SetGridColor('black');		$this->SetLightGridColor(array(175,175,175));		$this->SetTickColor('black');		$this->SetTitleColor(array(0,0,0)); // Can be array or name		$this->data_color = array('blue','green','yellow','red','orange');		$this->error_bar_color = array('blue','green','yellow','red','orange');		$this->data_border_color = array('black');		$this->session_set = 1; //Mark it down for PHP session() usage.	}	function PrintImage() {		if ( ($this->browser_cache == 0) && ($this->is_inline == 0)) { //Submitted by Thiemo Nagel			header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');			header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . 'GMT');			header('Cache-Control: no-cache, must-revalidate');			header('Pragma: no-cache');		}		switch($this->file_format) {			case "png":				if ($this->is_inline == 0) {					Header('Content-type: image/png');				}				if ($this->is_inline == 1 && $this->output_file != "") {					ImagePng($this->img,$this->output_file);				} else {					ImagePng($this->img);				}				break;			case "jpg":				if ($this->is_inline == 0) {					Header('Content-type: image/jpeg');				}				if ($this->is_inline == 1 && $this->output_file != "") {					ImageJPEG($this->img,$this->output_file);				} else {					ImageJPEG($this->img);				}				break;			case "gif":				if ($this->is_inline == 0) {					Header('Content-type: image/gif');				}				if ($this->is_inline == 1 && $this->output_file != "") {					ImageGIF($this->img,$this->output_file);				} else {					ImageGIF($this->img);				}				break;			case "wbmp":				if ($this->is_inline == 0) {					Header('Content-type: image/wbmp');				}				if ($this->is_inline == 1 && $this->output_file != "") {					ImageWBMP($this->img,$this->output_file);				} else {					ImageWBMP($this->img);				}				break;			default:				$this->PrintError('Please select an image type!<br>');				break;		}		ImageDestroy($this->img);		return true;	}	function DrawBackground() {		//if ($this->img == "") { $this->InitImage(); };		if ($this->background_done == 0) { //Don't draw it twice if drawing two plots on one image			ImageFilledRectangle($this->img, 0, 0,				$this->image_width, $this->image_height, $this->ndx_bg_color);			$this->background_done = 1;		}		return true;	}	function DrawImageBorder() {		switch ($this->image_border_type) {			case "raised":				ImageLine($this->img,0,0,$this->image_width-1,0,$this->ndx_i_light);				ImageLine($this->img,1,1,$this->image_width-2,1,$this->ndx_i_light);				ImageLine($this->img,0,0,0,$this->image_height-1,$this->ndx_i_light);				ImageLine($this->img,1,1,1,$this->image_height-2,$this->ndx_i_light);				ImageLine($this->img,$this->image_width-1,0,$this->image_width-1,$this->image_height-1,$this->ndx_i_dark);				ImageLine($this->img,0,$this->image_height-1,$this->image_width-1,$this->image_height-1,$this->ndx_i_dark);				ImageLine($this->img,$this->image_width-2,1,$this->image_width-2,$this->image_height-2,$this->ndx_i_dark);				ImageLine($this->img,1,$this->image_height-2,$this->image_width-2,$this->image_height-2,$this->ndx_i_dark);			break;			case "plain":				ImageLine($this->img,0,0,$this->image_width,0,$this->ndx_i_dark);				ImageLine($this->img,$this->image_width-1,0,$this->image_width-1,$this->image_height,$this->ndx_i_dark);				ImageLine($this->img,$this->image_width-1,$this->image_height-1,0,$this->image_height-1,$this->ndx_i_dark);				ImageLine($this->img,0,0,0,$this->image_height,$this->ndx_i_dark);			break;			default:			break;		}		return true;	}	function SetPlotBorderType($which_pbt) {		$this->plot_border_type = $which_pbt; //left, none, anything else=full	}	function SetImageBorderType($which_sibt) {		$this->image_border_type = $which_sibt; //raised, plain	}	function SetDrawPlotAreaBackground($which_dpab) {		$this->draw_plot_area_background = $which_dpab;  // 1=true or anything else=false	}	function SetDrawDataLabels($which_ddl) {  //Draw next to datapoints		$this->draw_data_labels = $which_ddl;  // 1=true or anything else=false	}	function SetDrawXDataLabels($which_dxdl) {  //Draw on X Axis		$this->draw_x_data_labels = $which_dxdl;  // 1=true or anything else=false	}	function SetDrawYGrid($which_dyg) {		$this->draw_y_grid = $which_dyg;  // 1=true or anything else=false	}	function SetDrawXGrid($which_dxg) {		$this->draw_x_grid = $which_dxg;  // 1=true or anything else=false	}	function SetYGridLabelType($which_yglt) {		$this->y_grid_label_type = $which_yglt;		return true;	}	function SetXGridLabelType($which_xglt) {		$this->x_grid_label_type = $which_xglt;		return true;	}	function SetXLabel($xlbl) {		$this->x_label_txt = $xlbl;		return true;	}	function SetYLabel($ylbl) {		$this->y_label_txt = $ylbl;		return true;	}	function SetTitle($title) {		$this->title_txt = $title;		return true;	}	//function SetLabels($xlbl,$ylbl,$title) {	//	$this->title_txt = $title;	//	$this->x_label_txt = $xlbl;	//	$this->y_label_txt = $ylbl;	//}	function DrawLabels() {		$this->DrawTitle();		$this->DrawXLabel();		$this->DrawYLabel();		return true;	}	function DrawXLabel() {		if ($this->use_ttf == 1) { 			$xpos = $this->xtr(($this->plot_max_x + $this->plot_min_x)/2.0) ;			$ypos = $this->ytr($this->plot_min_y) + $this->x_label_height/2.0;			$this->DrawText($this->x_label_ttffont, $this->x_label_angle,				$xpos, $ypos, $this->ndx_label_color, $this->x_label_ttffont_size, $this->x_label_txt,'center');		} else { 			//$xpos = 0.0 - (ImageFontWidth($this->small_font)*strlen($this->x_label_txt)/2.0) + $this->xtr(($this->plot_max_x+$this->plot_min_x)/2.0) ;			$xpos = 0.0 + $this->xtr(($this->plot_max_x+$this->plot_min_x)/2.0) ;			$ypos = ($this->ytr($this->plot_min_y) + $this->x_label_height/2);			$this->DrawText($this->small_font, $this->x_label_angle, 				$xpos, $ypos, $this->ndx_label_color, "", $this->x_label_txt, 'center');		}		return true;	}	function DrawYLabel() {		if ($this->use_ttf == 1) { 			$size = $this->TTFBBoxSize($this->y_label_ttffont_size, 90, $this->y_label_ttffont, $this->y_label_txt);			$xpos = 8 + $size[0];			$ypos = ($size[1])/2 + $this->ytr(($this->plot_max_y + $this->plot_min_y)/2.0) ;			$this->DrawText($this->y_label_ttffont, 90,				$xpos, $ypos, $this->ndx_label_color, $this->y_label_ttffont_size, $this->y_label_txt);		} else { 			$xpos = 8;			$ypos = (($this->small_font_width*strlen($this->y_label_txt)/2.0) +					$this->ytr(($this->plot_max_y + $this->plot_min_y)/2.0) );			$this->DrawText($this->small_font, 90,				$xpos, $ypos, $this->ndx_label_color, $this->y_label_ttffont_size, $this->y_label_txt);		}		return true;	}	function DrawText($which_font,$which_angle,$which_xpos,$which_ypos,$which_color,$which_size,$which_text,$which_halign='left',$which_valign='') {		if ($this->use_ttf == 1 ) { 			$size = $this->TTFBBoxSize($which_size, $which_angle, $which_font, $which_text); 			if ($which_valign == 'bottom') { 				$which_ypos = $which_ypos + ImageFontHeight($which_font);			}			if ($which_halign == 'center') { 				$which_xpos = $which_xpos - $size[0]/2;			}			ImageTTFText($this->img, $which_size, $which_angle, 				$which_xpos, $which_ypos, $which_color, $which_font, $which_text); 		} else { 			if ($which_valign == 'top') { 				$which_ypos = $which_ypos - ImageFontHeight($which_font);			}			$which_text = ereg_replace("\r","",$which_text);			$str = split("\n",$which_text); //multiple lines submitted by Remi Ricard			$height = ImageFontHeight($which_font);			$width = ImageFontWidth($which_font);			if ($which_angle == 90) {  //Vertical Code Submitted by Marlin Viss				for($i=0;$i<count($str);$i++) { 					ImageStringUp($this->img, $which_font, ($i*$height + $which_xpos), $which_ypos, $str[$i], $which_color);				} 			} else {				for($i=0;$i<count($str);$i++) { 					if ($which_halign == 'center') {                     	$xpos = $which_xpos - strlen($str[$i]) * $width/2; 						ImageString($this->img, $which_font, $xpos, ($i*$height + $which_ypos), $str[$i], $which_color);					} else { 						ImageString($this->img, $which_font, $which_xpos, ($i*$height + $which_ypos), $str[$i], $which_color); 					}				} 			}		} 		return true; 	}	function DrawTitle() {		if ($this->use_ttf == 1 ) { 			$xpos = ($this->plot_area[0] + $this->plot_area_width / 2);			$ypos = $this->y_top_margin/2;			$this->DrawText($this->title_ttffont, $this->title_angle, 				$xpos, $ypos, $this->ndx_title_color, $this->title_ttffont_size, $this->title_txt,'center'); 		} else { 			$xpos = ($this->plot_area[0] + $this->plot_area_width / 2);			$ypos = ImageFontHeight($this->title_font); 			$this->DrawText($this->title_font, $this->title_angle, 				$xpos, $ypos, $this->ndx_title_color, '', $this->title_txt,'center'); 		} 		return true; 	}	function DrawPlotAreaBackground() {		ImageFilledRectangle($this->img,$this->plot_area[0],			$this->plot_area[1],$this->plot_area[2],$this->plot_area[3],			$this->ndx_plot_bg_color);	}	function SetBackgroundColor($which_color) {		$this->bg_color= $which_color;		$this->ndx_bg_color= $this->SetIndexColor($which_color);		return true;	}	function SetPlotBgColor($which_color) {		$this->plot_bg_color= $which_color;		$this->ndx_plot_bg_color= $this->SetIndexColor($which_color);		return true;	}	function SetShading($which_s) { 		$this->shading = $which_s;		return true;	}	function SetTitleColor($which_color) {		$this->title_color= $which_color;		$this->ndx_title_color= $this->SetIndexColor($which_color);		return true;	}	function SetTickColor ($which_color) {		$this->tick_color= $which_color;		$this->ndx_tick_color= $this->SetIndexColor($which_color);		return true;	}	function SetLabelColor ($which_color) {		$this->label_color= $which_color;		$this->ndx_label_color= $this->SetIndexColor($which_color);		return true;	}	function SetTextColor ($which_color) {		$this->text_color= $which_color;		$this->ndx_text_color= $this->SetIndexColor($which_color);		return true;	}	function SetLightGridColor ($which_color) {		$this->light_grid_color= $which_color;		$this->ndx_light_grid_color= $this->SetIndexColor($which_color);		return true;	}	function SetGridColor ($which_color) {		$this->grid_color = $which_color;		$this->ndx_grid_color= $this->SetIndexColor($which_color);		return true;	}	function SetCharacterHeight() {		//to be set		return true;	}	function SetPlotType($which_pt) {		$accepted = "bars,lines,linepoints,area,points,pie,thinbarline";		$asked = trim($which_pt);		if (eregi($asked, $accepted)) {			$this->plot_type = $which_pt;			return true;		} else {			$this->DrawError('$which_pt not an acceptable plot type');			return false;		}	}	function FindDataLimits() {		//Text-Data is different than data-data graphs. For them what		// we have, instead of X values, is # of records equally spaced on data.		//text-data is passed in as $data[] = (title,y1,y2,y3,y4,...)		//data-data is passed in as $data[] = (title,x,y1,y2,y3,y4,...) 		$this->number_x_points = count($this->data_values);		switch ($this->data_type) {			case "text-data":				$minx = 0; //valid for BAR TYPE GRAPHS ONLY				$maxx = $this->number_x_points - 1 ;  //valid for BAR TYPE GRAPHS ONLY				$miny = (double) $this->data_values[0][1];				$maxy = $miny;				if ($this->draw_x_data_labels == "") { 					$this->draw_x_data_labels = 1;  //labels_note1: prevent both data labels and x-axis labels being both drawn and overlapping				}			break;			default:  //Everything else: data-data, etc.				$maxx = $this->data_values[0][1];				$minx = $maxx;				$miny = $this->data_values[0][2];				$maxy = $miny;				$maxy = $miny;			break;		}		$max_records_per_group = 0;		$total_records = 0;		$mine = 0; //Maximum value for the -error bar (assume error bars always > 0) 		$maxe = 0; //Maximum value for the +error bar (assume error bars always > 0) 

⌨️ 快捷键说明

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