ION Script source code:




<!-- Copyright (c) 2000-2002, Research Systems, Inc.  All rights reserved.
     Unauthorized reproduction prohibited. -->

<!-- This is an example showing how to use large data sets  ---->

<ION_SCRIPT>
<ION_HEADER>
  <TITLE>ION Script: Large data set</TITLE>

  <VARIABLE>
    <!--- create some initial data --->
    <VARIABLE_DECL NAME="d20" VALUE="'0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 '" TYPE="STR" />
    <VARIABLE_DECL NAME="d200" VALUE="$d20 + $d20 + $d20 + $d20 + $d20 + $d20 + $d20 + $d20 + $d20 + $d20" TYPE="STR" />

    <VARIABLE_DECL NAME="data" VALUE="''" TYPE="STR"/>
    <VARIABLE_DECL NAME="filename" VALUE="''" TYPE="STR"/>
  </VARIABLE>
</ION_HEADER>

<ION_BODY>

  <!--- generate a filename to save the session   --->
  <ION_EVALUATE EXPR="$filename = $ION.temp + '/session' + $ION.uniqueID + '.sav'" />

  <ION_IF EXPR="NOT ($Form.data ISTYPE 'UNDEF')">
    <ION_EVALUATE EXPR="$data = $Form.data"/>
  <ION_ELSE />
    <ION_EVALUATE EXPR="$data = $d200 + $d200 + $d200 +$d200 + $d200" />
  </ION_IF>

  <!--- create a form where the use can enter lots of data  --->
  <FORM METHOD="POST" ACTION="ion-p">
    <INPUT TYPE="hidden" NAME="page" VALUE="largeData.ion">

    Data Values:
    <BR>
<TEXTAREA ROWS=6 COLS=35 NAME="data">
<ION_VARIABLE NAME="$data"/>
</TEXTAREA>
    <br>Enter data separated by spaces then hit "Plot"
    <br>The first 1000 data points will be plotted below.
    <P>
    <INPUT TYPE="submit" NAME="submit" VALUE="Plot">
  </FORM>

  <hr>

  <!-- only show the print and image if we have data -->
  <ION_IF EXPR="NOT ($Form.data ISTYPE 'UNDEF')">

    <!-- Because ION_DATA_OUT can use the POST method, it can take a virtually 
         unlimited amount of data.  ION_IMAGE has a limit on the URL length,
         which stops us from posting unlimited data via ION_IMAGE.  
         Our workaround is we send the data to ION_DATA_OUT, save the session 
         with our data, and restore this session when we do the ION_IMAGE.  -->

    <ION_DATA_OUT METHOD="POST">
      <IDL>
        dataString = '$data'
        SAVE, FILE='$filename', /VARIABLES
      </IDL>
    </ION_DATA_OUT>

    The plot command:<br>
    <ION_IMAGE WIDTH="1000" HEIGHT="300" TYPE="DIRECT">
      <IDL>
        ; restore the session created by ION_DATA_OUT
        RESTORE, '$filename'
        ; create our data set to plot
        x = findgen(1000)
        data = FLTARR(1000)
        IF (dataString NE '') THEN READS, dataString, data
        ; plot it
        plot, x, data
      </IDL>
    </ION_IMAGE>
  </ION_IF>
</ION_BODY>
</ION_SCRIPT>