Loading ...
Sorry, an error occurred while loading the content.

153outputfile option and java

Expand Messages
  • forestlodgesydney
    Apr 3, 2002
      Hello all,

      I've begun investigating ploticus for use in a java based web
      application. I have a test app that executes ploticus to produce a
      graph based on a script called "myLines.htm". I'm having difficulty
      specifying an output file. I want to define a gif name, but am
      finding that the resulting file takes the default (ie "myLines.gif"),
      regardless of the specified output file.

      However, if I simply execute ploticus via a batch file in a windows
      98 dos session, the gif file is produced as required
      (ie "defName.gif");

      The command line java code and script file follow. Any comments much
      appreciated. - thanks - Rowan

      commnd line used in a dos session on win98
      plot\bin\pl output\myLines.htm -o output\defName.gif -gif
      file=output\data.txt delimit=tab

      source code for java test app
      import java.io.* ;

      //creates a graph based on a data file
      public class Graph{
      private String ploticusExe;
      private String outputFileType;
      private String delimiter;
      private String scriptFile;
      private String dataFile;
      private String outputFile;

      public static void main(String [] args){
      new Graph("plot\\bin\\pl","output\\myLines.htm",
      "-gif","-o output\\defName.gif",
      "file=output\\data.txt", "delimit=tab");

      //Calls ploticus and creates a graph image
      public Graph(String ploticusExe, String scriptFile, String
      outputFileType, String outputFile,String
      dataFile,String delimiter){
      this.ploticusExe = ploticusExe;
      this.outputFileType = outputFileType;
      this.scriptFile = scriptFile;
      this.dataFile = dataFile;
      this.delimiter = delimiter;
      this.outputFile = outputFile;

      Runtime r = Runtime.getRuntime();
      String cmd[] = {ploticusExe, scriptFile,
      outputFileType, outputFile,
      dataFile, delimiter};
      Process p = r.exec(cmd);
      catch(Exception e){

      script file - mylines.htm
      // Use proc page to set the overall text size to 6 pt
      #proc page
      textsize: 9

      // read data file using proc getdata - params from command line
      #proc getdata
      file: @file
      delimit: @delimit

      // Define a plotting area using proc areadef
      #proc areadef
      title: Psychological performance
      titledetails: adjust=0,0.1
      //rectangle: 1 1 5 2
      rectangle: 1 1 5 3.5

      xrange: 0 20
      yrange: 0 25

      yaxis.grid: color=rgb(.6,.6,1)

      // Define an X axis using proc xaxis
      #proc xaxis
      tics: none
      label: Alternate Recording Days

      // Define a Y axis using proc yaxis
      #proc yaxis
      stubs: incremental 5
      label: Number of 'a' recordings

      // Do the curve using proc lineplot
      #proc lineplot
      xfield: 1
      yfield: 2
      linedetails: color=red
      pointsymbol: shape=square style=fill fillcolor=blue radius=0.02
      numbers: yes
    • Show all 2 messages in this topic