First page Back Continue Last page Overview Graphics
CGI::Application::GDGraph::lines
Ideally we could combine all of the previous things into a reusable module that could use GD::Graph, CGI::Session and even HTML::Template ( a requirement of CGI::Application) ....
my $graph = CGI::Application::GDGraph::lines->new(
TMPL_PATH => $path_to_templates,
PARAMS => {
'DAT' => $dat,
'legend' => \@legend,
'x_size' => 600,
'y_size' => 300,
'x_label' => 'X LABEL HERE',
'y_label' => 'Y LABEL HERE',
'page_title' => 'GRAPH TITLE HERE',
'tmpl' => $html_template,
'session' => $session_file_dir,
'fgclr' => '#222222',
'labelclr' => '#777777',
'legendclr' => '#666666',
'textclr' => '#666666',}
);
$graph->x_label_ratio("25");
$graph->run();
Notes:
The above 'usage' code is the interface to a CGI::Application module – called 'CGI::Application::GDGraph::lines'
This wraps together the fuctionality of GD::Graph, CGI::Session within a 'CGI::Application' t/w an HTML::Template.
The HTML template file referenced above looks like this:
<head>
<title><TMPL_VAR NAME="page_title"></title>
</head>
<body bgcolor="black">
<div align="center">
<font color="white" face="courier">
<table border=0>
<tr>
<td align="center"><H1><font face="courier" color="white"><TMPL_VAR NAME="page_title"></H1></td>
</tr>
<tr>
<td><img src = "/cgi-bin/<TMPL_VAR NAME="graph_img">"></td>
</tr>
</table>
<a href ="test_db_session.cgi">back</a>
</font>
</div>
</body>
</html>