C
C SUBROUTINE 'QGXAX1'
C ===================
C
C A SIMPLE 'X' AXIS DRAWING ROUTINE
C
      SUBROUTINE QGXAX1 (XO,YO,XLEN,XMIN,XMAX,NXDIV,ND,HT,SIZ)
C
C PARAMETERS
C
C       XO (I)   X ORIGIN COORDINATE IN PIXELS 0.0 TO 1023.0 (OR MAPPED 
C                         COORDINATE IF 'QGMAPC' HAS BEEN CALLED)
C       YO (I)   Y ORIGIN COORDINATE IN PIXELS 0.0 TO 767.0 (OR MAPPED 
C                         COORDINATE IF 'QGMAPC' HAS BEEN CALLED)
C     XLEN (I)   LENGTH OF X AXIS IN SCREEN PIXELS (1.0-1023.0) (OR MAPPED
C                         COORDINATE SPACE IF 'QGMAPC' HAS BEEN CALLED)
C     XMIN (I)   MINIMUM X VALUE AT 'X' ORIGIN
C     XMAX (I)   MAXIMUM X VALUE 
C    NXDIV (I)   NUMBER OF X DIVISIONS FOR ANNOTATION (0 IF NONE)
C       ND (I)   NUMBER OF DIGITS AFTER DECIMAL POINT (MAX 9, 0=INTEGERS)
C       HT (I)   HALFHEIGHT OF AXIS TICK LINES (IN PIXELS) (0.0 IF NONE)
C      SIZ (I)   CHARACTER SIZE (HEIGHT) IN PIXELS (0.0 IF NO ANNOTATION
C                REQUIRED)
C
C SPECIFICATION STATEMENTS
C ------------------------
C
      LOGICAL START, MAPSAV
      CHARACTER*8 FORM
      CHARACTER*25 DIGSTR
      LOGICAL MAP
      COMMON /QQMAP/ MAP, XPMIN, XPMAX, YPMIN, YPMAX, 
     *               XMMIN, XMMAX, YMMIN, YMMAX, XSC, YSC
      SAVE /QQMAP/
      DATA FORM/'(F20.X)'/
C
C INITIALISATIONS
C ---------------
C
      CALL QGMPXY (XO,YO,XPO,YPO)
      IF (MAP) THEN
         XPLEN = XLEN*XSC
      ELSE
         XPLEN = XLEN
      ENDIF
      MAPSAV = MAP
      MAP = .FALSE.
      NDEC=ND
      IF (NDEC.GT.9) NDEC=9
      IF (NDEC.LT.0) NDEC=0
      IF (NDEC.GT.0) WRITE (FORM(6:6),'(I1)') NDEC
      CHW = 0.6*SIZ
      CHYOFF = HT + 1.5*SIZ
C
C DRAW AXIS LINE
C --------------
C
      CALL QGMOVE (XPO,YPO)
      CALL QGDRAW ((XPO+XPLEN),YPO)
C
C DRAW TICKS
C ----------
C
      IF (NXDIV.GT.0.AND.HT.GT.0.0) THEN
         DO 100 I=0,NXDIV
            XX = XPO+I*(XPLEN/NXDIV)
            CALL QGMOVE (XX,YPO-HT)
            CALL QGDRAW (XX,YPO+HT)
100      CONTINUE
      ENDIF
C
C DRAW ANNOTATION VALUES
C ----------------------
C
      IF (NXDIV.GT.0.AND.SIZ.GT.0) THEN
         DO 250 I=0,NXDIV
            XVAL = XMIN + I*(XMAX-XMIN)/NXDIV
            IF (NDEC.EQ.0) THEN
               WRITE (DIGSTR,'(I20)') NINT(XVAL)
            ELSE
               WRITE (DIGSTR,FORM) XVAL
            ENDIF
            START=.FALSE.
            CHX = XPO + I*(XPLEN/NXDIV) + (ND+0.5)*CHW
            IF (ND.EQ.0) CHX = CHX - CHW
            CHY = YPO - CHYOFF
            DO 200 J=25,1,-1
               IF (START.AND.DIGSTR(J:J).EQ.' ') GO TO 250
               IF (DIGSTR(J:J).EQ.' ') GO TO 200
               START = .TRUE.
               CHX = CHX - CHW
               CALL QGTEXT (CHX, CHY, SIZ, DIGSTR(J:J))
200         CONTINUE
250      CONTINUE
      ENDIF
      MAP = MAPSAV 
      RETURN
      END
