.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>
  Version 2.41 Mar2009
  <td></tr></table>
</td></tr>
<td>
<br>
<br>
.>>

.TH Strategies_for_on-the-fly_graph_generation PL "11-MAR-2009   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 Option 1: direct CGI mode
.LP
To invoke ploticus in
.ig >>
<a href="cgi.html">
.>>
\0direct cgi mode,
.ig >>
</a>
.>>
you specify a URL that invokes ploticus
with the desired parameters, right within an \fC<img>\fR tag, 

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

.SH Option 2: using quisp_pl
A new package called
.ig >>
<a href="http://quisp.sourceforge.net">
.>>
\0quisp_pl
.ig >>
</a>
.>>
generates web pages dynamically (similarly to php or asp), and ploticus scripts 
or prefab invocations can be embedded within your code to create dynamic graphs.  
.ig >>
<a href="http://quisp.sourceforge.net/download">
.>>
\0Download the quisp_pl package and try it.
.ig >>
</a>
.>>
One nice thing you can do with this is create CGI form along with the graph, so users can control
various graph parameters... 
.ig >>
<a href="http://quisp.sourceforge.net/cgi-bin/quisp?rtn=index#graphic">
.>>
\0here's a live demo example of this.
.ig >>
</a>
.>>

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

.SH Option 3: via perl or python interface
Perl and python interfaces to \fClibploticus\fR have been contributed and are
available under "Accessories" on the
.ig >>
<a href="http://ploticus.sourceforge.net/doc/download.html">
.>>
\0download page.
.ig >>
</a>
.>>

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

.SH Option 4: some other CGI interface to the libploticus API
The 
.ig >>
<a href="api.html">
.>>
\0libploticus API
.ig >>
</a>
.>>
is freely available; developers can write their own
interface to it and invoke as a CGI.

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

.SH Option 5: invoking pl via the shell
.LP
The performance penalty for going this route may not be as much as you'd expect.
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 Option 6: using ploticus CGI via ASP/VBS
This is discussed here:
.ig >>
<a href="http://groups.yahoo.com/group/ploticus/message/1358">
.>>
\0ploticus newsgroup message# 1358
.ig >>
</a>
.>>

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

.ig >>
<br><br><br>
.>>
.SH Troubleshooting tips
Here are some troubleshooting tips for running in a webserver-invoked environment:

.IP \(bu
Be sure your pl command is executable by world

.ig >>
<br><br>
.>>
.IP \(bu
You generally can't see anything written to stderr on your web browser,
so there could be error messages that you're not seeing.

.ig >>
<br><br>
.>>
.IP \(bu
Verify that pl is in fact being executed or not.  web server
environments typically have a very limited command path.  Try specifying
the full path name of your pl executable.  Try it with these arguments:
.br
.ig >>
&nbsp; &nbsp;
.>>
 \fC pl -diagfile /tmp/myerrs1 -errfile /tmp/myerrs2\fR
.br
and see what appears in those /tmp files ... if those files aren't created
pl is probably not being executed at all.  If they are try adding the
-debug arg and your args, then check the /tmp files again.

.ig >>
<br><br>
.>>
.IP \(bu
Determine the directory where your command is being executed.  Try
making php exec the command  \fCpwd\fR  ... you may need to give full pathname
for your data file, etc.

.ig >>
<br><br>
.>>
.IP \(bu
Some web server environments may have restrictions on locations where
files are allowed to be written. pl needs to write to /tmp and needs to
write to create the result png or gif image

.ig >>
<br><br>
.>>
.IP \(bu
Some web server environments might have restrictions on locations where files can be read from.

.ig >>
<br><br>
.>>
.IP \(bu
In order to use prefabs, the PLOTICUS_PREFABS environment variable must be available 
in the runtime environment.  PLOTICUS_PREFABS=the directory where prefab scripts reside




.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>
<br>
<center>
<table><tr><td>
Ploticus is hosted at http://ploticus.sourceforge.net</td><td> &nbsp; </td><td>
<a href="http://sourceforge.net/projects/ploticus"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=38453&type=12" 
width="120" height="30" border="0" 
alt="Get ploticus data display engine at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</td></tr></table>


</center>
.>>
