6 Jun 2002 03:39
Re: PIE CHART ???
Keith Sinclair <keith <at> sinclair.org.au>
2002-06-06 01:39:49 GMT
2002-06-06 01:39:49 GMT
Michael,
I have done some graphs with GD::Graph which is pretty nice. I have also
written some code to dump an RRD to a perl hash (ass. array) so combining
these two bits you could have a Pie Chart pretty quickly. Code below, needs
tie'ing together but should be enough, would need to massage the data a
little before sticking into a PIE chart, need to do some quick
consolidation/summarisation, I have been meaning to whip something up but
busy with work.
Regards
Keith
# get stats
my ($statval,$head) = &getRRDasHash(rrd => $rrdfile, type => "AVERAGE",
start => $args{start}, end => $args{end});
# walk stats and do something with them (prints out as CSV file)
print "Content-type: text/plain\n\n";
foreach my $m (sort keys %{$statval}) {
if ($f) {
$f = 0;
foreach my $h ( <at> $head) {
push( <at> line,$h);
print STDERR " <at> line\n";
}
#print STDERR " <at> line\n";
$row = join("\t", <at> line);
(Continue reading)
RSS Feed