SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages

Using DATAPLOT with the Web

Web Applications Increasingly Important Incorporating applications into the web is becoming increasingly important. There are several approaches to doing this, which will be discussed in the context of Dataplot. The approaches discussed are:
  1. Generating Dataplot output for web applications
  2. Integration with the NIST/SEMATECH e-Handbook of Statistical Methods
  3. Using Dataplot with CGI scripts
  4. Robert Lipman's Web Dataplot software
  5. Downloading files for using Dataplot with the web
Dataplot is not currently available as a browser plug-in and there are no current plans to do this.
1. Generating Dataplot Output for Web Applications
Output Can Be Either Text or Graphics The most basic use of Dataplot in web applications is the insertion of Dataplot output into web pages. The Dataplot output can consist of
  • Dataplot text output
  • Dataplot graphics
Graphics Output The most common file formats for graphics in web browsers are:
  1. GIF (graphics interchange format)
  2. JPEG
  3. PNG (Portable Network Graphics)
  4. SVG (Scalable Vector Graphics)
GIF, JPEG, and PNG are bit-map formats are almost universally supported in web browsers. SVG is an XML-based vector format that is natively supported in most browsers (the primary exception is Internet Explorer prior to version 9). SVG is typically higher quality than the bit-mapped formats.

All versions of Dataplot can generate SVG output. Dataplot supports GIF, JPEG, and PNG using the GD library. This may not be available on some Dataplot installations.

An alternative is to generate graphs in Postscript format and then use one of the various image conversion programs to create a graph in one of the bit-mapped formats. Be aware that most of these conversion programs use a bit-mapped model and do not always do a good job converting vector-based formats such as POstscript.

Text Output The CAPTURE command supports the ability to generate Dataplot output in HTML format:
    CAPTURE HTML <file-name>
The HTML option specifies that the CAPTURE output should be in HTML format. Although most analysis commands will generate the output using HTML table syntax, a few commands will simply use a <PRE> ... <PRE> syntax.

Note that an additional feature of the HTML option is that if DEVICE 2 is set to either PNG/JPEG or SVG, the graphics will be incorporated into the web page using the IMG tag.

You can use the WEB command to view the generated HTML output from within the Dataplot session. For example,

    SKIP 25
    READ RIPKEN.DAT Y X1 X2
    ECHO ON
    CAPTURE HTML C:\TABLE.HTM
    TABULATE MEAN Y X1
    CROSS TABULATE MEAN Y X1 X2
    END OF CAPTURE
    WEB file://C:\TABLE.HTM
          
In addition, if DEVICE 2 is set to PNG, JPEG, or SVG, Dataplot will incorporate the graphics into the web page using the IMG tag. For example,
    device 1 x11
    .
    skip 25
    read berger1.dat y x
    .
    line blank solid
    character x blank
    echo on
    capture html fit.htm
    set ipl1na data.png
    device 2 gd png
    title original data
    plot y x
    device 2 close
    fit y x
    set ipl1na pred.png
    device 2 gd png
    title predicted line
    plot y pred vs x
    device 2 close
    end of capture
    .
    web file:///home/heckert/dataplot/solaris/fit.htm
          
NOTE: The following enhancements were made to the CAPTURE HTML command in the 1/2003 version of Dataplot.
  1. If DEVICE 2 is set to Postscript, Dataplot will automatically invoke Ghostscript to convert the Postscript file to JPEG format. It will also add the appropriate <IMG> tag to the HTML file. This capability is supported under Windows and Unix. Enter HELP CAPTURE for details.

  2. The SET POSTSCRIPT CONVERT command can be used to specify one of several devices. When a Postscript device is closed, Ghostscript will automatically be invoked to convert the Postscript output to the specified format.

    PDF (Portable Document Format) is one of the supported devices. For PDF, the CAPTURE HTML will automatically put a link in the HTML page to the PDF file. PDF may be preferable to JPEG if you need to preserve higher image quality.

    Enter HELP POSTSCRIPT CONVERT for details.

  3. The SET HTML HEADER FILE and SET HTML FOOTER FILE comamnds can be used to specify files that will be used for the header and footer, respectively, of the generated HTML file. Enter HELP HTML HEADER FILE for details.
2. Integration of Dataplot with the NIST/SEMATECH Engineering Statistics Handbook
Engineering Statistics Handbook Dataplot has been integrated with the NIST/SEMATECH Engineering Statistics Handbook. The Handbook is a web based statistics handbook that has a number of case studies which can be run using Dataplot directly from the web pages.
Steps in Executing Dataplot Macro When Invoked from Web When a Dataplot macro is invoked from the case study web page, the following steps occur.
  • A check is made to see if Dataplot is currently running.
  • If a Dataplot session is currently running, the macro is executed in the currently open session. The check for a currently open Dataplot is accomplished by the Tcl/Tk scripts that implement the Dataplot graphical interface.
  • If no Dataplot session is currently running, the Dataplot software is invoked and then the macro is executed.
  • In either case, the Dataplot session remains remains open (unless the macro explicitly closes Dataplot).

This approach makes it possible to execute macros successively. This is quite useful in the context of the Handbook case studies. That is, the user can step through the case study in small, easily understood steps.

NOTE: Due to changes in the NIST web servers and in NIST web security procedures, this capability is currently not active. It may be restored at some future date.

