最終的な効果を見てみましょう:
以下は PHP コードです:
<ol class="dp-xml"> <li class="alt"><span><span>/****************************** </span></span></li> <li><span>* 折れ線グラフ生成機能 </span></li> <li class="alt"><span>******** **** **********************/ </span></li> <li> <span>function line_stats_pic($value_y,$width,$high,$</span><span class="attribute">strong</span><span>=</span><span class="attribute-value">1</span><span>,$</span><span class="attribute">fix</span><span> = </span> <span class="attribute-value">0</span><span>){ </span> </li> <li class="alt"><span>//y 値処理関数 </span></li> <li><span>function line_point_y($num,$width,$high,$max_num_add,$min_num_add,$y_pxdensity){ </span></li> <li class="alt"> <span> </span><span class="attribute">return </span> <span>=$high-floor(($num-$min_num_add+$y_pxdensity)/(($max_num_add-$min_num_add)/$high)); </span> </li> <li> <span></span>//パラメータ処理 </li> <li class="alt"> <span></span>$</li> <li>allnum<span></span> =</li> <li class="alt">サイズ<span></span>($value_y); </li> <li> <span></span>$<span class="attribute"></span>max<span></span>max_num<span class="attribute-value">=max($value_y);最大値 </span><span></span> </li>$<li class="alt"> <span>min</span><span class="attribute-value">min_num</span><span class="attribute">=min($ value_y); </span><span>=$max_num-$min_num; </span>$</li> <li>max_num_add<span> </span>=$max_num+$limit_m*0.1; //軸の最小値 <span class="attribute-value"></span><span class="attribute"></span>$<span> シャフト密度 </span> </li> <li class="alt"> <span> $</span> <span class="attribute">x_pxdensity</span><span>=</span> </li>floor<li> <span>($width/$allnum); //配列ポインタをゼロにリセットします </span><span class="attribute"></span>$<span></span>i </li> <li class="alt">=<span></span>0<span class="attribute"></span>; <span></span>foreach($ value_y を $val){ </li> <li> <span></span> $point_y[$i]=line_point_y($val,$width,$high,$max_num_add,$min_num_add, $y_pxdensity); <span class="attribute"></span><span></span>}</li> <li class="alt"> <span>$</span><span class="attribute">zero_y</span><span>=</span><span class="attribute-value">line_point_y</span><span>(0,$width,$high,$max_num_add,$min_num_add,$y_pxdensity) //ゼロ点のY値 </span> </li> <li> <span>$</span> <span class="attribute">empty_size_x </span> <span>=(strlen($max_num) </span><span class="tag">></span><span> strlen($min_num) ? strlen($max_num) : strlen($min_num))*5+3; //空白のままにする </span> </li> <li class="alt"><span> </span></li> <li><span> / /画像ストリームが開始されます </span></li> <li class="alt"><span>header("Content-type:image/png"); ) ; </span></li> <li>imagecolorallocate($pic,255,255,255); //線の色<span></span><span class="attribute">$</span>=<span></span>imagecolorallocate<span class="attribute-value"></span>($pic,0) ,0,0);黒 <span></span> </li> <li class="alt">$<span></span>color_3</li> <li>=<span></span>imagecolorallocate<span class="attribute"></span>($pic,19 4,194,194);//グレー <span></span><span class="attribute-value"></span>//グリッドを描画します <span></span> </li> <li class="alt">imageset厚さ($pic,1); <span> Floor</span><span class="attribute">($width/100); //垂直グリッド線の数 </span><span></span><span class="attribute-value">$</span>y_line_density<span></span>=$</li> <li>y_line_width<span></span>==0 ? 0 :floor($width/$y_line_width); /垂直グリッド線密度 <span class="attribute"></span><span></span> $<span class="attribute-value"></span>point_zero_y<span></span>=$zero_y </li> <li class="alt">><span></span> $high ? $high : $zero_y : $pic,1,$empty_size_x-1,$ high+4,"0",$ color_2); //ゼロ点軸マーク </li> <li> <span></span>=</li> <li class="alt">1<span></span>;$i <span class="attribute"></span>= $y_line_width;$ i++){ 垂直グリッド線 <span class="attribute-value"></span><span></span> imagesetthickness($pic,1); //グリッド線幅 </li> <li> <span></span> imageline($pic,$y_line_density*$i+$empty_size_x,0,$y_line_density*$i+$empty _size_x 、 $high,$color_3 ); <span class="attribute"></span><span></span> imagesetthickness($pic,2); $i+$empty_size_x, $point_zero_y,$color_2); <span class="attribute"></span><span>http://www.bkjia.com/PHPjc/486091.html</span> </li>www.bkjia.com<li class="alt"> <span>true</span><span class="attribute">http://www.bkjia.com/PHPjc/486091.html</span><span>技術記事</span><span class="tag">最終的な効果を見てみましょう: 以下は PHP コードです: /******************************** *折れ線グラフ生成機能**************** ******* *************/ functionline_stats_pic($value_y,$width,$high,$ str...</span><span></span> </li> <li><span></span></li> </ol>