0){ echo "
$on_top_label[$i]"; else echo "$on_top_label[$i]"; } ?>
"; echo "
$on_top_label[$i]"; else echo "$on_top_label[$i]"; } ?> on top
1) { $tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); } for($i=0;$i<24;$i++){ ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color); $xstr=$tempd[$i]." ".$timearray[($i*$slot)%24]; Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color); } } else if($slot==7) { if(3>1) { $tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y"))); $tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y"))); $tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y"))); $tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y"))); $tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y"))); $tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y"))); $tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y"))); $tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y"))); $tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y"))); $tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y"))); } for($i=0;$i<24;$i++){ ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color); $xstr=$tempd[$i]." ".$timearray[($i*$slot)%24]; Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color); } } else { $tempi=0; for($i=0;$i<24;$i++){ ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color); if(($i*$slot)%24==0&&$i!=0) $tempi++; $xstr=$datestr[$tempi]." ".$timearray[($i*$slot)%24]; Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color); } } //============================draw the block legend================================ imagefilledrectangle($image,90,350,100,360,$color[0]); imagestring($image,2,105,350,"Total call duration",$text_color); imagefilledrectangle($image,280,350,290,360,$color[1]); imagestring($image,2,295,350,"Average call duration",$text_color); imagestring($image,2,10,5,"Total call duration",$text_color); imagestring($image,2,700,5,"Average call duration",$text_color); //====get the biggest y scale of left==== for($i=0;$i<$slot*24;$i++) { if($maxYNum_left<$csta_trunk[8][$i]) $maxYNum_left=$csta_trunk[8][$i]; if($csta_trunk[1][$i]==0) $average[$i]=0; else $average[$i]=round($csta_trunk[8][$i]/$csta_trunk[1][$i]); if($maxYNum_right<$average[$i]) $maxYNum_right=$average[$i]; } if($maxYNum_left==0) $maxYNum_left=100; if($maxYNum_right==0) $maxYNum_right=10; //=====get the data line scale===== for($i=0;$i<$slot*24;$i++) { //get the total call duration scale $total_call_duration_scale[$i]['x']=60+30*$i/$slot; $total_call_duration_scale[$i]['y']=floor(250*$csta_trunk[8][$i]/$maxYNum_left); $total_call_duration_scale[$i]['y']=25+250-$total_call_duration_scale[$i]['y']; //get the average call duraiton scale $average_call_duration_scale[$i]['x']=60+30*$i/$slot; $average_call_duration_scale[$i]['y']=floor(250*$average[$i]/$maxYNum_right); $average_call_duration_scale[$i]['y']=25+250-$average_call_duration_scale[$i]['y']; //echo "hour-$i:{$total_call_duration_scale[$i]['y']}"; } for($j=0;$j<24*$slot-1;$j++) { //draw the total duration call data line imageline($image,$total_call_duration_scale[$j]['x'],$total_call_duration_scale[$j]['y'],$total_call_duration_scale[$j+1]['x'],$total_call_duration_scale[$j+1]['y'],$color[0]); //draw the average duration call data line imageline($image,$average_call_duration_scale[$j]['x'],$average_call_duration_scale[$j]['y'],$average_call_duration_scale[$j+1]['x'],$average_call_duration_scale[$j+1]['y'],$color[1]); } //===================================draw the on top data line again==================== if(!isset($on_top_index_down)) $on_top_index_down=0; for($j=0;$j<24*$slot-1;$j++) { if($on_top_index_down==0) { //====================draw the total duration call data line========================== imageline($image,$total_call_duration_scale[$j]['x'],$total_call_duration_scale[$j]['y'],$total_call_duration_scale[$j+1]['x'],$total_call_duration_scale[$j+1]['y'],$color[0]); } else { //=========================draw the average duration call data line=========================== imageline($image,$average_call_duration_scale[$j]['x'],$average_call_duration_scale[$j]['y'],$average_call_duration_scale[$j+1]['x'],$average_call_duration_scale[$j+1]['y'],$color[1]); } } //====draw the horizonal line===== //the left y scale label $unit=$maxYNum_left/10; $style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color); imagesetstyle($image, $style); for($i=0;$i<10;$i++){ if($i!=0) imageline($image, $xBgn, $yBgn + $i*25, $xEnd, $yBgn + $i*25, IMG_COLOR_STYLED); $over_minute=floor($unit/60); $over_hour=floor($unit/3600); //Y轴每格的度值小于一分钟 if($over_minute==0) { $displayMaxData=(10-$i)*$unit; $displayMaxData=number_format($displayMaxData,0,"."," "); $displayMaxData=$displayMaxData." s"; } else { //Y轴每格的度值大于一分钟但小于一个小时 if($over_hour==0) { $displayMaxData=(10-$i)*$unit/60; $displayMaxData=number_format($displayMaxData,1,"."," "); $displayMaxData=$displayMaxData." min"; } //Y轴每格的度值大于一个小时 else { $displayMaxData=(10-$i)*$unit/3600; $displayMaxData=number_format($displayMaxData,2,"."," "); $displayMaxData=$displayMaxData." h"; } } Imagestring($image, 2, $xBgn - 54, $yBgn + $i*25 - 5, "$displayMaxData", $text_color); } //the right y scale label $unit=$maxYNum_right/10; for($i=0;$i<10;$i++){ $over_minute=floor($unit/60); $over_hour=floor($unit/3600); //Y轴每格的度值小于一分钟 if($over_minute==0) { $displayMaxData=(10-$i)*$unit; $displayMaxData=number_format($displayMaxData,0,"."," "); $displayMaxData=$displayMaxData." s"; } else { //Y轴每格的度值大于一分钟但小于一个小时 if($over_hour==0) { $displayMaxData=(10-$i)*$unit/60; $displayMaxData=number_format($displayMaxData,1,"."," "); $displayMaxData=$displayMaxData." m"; } //Y轴每格的度值大于一个小时 else { $displayMaxData=(10-$i)*$unit/3600; $displayMaxData=number_format($displayMaxData,2,"."," "); $displayMaxData=$displayMaxData." h"; } } Imagestring($image, 2, $xBgn - 50+780, $yBgn + $i*25 - 5, "$displayMaxData", $text_color); } //=====draw the graphics===== //-----输出图形文件,请勿修改 $tt=time()+2500; $filename="tg4_".$tt.".png"; if(!$DEBUG){ ImagePng ($image,"$filename"); ImageDestroy($image); } echo "
"; adjust_content_tail("down"); ?>