"; //echo "filelist[$j][type]={$filelist[$j][type]}
"; //echo "startTime={$startTime}
"; //echo "endTime={$endTime}"; $sql="select Duration,csta_datetime FROM CSTA_DB.mscDetailData where key_type={$filelist[$j][type]} and (csta_datetime >='{$startTime}' and csta_datetime <='{$endTime}')"; //echo "
sql=$sql
"; $res=@mysqli_query($pubConn,$sql); if(!($res)) { $num=0; } else { $num=mysqli_num_rows($res); //echo "num=$num
"; } for($i=0;$i<$num;$i++) { $row=mysqli_fetch_array($res); //echo "::: $row
"; $start=strtotime($startTime); //echo "startTime=$startTime start=$start
"; $rowt=strtotime($row[1]); //echo "rowt=$rowt row[1]={$row[1]}
"; $dif=$rowt-$start; //echo "
dif=$dif
"; $instance=floor($dif/(60*60*24)); //echo "instance={$instance}"; //echo "
row[0]={$row[0]}
"; $data[$j][$instance] += $row[0]+0; //echo "
data[$j][$instance]={$data[$j][$instance]}
"; } } } return $data; } ?> 1) $table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")))." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y"))); else $table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); echo "
$table_title
"; echo ""; echo ""; echo ""; if($num !=0) { if($merge==1) { $num+=1; } } if($num==0) { if($merge==1) { $num=1; } } echo ""; echo ""; echo ""; echo ""; for($j=1;$j < 13;$j++) { //echo "filelist[$j][name]={$filelist[$j][name]}
"; if(strcmp($filelist[$j][name]," ")) { //echo "55555555555555555555555555555555555
"; echo ""; } } if($num1==0) { echo ""; } else if($num==1) { if($merge!=0) { echo ""; } } else if($merge==1) { echo ""; } for($i=$sel_date_to,$k=($slot-1);$i <=($sel_date_to+($slot-1));$i++,$k--) { echo ""; $now=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y"))); echo ""; for($j=1;$j<13;$j++) { if(strcmp($filelist[$j][name]," ")) { echo ""; $total+=$data1[$j][$k]; } } if($num==1) { if($merge==1) { echo ""; } } else { if($merge==1) { echo ""; $total=0; } } if($num1==0) { if($merge==0) { echo ""; } } echo ""; } echo "
 Erlang
