# text-in.nsc written by S. ISHIZAKA. 1997/12
#
# This script inserts a column as legend-text.
#
SHIFTX=0   # ammount of the shift from plotted data-points.
SHIFTY=0   # ammount of the shift from plotted data-points.
PT=2000    # Size
R=0        # Red
G=0        # Green 
B=0        # Blue
FONT=Helv  # Font
JFONT=Goth # Japanese font
DIR=0      # Direction

new dialog
COLUMN=${dialog::input:'Input legend-text column'}
del dialog
name=0
if [ "$COLUMN" ]
then
  file:0:opendatac
  while file:0:getdata
  do
    name=`iexpr $name+1`
    if exist text:in$name >/dev/null
    then
      put text:in$name name:in$name
    else
      new text name=in$name
    fi
    text::x=${file:0:coord_x}+$SHIFTX
    text::y=${file:0:coord_y}+$SHIFTY
    text::text=`get file:0 -field column:"${file:0:line} ${COLUMN}"`
    text::pt=$PT
    text::R=$R
    text::G=$G
    text::B=$B
    text::font=$FONT
    text::jfont=$JFONT
    text::direction=$DIR
  done
  file:0:closedata
fi
