The first step creating a dynamic web page using RLPlot is to create a sample graph with the GUI-version
of RLPlot. This graph is stored as a *rlp graph file. The second step is to edit this file with a text
editor: dispensable objects are removed, decide which modifications need to be done dynamically. If the Graph
should be with automatic scaling the respectevie axes need no ticks nor tick labels.
The final step is to create a script wich creates a valid *rlp file either by modifying a template or completly
created by the script. Whenever a user requests a page, the script is executed, creating the *.rlp file; the file
is processed by "exprlp". The output of exprlp is either sent directly to the client (if output is SVG)
or processed by another program rasterizing the vector output to a bitmap.
This example is based on Python as a scripting language. The Python script reads a template file
and sets the dynamic values. Exprlp produces Encapsulated Postscript (EPS) being rendered to Portable Network
Graphics (PNG) by Ghostscript. The resulting bitmap is sent to the client.
The following files are required
for this example:
On an Apache server the first 3 files would be placed in the usual folders for web pages. The next two files
(demo1.tpl and script_1.py) should be placed in the cgi-bin folder.
demo1.html | frame definitions for the page | |
form1.html | form where the user may change the values | |
demo1.png | first bitmap as if created by the script | |
demo1.tpl | template file created from a RLPlot file modified to minimize size (dispensable items have been removed), the upper and lower y limits have been set to zero to force automatic scaling, and editable values have been flagged with curly brackets | |
script_1.py | the Python script and CGI interface which does most of the work |
The execution is started by calling demo1.html by a browser.
Example 2 is equivalent to Example 1 but uses PHP as scripting language. All files of this example reside in the usual folders for web-pages. The entire intermediate *.rlp file is created by the script. Exprlp produces SVG output which is rendered by ImageMagick's convert utility.
demo2.html | frame definitions for the page | |
form2.html | form where the user may change the values | |
demo2.png | first bitmap as if created by the script | |
demo2.php | the PHP script and CGI interface which does most of the work |
The execution is started by calling demo1.html by a browser.