-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
45 lines (41 loc) · 1.27 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html><head></head><body>
<?php
ini_set('display_errors', 1);
// include php-script that generaties the piechart
require_once ('piechart.php');
//open file
$file="BodemgebruikCategorieenGemeenten2008CBS.csv";
if (($handle = fopen($file, "r")) !== FALSE) {
$i=0;
// read the file line for line, till the end
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
//file headers
//first line contains categories
if ($i==0){
$categories=$data;
//print_r($header);
//we don't use first vale 'gemeenten' and last row: 'totaal
unset ($categories[0]);
unset ($categories[8]);
}else {
$municipalData=$data;
// municipal in first value and remove it from array
$municipal=array_shift($municipalData);
// remove total value (1)
unset($municipalData[7]);
//determin filenameBase (makes it save for filename)
$filenameBase=urlencode($municipal);
//create the image for this municipal
createBarGraph($municipalData, $categories, $municipal, $filenameBase);
//display the images in the resulting hmtl-page
echo "<img src=images/".$filenameBase.".png>";
//try to send the image immediately to the browser
flush();
}
$i++;
}
fclose($handle);
}
?>
</body>
</html>