.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>ploticus: strategies for on-the-fly graph generation</title>
<body bgcolor=D0D0EE vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td>
  <table cellpadding=2 width=550><tr>
  <td><br><h2>Strategies for on-the-fly graph generation</h2></td>
  <td align=right>
  <small>
  <a href="../doc/Welcome.html"><img src="../doc/ploticus.gif" border=0></a><br>
  <a href="../doc/Welcome.html">Welcome</a> &nbsp; &nbsp;
  <a href="../gallery/index.html">Gallery</a> &nbsp; &nbsp;
  <a href="../doc/Contents.html">Handbook</a> 
  <td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>

.TH Strategies_for_on-the-fly_graph_generation PL "20-MAY-2003   PL ploticus.sourceforge.net"

.LP
On-the-fly graph generation is useful for
dynamic content web sites and automatic report generation.
Ploticus is suitable for these situations since it is a non-interactive command 
line tool with a relatively small code size.
.LP
Prefabs may be used, or your plots can be script-based.  With scripts, variables
are often passed in via the command line.  It is also possible to have your
program build a ploticus script on the fly.

.ig >>
<br><br><br>
.>>
There are several strategies for producing on-the-fly web graphs:


.ig >>
<br><br><br>
.>>

.SH Direct CGI mode
.LP
One option for producing dynamic web content is to invoke ploticus in
.ig >>
<a href="cgi.html">
.>>
\0direct cgi mode.
.ig >>
</a>
.>>
Within an \fC<img>\fR tag, specify a URL that invokes ploticus
with the desired parameters.  

.ig >>
<br><br><br>
.>>

.SH Using a ploticus-enabled dynamic content system
Another option is to use a new package called
.ig >>
<a href="http://midriff.sourceforge.net">
.>>
\0Midriff
.ig >>
</a>
.>>
which generates HTML pages dynamically (similarly to php or asp).
Ploticus scripts or prefab invocations can be embedded directly within page 
templates for building dynamic graphs.
To try this, build the ploticus API (see Makefile_api), then download 
.ig >>
<a href="http://midriff.sourceforge.net">
.>>
\0midriff
.ig >>
</a>
.>>
and build it with the ploticus option.

.ig >>
<br><br><br>
.>>

.SH Invoking pl via the shell
.LP
This is appropriate if you are using a dynamic web content
system such as PHP, or invoking \fBpl\fR via \fBcron\fR or some other
automatic command issuer.
Generally the procedure is:
.IP \0
1. generate a unique temp file name for the output 
.IP \0
2. invoke \fBpl\fR via the shell, using the temp file as the output file (-o)
.IP \0
3. display the temp file using an \fC<img>\fR tag
.IP \0
4. remove the temp file or set up an automatic process to do so.  For example, on
unix systems you can place the following command into a \fCcrontab\fR and run it
every night to automatically remove files that are over one day old:
.br
\fC/usr/bin/find \fItmpdir\fC  ! -type d  -mtime +1 -exec rm -f {} \\;

.ig >>
<br><br><br>
.>>
.SH Troubleshooting tips
In CGI contexts anything written to standard error is unavailable.
Use the \fC-diagfile stdout\fR command line option to see diagnostic messages.
Version 2.11+ offers the \fC-echo stdout\fR command line option which
can be used during debugging to display evaluated script lines.


.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="../doc/Welcome.html">
<img src="../doc/ploticus.gif" border=0></a><br><small>data display engine &nbsp; <br>
<a href="../doc/Copyright.html">Copyright Steve Grubb</a>
<br>
<br>
<center>
<img src="../gallery/all.gif">
</center>
</td></tr>
</table>
.>>
