$this->BORDER*2;
}
}
//--------------折线图
function imageLine(){
$item_array=Split($this->ARRAYSPLIT,$this->ITEMARRAY);
$num=Count($item_array);
$item_max=0;
for ($i=0;$i<$num;$i++){
$item_max=Max($item_max,$item_array[$i]);
}
//$xx=$this->BORDER;
//画柱形图
for ($i=0;$i<$num;$i++){
srand((double)microtime()*1000000);
if($this->R!=255 && $this->G!=255 && $this->B!=255){
$R=Rand($this->R,200);
$G=Rand($this->G,200);
$B=Rand($this->B,200);
}else{
$R=Rand(50,200);
$G=Rand(50,200);
$B=Rand(50,200);
}
$color=ImageColorAllocate($this->IMAGE,$R,$G,$B);
//柱形高度
$height_now=($this->Y-$this->BORDER)-($this->Y-$this->BORDER*2)*($item_array[$i]/$item_max);
if($i!="0"){
ImageLine($this->IMAGE,$xx,$height_next,$xx+$this->BORDER,$height_now,$color);
}
ImageString($this->IMAGE,$this->FONTSIZE,$xx+$this->BORDER,$height_now-$this->BORDER/2,$item_array[$i],$this->FONTCOLOR);
$height_next=$height_now;
//用于间隔
$xx=$xx+$this->BORDER;
}
}
//--------------完成打印图形YeMaoSheng.com
function printAll(){
ImageGIF($this->IMAGE);
ImageDestroy($this->IMAGE);
}
//--------------调试
function debug(){
echo "X:".$this->X."<br>Y:".$this->Y;
echo "<br>BORDER:".$this->BORDER;
$item_array=split($this->ARRAYSPLIT,$this->ITEMARRAY);
$num=Count($item_array);
echo "<br>数值个数:".$num."<br>数值:";
for ($i=0;$i<$num;$i++){
echo "<br>".$item_array[$i];
}
}
}
$report=new ImageReport;
$report->setImage(600,300,255,255,255,1);//参数(长,宽,背影色R,G,B,是否透明1或0)
$temparray="50,25,100,250,180,200,150,220,200,150,50,25,100,250,180,200,150,220,200,150";//数值,用指定符号隔开
$report->setItem('','',$temparray,3,20);//参数(分隔数值的指定符号,数值变量,样式1为竖柱图2为横柱图3为折线图,距离)
$report->setFont(1);//字体大小1-10
$report->PrintReport();
//$report->debug();//调式之用
?>