query($sqlbanner);
$banner ='';
$banner1 .= '';
?>
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;$j
' + 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]
}]
});
});
?>