<?php
$row = 1;
$handle = fopen("data02.csv", "r");
$n = 1;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
for ($c=0; $c < 4; $c++) {
$bdata[$n] = $data[$c];
$n = $n +1;
}
}
fclose($handle);
for ($n=1; $n < 100; $n++) {
$m = 4 * $n;
$cx[$n] = $bdata[$m];
}
$maxc = -999;
for ($n=1; $n < 100; $n++) {
if ( $cx[$n] > $maxc ) {
$maxc = $cx[$n] ;
}
}
$minc = 999;
for ($n=1; $n < 100; $n++) {
if ( $cx[$n] < $minc ) {
$minc = $cx[$n] ;
}
}
for ($n=1; $n < 100; $n++) {
$cy[$n] = 100+400*($cx[$n]-$minc)/($maxc-$minc);
}
for ($n=1; $n < 100; $n++) {
$cy[$n] = 600 - $cy[$n] ;
}
header("Content-Type: image/png");
$image = imagecreate(600,600);
$black = imagecolorallocate($image,0,0,128);
$yellow = imagecolorallocate($image,255,255,0);
for ($n=1; $n < 99; $n++) {
$x1= 100+4*$n;
$x2= $x1+4;
$y1 = $cy[$n];
$y2 = $cy[$n + 1];
imageline($image,$x1, $y1,$x2,$y2, $yellow);
}
imagepng($image);
imagedestroy($image);
?>
最終更新:2009年04月29日 11:32