Hi,
 
This has probably been covered before, but a quick trawl through the archives didn't turn anything up.
 
When I use the GD::Graph plugin TT doesn't seem to write out any html that is in the template..... just the png graph.
This is the code:
 
#!/usr/bin/perl -w
 
use strict;
use Template;
use CGI;
 
my $q = new CGI;
my $file = $q->param('file') || 'sample_gd_graph.html';
 
my $template = Template->new({
 INCLUDE_PATH  => "/path/to/stats"
});
 
my $tt_vars;
my $output;
print $q->header();
$template->process($file, $tt_vars,\$output) || die $template->error;
 

print $output;
 
This is the template:
 
 

[% FILTER null;
data = "[    ["00:00-00:59", "01:00-01:59", "02:00-02:59", "03:00-03:59", "04:00-04:59", "05:00-05:59", "06:00-06:59", "07:00-07:59", "08:00-08:59", "09:00-09:59", "10:00-10:59", "11:00-11:59" ],
    [ 2,  3, 1,  4, 0, 0, 1,  7,  3,  4,  6,  7],
    [4, 3, 5, 0, 3, 1, 0, 4, 6, 4, 1, 9],
    [1,   2,  2,  3,  4,  3,  1, 3,  0,  2,  3,  2],
];
 

USE my_graph = GD.Graph.bars3d();
 
my_graph.set(
        x_label => 'Hour',
        y_label => 'Number of unique events',
        title => 'Sample',
        y_max_value => 32,
        y_min_value => 0,
        y_tick_number => 16,
        y_label_skip => 4,
        box_axis => 0,
        line_width => 3,
        zero_axis_only => 1,
        x_label_position => 1, 
        y_label_position => 1, 
 
        x_label_skip => 6,
        x_tick_offset => 2,
 
        transparent => 0,
);     
my_graph.set_legend("www.gamezone.com", "www.pcpitstop.com", "Upgrade link");
my_graph.plot(data).png | stdout(1);
 
END;
-%]
 
 
</body>
</html>
 
What I get is just the image and none of the links!!
 
I'm probably doing something really silly.
I'm using perl 5.6.1 and TT 2.0.7
 
TIA
 
Andy

Reply via email to