Time{$filelist[$j][name]}----total
{$now}{$data1[$j][$k]}--$total--
"; } //时间间隔 $day=$sel_date_from-$sel_date_to+1; $day_num=720/($day+1); //画图 // //=======================================================================================| //=========== Draw the Graphics =============| //=======================================================================================| $sizex=800; if($csta_type==0) $sizey=430; else $sizey=380; $bgcolor=F8F8F8; $fgcolor=000000; $im = ImageCreate ($sizex, $sizey); $background_color = ImageColorAllocate ($im, hexdec(substr($bgcolor, 0, 2)), hexdec(substr($bgcolor, 2, 2)), hexdec(substr($bgcolor, 4, 2))); $text_color = ImageColorAllocate ($im, hexdec(substr($fgcolor, 0, 2)), hexdec(substr($fgcolor, 2, 2)), hexdec(substr($fgcolor, 4, 2))); $black_color=ImageColorAllocate($im,0,0,0); $white_color=ImageColorAllocate($im,255,255,255); //===background==== ImageFilledRectangle($im,0,0,$sizex,$sizey,ImageColorAllocate ($im, 198, 198, 198)); ImageFilledRectangle($im,2,2,$sizex,$sizey,ImageColorAllocate ($im, 130, 130, 130)); $pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1); Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130)); $pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4); Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130)); ImageFilledRectangle($im,2,2,$sizex-3,$sizey-3,$background_color); //===border===== $xBgn=60; $yBgn=25; $xEnd=780; $yEnd=275; $unitXPix=30; ImageLine($im, $xBgn, $yBgn, $xBgn, $yEnd, $text_color); ImageLine($im, $xBgn, $yBgn, $xEnd, $yBgn, $text_color); ImageLine($im, $xBgn, $yEnd, $xEnd, $yEnd, $text_color); ImageLine($im, $xEnd, $yBgn, $xEnd, $yEnd, $text_color); //===draw the label block==== $color[1]=ImageColorAllocate($im,0x99,0x22,0x33); $color[2]=ImageColorAllocate($im,0x99,0x00,0xcc); $color[3]=ImageColorAllocate($im,0x99,0x99,0x00); $color[4]=ImageColorAllocate($im,0x99,0x99,0x99); $color[5]=ImageColorAllocate($im,0x99,0xff,0x33); $color[6]=ImageColorAllocate($im,0xff,0x99,0x66); $color[7]=ImageColorAllocate($im,0xff,0x00,0x00); $color[8]=ImageColorAllocate($im,0xff,0xff,0x00); $color[9]=ImageColorAllocate($im,0x33,0x3,0x33); $color[10]=ImageColorAllocate($im,0x00,0xcc,0xff); $color[11]=ImageColorAllocate($im,0x00,0x22,0xcc); $color[12]=ImageColorAllocate($im,0xEE,0x00,0xff); for($k=1;$k < 13;$k++) { if(strcmp($filelist[$k][name]," ")) { for($i=0,$j=($slot-1);$i<($slot);$i++,$j--) { $out_put[$k][$i][x]=(780-$i*($day_num)-$day_num); $out_put[$k][$i][y]=(275-$data1[$k][$j]*25); } } } for($i=$sel_date_to,$k=0;$i<($sel_date_from+1);$i++,$k++) { $datestr[$k]=date("m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y"))); } //////纵轴 for($i=0;$i<$day;$i++) { $style = array($black_color, $black_color, $black_color, $black_color, $red, $w, $w, $w, $w, $w); imagesetstyle($im, $style); imageline($im, ($xEnd - $i*($day_num)-$day_num), $yBgn, ($xEnd - $i*($day_num)-$day_num), $yEnd, IMG_COLOR_STYLED); $xstr=$datestr[$i]; Imagestringup($im, 2, ($xEnd - $i*($day_num)-$day_num) - 4, $yEnd+60, $xstr, $style); //if($i==29) //Imagestringup($im, 2, $xBgn + $i*24 - 4, $yEnd+60, $datestr[29], $style); } //横轴 for($i=0,$k=10;$i<10;$i++,$k--) { $displayMaxData=$k; imagesetstyle($im, $style); //imageline($im,$xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, IMG_COLOR_STYLED); if($i!=0) imageline($im,$xBgn , $yBgn+$i*25, $xEnd, $yBgn+$i*25, IMG_COLOR_STYLED); Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$displayMaxData", $black_color); } Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "0", $black_color); /////////////////////////////////////////////////////////////////////// //画线 for($k=1;$k < 13;$k++) { if(strcmp($filelist[$k][name]," ")) { for($i=0;$i<($slot);$i++) { if($i > 0) { imageline($im,$out_put[$k][$i-1][x],$out_put[$k][$i-1][y],$out_put[$k][$i][x],$out_put[$k][$i][y],$color[$k]); } } } } //====graphics title===== //$graphics_title="Service erlang statistic graphic"; //Imagestring($im, 2, 300,5, $graphics_title, $text_color); //===draw the label block==== $color[1]=ImageColorAllocate($im,0x99,0x22,0x33); $color[2]=ImageColorAllocate($im,0x99,0x00,0xcc); $color[3]=ImageColorAllocate($im,0x99,0x99,0x00); $color[4]=ImageColorAllocate($im,0x99,0x99,0x99); $color[5]=ImageColorAllocate($im,0x99,0xff,0x33); $color[6]=ImageColorAllocate($im,0xff,0x99,0x66); $color[7]=ImageColorAllocate($im,0xff,0x00,0x00); $color[8]=ImageColorAllocate($im,0xff,0xff,0x00); $color[9]=ImageColorAllocate($im,0x33,0x3,0x33); $color[10]=ImageColorAllocate($im,0x00,0xcc,0xff); $color[11]=ImageColorAllocate($im,0x00,0x22,0xcc); $color[12]=ImageColorAllocate($im,0xEE,0x00,0xff); imagefilledrectangle($im,90,350,100,360,$color[1]); imagestring($im,2,105,350,"SUB SUB",$text_color); imagefilledrectangle($im,260,350,270,360,$color[2]); imagestring($im,2,275,350,"SUB TRK",$text_color); imagefilledrectangle($im,430,350,440,360,$color[3]); imagestring($im,2,445,350,"TRK SUB",$text_color); imagefilledrectangle($im,600,350,610,360,$color[5]); imagestring($im,2,615,350,"TRK TRK",$text_color); imagefilledrectangle($im,90,370,100,380,$color[6]); imagestring($im,2,105,370,"INTRA",$text_color); imagefilledrectangle($im,260,370,270,380,$color[7]); imagestring($im,2,275,370,"SUB IP",$text_color); imagefilledrectangle($im,430,370,440,380,$color[4]); imagestring($im,2,445,370,"TRK IP",$text_color); imagefilledrectangle($im,600,370,610,380,$color[9]); imagestring($im,2,615,370,"MO",$text_color); imagefilledrectangle($im,90,390,100,400,$color[10]); imagestring($im,2,105,390,"MT",$text_color); imagefilledrectangle($im,260,390,270,400,$color[11]); imagestring($im,2,275,390,"IN TRK",$text_color); imagefilledrectangle($im,430,390,440,400,$color[12]); imagestring($im,2,445,390,"OUT TRK",$text_color); imagefilledrectangle($im,600,390,610,400,$color[8]); imagestring($im,2,615,390,"IP",$text_color); ////////////////////////////////////////////////////// //////////////////////////////////////////////////////// //-----输出图形文件,请勿修改 //delete *.png $handle=opendir('.'); while($file=readdir($handle)) { $retval=""; $pt=strrpos($file,"."); if($pt) $retval=substr($file,$pt+1,strlen($file)-$pt); if($retval=='png') unlink($file); } $tt=time()-4000; $filename=$tt.".png"; if(1) { ImagePng ($im,"$filename"); ImageDestroy($im); } //-----显示图片 flush(); echo ""; echo ""; adjust_content_tail(); ?>