Thread CGI=>HTML=>Link mit Tortendiagramm (81 answers)
Opened by lolipop 999 at 2006-09-26 23:03

lolipop 999
 2006-12-17 11:31
#8836 #8836
User since
2006-04-07
150 Artikel
BenutzerIn
[default_avatar]
Super danke hat perfekt funktioniert

hier der Code:

Code: (dl )
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
#!f:/perl/bin/perl

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use GD::Graph::pie;
use DBI;
use FindBin;

### Datenbankverbindung ###

my $dbh = DBI->connect("DBI:CSV:f_dir=".$FindBin::Bin.";csv_sep_char=\\;") or die $DBI::errstr;
my $stmt = "SELECT * FROM Kunde";

my $sth = $dbh->prepare($stmt) or die $dbh->errstr();
$sth->execute() or die $dbh->errstr();

my @res = ([qw/DHL K_N Hellmann/]);
while (my @werte = $sth->fetchrow_array()) {
push @res, [@werte];
}

$sth->finish();
$dbh->disconnect;

### 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 die $graph->error;

### Ausgabe ###

my $format = $graph->export_format;
print header("image/$format");
binmode STDOUT;
my $gd = $graph->plot(\@res) or die $graph->error;
print $gd->gif();


Ich danke nochmals für die tolle Hilfe

lolipop 999

View full thread CGI=>HTML=>Link mit Tortendiagramm