Advantages and Disadvantages of Approach The advantages of this method are:
  • Dataplot and the web page are in separate windows. This can be an advantage if you want the user to be able to view explanatory text while also viewing the Dataplot output.
  • You can implement fairly involved macros in small, manageable steps.
  • If the Dataplot session is left open, the user can execute Dataplot commands independently of the web page.
  • Dataplot is run on the users local platform, not the web server. This can help minimize the load on the server.

The primary disadvantage of this method is that Dataplot needs to be installed on the user's local platform.

Two Basic Steps There are two basic steps in implementing this method.
  • A link to the macro needs to be incorporated in the web page. You can view the HTML source for the Dataplot case studies in the Handbook. For example, check the HTML source for one of the eda examples. The Dataplot macros are contained in files with a ".dp" extension. These macro files are stored with the other HTML files on the server. Any needed data files can be added to the data sets directory where the built-in Dataplot data sets are stored.
  • Both the web server and your browser need to be configured to know how to handle a ".dp" file. The link contains instructions for how to do this for the most common browsers and the most common platforms.
Approach Useful for Tutorial Applications If you only need to run a single macro, you can simplify the above steps to run the command line version of Dataplot as well.

In general, this approach is useful for tutorial type web pages. That is, you want to teach your audience how to perform a particular analysis using Dataplot.

3. Using Dataplot with CGI Scripts
Basic Approach You can install Dataplot on a server computer. An HTML form page will typically prompt the user for certain inputs. Once the form is submitted, a CGI script will run Dataplot on the server computer and then return either a graph or Dataplot output to the web page.

CGI scripts are most commonly written in Perl, although they can also be written in C or other scripting or programming languages.

We do not document the details of implementing this since there are many books on writing CGI scripts available. This approach has been used by at least one project at NIST for a production system.

The CGI approach can be used with many different programs. There are no particular issues that you need to be aware of when using Dataplot this way. The fact that you can write command driven macros in ASCII files means that Dataplot is well suited for this approach.

Advantages and Disadvantages of the CGI Approach The advantage of this method is:
  • The software does not need to be installed on the user's local system.

The disadvantage of this method is:

  • For a heavily used site, running a number of Dataplot applications simultaneously can put a heavy load on the server.

This approach is useful if you simply want to use Dataplot as a computation engine or to generate a specific type of plot dynamically. In this case, the end user may or may not care whether or not Dataplot was used for the computation.

Active Server Pages (ASP) In a "web based computing" project in the NIST Statistical Engineering Division, we have used Active Server Pages to invoke Dataplot.

This is a similar idea to CGI scripts. Basically, you have a web form that accepts certain parameters. Then ASP and VBSCRIPT are used to generate a Dataplot macro on the fly and Dataplot is invoked to run the macro and return the results to a web page.

If you would like more information about this approach, contact Alan Heckert.

4. Robert Lipman's Web Dataplot
Web Dataplot can be Adapted for Local Applications Robert Lipman, currently of the NIST Building and Fire Research Laboratory, has written "Web Dataplot". This is a CGI script written in Tcl/CGI. We used to provide this to run a live Dataplot session from these web pages. We have removed it from the public web pages for firewall considerations. Internal users can still run web Dataplot. External users who would like to adapt this for use on their own sites should contact alan.heckert@nist.gov for more information.

One possible application of the web Dataplot software would be as an online "problem solver". That is, if your site has a specific set of problems with a standard solution, you could modify the web Dataplot scripts to create forms and run macros that solve these particular problems.

NOTE: This approach is not currently being supported.

5. Downloading Files for Using Dataplot with the Web
Downloadable Scripts Provide a Framework, Not A Finished Solution If you are interested in using Dataplot in a web application, we have included links to appropriate software to help.

Note that you will need to modify the source provided to fit your own application. These sources are provided as a basic framework for developing your own web applications using Dataplot, not as ready to use scripts. This source is provided "asis" and we do not offer any additional support for them. If you want to adapt these to your own applications, you should have some basic web development experience (you should not need a lot, but should have a handle on the basic concepts).

  1. If you are interested in an approach similar to the NIST/SEMATECH Engineering Statistics Handbook, then you don't really need any additional software other than the user installing Dataplot on their local machine. The discussion above provided links to pages that discuss how to configure your browser on the most popular platforms (other platforms should be similar) and a link to a page that discusses configuring your web server for Dataplot macros.

  2. We have implemented a number of analyses using a CGI/Perl based approach. Contact alan.heckert@nist.gov if you would like more information or some examples of this approach.

  3. Bob Lipman's web dataplot code requires the following:

    • You need Tcl/Tk and Expect (these are typically already downloaded and installed if you are running the GUI version of Dataplot).

    • In addition, it requires the Tcl/CGI library from Don Libes (the author of Expect).

    • A tar file of cgi scripts is available. This file should be untarred in your "cgi-bin" directory. The main script is "wdpi.cgi". The file "wdp.cgi" is the HTML file that initiates "wdpi.cgi". This can be installed as part of your web pages.

    Note that these files have not been updated for quite some time. It is likely that these scripts would need to be updated.

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 6/5/2001
Last updated: 10/30/2013

Please email comments on this WWW page to alan.heckert@nist.gov.