Hello List,
this may be a no-brainer, but I get shot down trying to create pngs
using GD::Graph directly the way I do it right now because /share/html/Elements/Footer gets appended to everything called via
Mason. I have two files:
/share/html/Statistics/CallsQueueDay/index.html and
/share/html/Statistics/Elements/Chart.
CallsQueueDay/index.html is where the statistics data is collected.
Within is the following code, which is presumed to generate a png graph
courtesy of Elements/Chart and GD::Graph (see code samples below).
Unfortunately, what I get is the png data, followed by the html needed
for the footer
"
Any hints how I can easily avoid this footer?
Regards,
Harald
<CallsQueueDay/index.html>:
[snip]
<%perl>
my $url = $RT::WebURL.’/Statistics/Elements/Chart?’;
for (0…$#data) {
$url .= “x_labels=” . $data[0][$] . “&”;
}
shift @data;
for (0…$#data) {
$url .= “data”.(1+$)."=".(join “,”, @{$data[$_]})."&";
}
chop $url;
</%perl>
[snip]
<Elements/Chart>:
<%perl>
print $graph->plot(@data)->$format();
</%perl>
<%INIT>
use GD::Graph::lines;
my $graph = GD::Graph::lines->new(400,300);
$graph->set(export_format => “png”);
my @data;
my @argslist;
push @data, $ARGS{x_labels};
push @argslist, split /,/ , $ARGS{data1};
push @data, @argslist;
push @argslist, split /,/ , $ARGS{data2};
push @data, @argslist;
push @argslist, split /,/ , $ARGS{data3};
push @data, @argslist;
my $format = $graph->export_format;
$r->header_out(“image/$format”);
</%INIT>
<%ARGS>
</%ARGS>