query($sqlbanner); $banner =''; $banner1 .= ''; while($rowbanner = $db->fetch_array($rsbanner)) { $banner .= " ".$rowbanner["en_name"].$rowbanner["sc_name"].' '; } $banner2 .= ''; ?> abs(min($data))?$max:abs(min($data)); $image = imagecreate($width,$height); //填充背景爲白色 $color_white = imagecolorallocate($image, 0xff, 0xff, 0xff);//白色 $color_diwen = imagecolorallocate($image,0xd8,0xd8,0xd8);//暗灰色 imagefill($image,0,0,$color_white); //寫入logo imagettftext($image,20,0,$l_b_x+20,45,$color_diwen,$font,'agetime.org'); //畫坐標 //坐標顔色爲黑色,先畫坐標,再畫箭頭 $black_color = imagecolorallocate($image,0x00,0x00,0x00); imageline($image,$l_b_x,$l_b_y,$l_b_x,10,$black_color); imageline($image,$l_b_x,$l_b_y,$width-10,$l_b_y,$black_color); //箭頭 imageline($image,$l_b_x,10,$l_b_x-3,14,$black_color); imageline($image,$l_b_x,10,$l_b_x+3,14,$black_color); imageline($image,$width-10,$l_b_y,$width-13,$l_b_y-3,$black_color); imageline($image,$width-10,$l_b_y,$width-13,$l_b_y+3,$black_color); //畫底紋,灰色;畫20條底紋;虛線 $pit = floor(($l_b_y-50)/10);//每一段的高度 $pit_x = floor(($width-$l_b_x-30)/count($data));//每一段的寬度 //計算單位 $x_max = $max; $flag_danwei = 0; while($x_max> 1000 ) { $x_max /= 100; $flag_danwei++; } switch($flag_danwei) { // case 0:$danwei = '(元)';break; case 0:$danwei = '(萬)';break; case 1:$danwei = '(百萬)';break; case 2:$danwei = '(億)';break; case 3:$danwei = '(百億)';break; } for($i=1;$i<11;$i++) { imageline($image,$l_b_x+1,$l_b_y-$i*$pit,$width-15,$l_b_y-$i*$pit,$color_diwen); //從坐標的值 $v_v = number_format(($max/(10*pow(100,$flag_danwei))*$i),2); $v_v = substr($v_v,0,5); imagestring($image, $chartfont, $l_b_x-40, $l_b_y-$i*$pit-10, $v_v, $black_color); } //原點坐標 imagestring($image, $chartfont, $l_b_x-20, $l_b_y-10, 0, $black_color); //寫入漢字,單位 和標題 imagettftext($image, 10,0,$l_b_x-45,20,$black_color,$font,$danwei); //imagettftext($image, 11,0,$width/2-70,$l_b_y+20,$black_color, $font,$title); //畫柱體,長方形,並著色 $color_big = imagecolorallocate($image,$colors[0][0],$colors[0][1],$colors[0][2]); $color_small = imagecolorallocate($image,$colors[1][0],$colors[1][1],$colors[1][2]); for($j=0;$j0?$color_big:$color_small; imagefilltoborder($image, $l_b_x+$j*$pit_x+1 + floor($pit_x/2), $l_b_y-floor($d_h/2), $black_color, $current_color); //寫入日期 /*imagestring($image, $chartfont, $l_b_x+$j*$pit_x, $l_b_y+2, $current_date, $black_color);*/ /* imagettftext($image,8,90,$l_b_x+$j*$pit_x+10,$l_b_y-$d_h,$black_color,$font,$current_date); } if($path !="") imagegif($image,$path); else imagegif($image); imagedestroy($image); }//畫圖函數結束 //輸出生成的圖片 /* header("content-type: image/gif"); $my_colors[] = array(0xff,0x00,0x00); $my_colors[] = array(0x00,0xff,0x00); draw(600,400,array(1066565650,-40345340,50343433440,1834340,50343230,-8023454230,600,7232323300,-836),$my_colors,0,'教科書大阿斯頓即可');*/ //draw(600,400,array(1066,-4040,5040,1840,5030,-8230,600,7232,-836),$my_colors,0,'教科書大阿斯頓即可'); ?>
' + this.series.name + '
' + this.x + ': ' + this.y + '°C'; } }, legend: { //【图例】位置样式 layout: 'vertical', //【图例】显示的样式:水平(horizontal)/垂直(vertical) backgroundColor: '#FFFFFF', align: 'left', verticalAlign: 'top', x: 100, y: 70, floating: true, shadow: true }, series: [{ name: '北京', data: [ - 4.6, -2.2, 4.5, 13.1, 19.8, 24.0, 25.8, 24.4, 19.3, 12.4, 4.1, -2.7] }, { name: '上海', data: [3.5, 4.6, 8.3, 14.0, 18.8, 23.3, 27.8, 27.7, 23.6, 18.1, 12.2, 6.2] }, { name: '长沙', data: [4.7, 6.2, 10.9, 16.8, 21.6, 25.9, 29.3, 28.7, 24.3, 19.0, 12.5, 7.0] }, { name: '广州', data: [13.3, 14.4, 17.7, 21.9, 24.6, 27.2, 30.8, 32.1, 27.2, 23.7, 21.3, 15.6] }] }); }); ?>