带基准线的折线图php代码.docVIP

  • 0
  • 0
  • 约4.54千字
  • 约 7页
  • 2017-12-22 发布于河南
  • 举报
带基准线的折线图php代码

带基准线的折线图php代码 /** * VoteSystem Version1.0 * ================================================ * Copy 2012 * ================================================ * Author: Lpyuan * Date: 2012-4-7 *具体代码来自百度文库:/view/debf104afe4733687e21aaa3.html:我做了点修改(2013-4-14) */ header(Content-Type:image/png); $width = 900; //定义画布宽度 $height= 240; //定义画布高度 $right = 20; //定义坐标系距画布右侧距离 $left = 20; //定义坐标系距画布左侧距离 $top = 70; //定义坐标系距画布上侧距离 $buttom= 20; //定义坐标系距画布下侧距离 $up=79; //上基准线的值 $down=33; //下基准线的值 $target=46; //标准线的值 $x = array(); //定义x坐标空数组 $y = array(); //定义y坐标空数组 $data = array(10,5,30,40,25,80,5,30,40,25,46); //定义所绘制数据数组 $name = array(a,b,c,d,e,f,b,c,d,e,f); //定义横坐标的坐标标签 foreach($data as $k=$v){ //获取$data中最大值 if( $k== 0 $v != ){ $min = $v; $max = $v; }elseif( $v != ) { $min = min($min,$v); $max = max($max,$v); } if($v == ){ $kong = $k; } } $image = imagecreatetruecolor($width, $height); //---------------------// $white = imagecolorallocate($image, 255, 255, 255); //定义真彩画布及颜色值// $black = imagecolorallocate($image, 10, 10, 10); $blue = imagecolorallocate($image, 0, 0, 255); $red = imagecolorallocate($image, 255, 0, 0); //---------------------// $yellow = imagecolorallocate($image, 255, 170, 0); $green= imagecolorallocate($image, 79, 144, 30); imagefill($image, 0, 0, $white); //用白色填充画布 //画横坐标 imageline($image, $left,$height-$buttom, $width-$right, $height-$buttom, $black); //画纵坐标 imageline($image, $left, $top , $left, $height-$buttom, $black); //画箭头 imageline($image,$width-$right, $height-$buttom, ($width-$right)-8,$height-$buttom-3, $black); imageline($image,$width-$right, $height-$buttom, ($width-$right)-8,$height-$buttom+3, $black); imageline($ima

文档评论(0)

1亿VIP精品文档

相关文档