<?php
$handle = fopen("file01.txt", "r");
$n = 1;
while (($csvdata = fgetcsv($handle, 1000, ",")) !== FALSE) {
for ($c=0; $c < 3; $c++) {
$data[$n] = $csvdata[$c];
$n = $n +1;
}
}
fclose($handle);
for ($n=1; $n < 100; $n++) {
$m = 3 * $n - 1;
$cx[$n] = $data[$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月30日 03:51