Strategies for on-the-fly graph generation


Welcome     Gallery     Handbook


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:


Direct CGI mode

One option for producing dynamic web content is to invoke ploticus in direct cgi mode. Within an <img> tag, specify a URL that invokes ploticus with the desired parameters.


Using a ploticus-enabled dynamic content system

Another option is to use a new package called Midriff 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 midriff and build it with the ploticus option.


Invoking pl via the shell

This is appropriate if you are using a dynamic web content system such as PHP, or invoking pl via cron or some other automatic command issuer. 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 {} \;


Troubleshooting tips

In CGI contexts anything written to standard error is unavailable. Use the -diagfile stdout command line option to see diagnostic messages. Version 2.11+ offers the -echo stdout command line option which can be used during debugging to display evaluated script lines.


data display engine  
Copyright Steve Grubb


Markup created by unroff 1.0,    May 20, 2003.