Strategies for on-the-fly graph generation |

Version 2.33 Jun'06
| |
|
Manual page for Strategies_for_on-the-fly_graph_generation(PL)
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.
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.
There are several strategies for producing on-the-fly web graphs:
Option 1: direct CGI mode
To invoke ploticus in
direct cgi mode,
you specify a URL that invokes ploticus
with the desired parameters, right within an <img> tag,
Option 2: using quisp_pl
A new package called
quisp_pl
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.
Download the quisp_pl package and try it.
One nice thing you can do with this is create CGI form along with the graph, so users can control
various graph parameters...
here's a live demo example of this.
Option 3: via perl or python interface
Perl and python interfaces to libploticus have been contributed and are
available under "Accessories" on the
download page.
Option 4: some other CGI interface to the libploticus API
The
libploticus API
is freely available; developers can write their own
interface to it and invoke as a CGI.
Option 5: invoking pl via the shell
The performance penalty for going this route may not be as much as you'd expect.
Generally the procedure is:
-
-
1. generate a unique temp file name for the output
-
-
2. invoke pl via the shell, using the temp file as the output file (-o)
-
-
3. display the temp file using an <img> tag
-
-
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 crontab and run it
every night to automatically remove files that are over one day old:
/usr/bin/find tmpdir ! -type d -mtime +1 -exec rm -f {} \;
Option 6: using ploticus CGI via ASP/VBS
This is discussed here:
ploticus newsgroup message# 1358
Troubleshooting tips
Here are some troubleshooting tips for running in a webserver-invoked environment:
-
Be sure your pl command is executable by world
-
You generally can't see anything written to stderr on your web browser,
so there could be error messages that you're not seeing.
-
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:
pl -diagfile /tmp/myerrs1 -errfile /tmp/myerrs2
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.
-
Determine the directory where your command is being executed. Try
making php exec the command pwd ... you may need to give full pathname
for your data file, etc.
-
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
-
Some web server environments might have restrictions on locations where files can be read from.
-
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
|
 data display engine
Copyright Steve Grubb
|