Leser: 1
|< 1 2 3 4 5 6 7 8 9 >| | 82 Einträge, 9 Seiten |
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
46
47
48
49
50
51
52
53
54
55
56
57
#!f:/perl/bin/perl
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use GD::Graph::pie;
use DBI;
use Data::Dumper;
my $DBH;
my $STH;
### Datenbankverbindung ###
my $dbh = DBI->connect("DBI:CSV:f_dir=".$FindBin::Bin);
my $stmt = "SELECT * FROM Kunde";
my $sth = $dbh->prepare($stmt) or die $dbh->errstr();
$sth->execute() or die $dbh->errstr();
my @werte;
my @res;
### Werte werden zeilenweise ausgelesen ####
while (@werte=$STH->fetchrow_array()){
push @res, [@werte];
}
$STH->finish();
$DBH->disconnect;
my @data=@res;
warn Dumper \@data;
### Grafikeigenschaften festlegen ###
my $graph = new GD::Graph::pie(300, 300);
$graph->set(
title => 'Auswertung',
label => 'Category',
axislabelclr => 'black',
'3d' => 1,
start_angle => 90,
suppress_angle => 5,
)
or warn $graph->error;
### Ausgabe ###
my $format = $graph->export_format;
print header("image/$format");
binmode STDOUT;
my $gd = $graph->plot(\@data) or die $graph->error;
print $gd->gif();
$sth->fetchrow_array()
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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!f:/perl/bin/perl -w
use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use GD::Graph::pie;
use DBI;
use Data::Dumper;
my $DBH;
my $STH;
### Datenbankverbindung ###
my $dbh = DBI->connect("DBI:CSV:f_dir=".$FindBin::Bin);
my $stmt = "SELECT * FROM Kunde";
my $sth = $dbh->prepare($stmt) or die $dbh->errstr();
$sth->execute() or die $dbh->errstr();
my @werte;
my @res;
### Werte werden zeilenweise ausgelesen ####
while (@werte = $sth->fetchrow_array()) {
push @res, [@werte];
}
$STH->finish();
$DBH->disconnect;
my @data=@res;
warn Dumper \@data;
### Grafikeigenschaften festlegen ###
my $graph = new GD::Graph::pie(300, 300);
$graph->set(
title => 'Auswertung',
label => 'Category',
axislabelclr => 'black',
'3d' => 1,
start_angle => 90,
suppress_angle => 5,
)
or warn $graph->error;
### Ausgabe ###
my $format = $graph->export_format;
print header("image/$format");
binmode STDOUT;
my $gd = $graph->plot(\@data) or die $graph->error;
print $gd->gif();
$STH->finish();
$sth->finish();
my $dbh = DBI->connect("DBI:CSV:f_dir=".$FindBin::Bin);
|< 1 2 3 4 5 6 7 8 9 >| | 82 Einträge, 9 Seiten |