#INCLUDE "dislin.bi"

DIM AS SINGLE x(8)  = {1., 2., 3., 4., 5., 6., 7., 8., 9.}
DIM AS SINGLE y(8)  = {0., 0., 0., 0., 0., 0., 0., 0., 0.}
DIM AS SINGLE y1(8) = {1., 1.5, 2.5, 1.3, 2.0, 1.2, 0.7, 1.4, 1.1}
DIM AS SINGLE y2(8) = {2., 2.7, 3.5, 2.1, 3.2, 1.9, 2.0, 2.3, 1.8}
DIM AS SINGLE y3(8) = {4., 3.5, 4.5, 3.7, 4., 2.9, 3.0, 3.2, 2.6}
DIM AS INTEGER nya = 2700, i
DIM AS STRING ctit = "Bar Graphs (BARS)"
DIM cbuf AS ZSTRING * 80

Dislin.setpag ("da4p")
Dislin.scrmod ("revers")
Dislin.metafl ("cons")
Dislin.disini ()
Dislin.pagera ()
Dislin.complx ()
Dislin.ticks  (1, "x")
Dislin.intax  ()
Dislin.axslen (1600, 700)
Dislin.titlin (ctit, 3)

Dislin.legini (cbuf, 3, 8)
Dislin.leglin (cbuf, "FIRST", 1)
Dislin.leglin (cbuf, "SECOND", 2)
Dislin.leglin (cbuf, "THIRD", 3)
Dislin.legtit (" ")
Dislin.shdpat (5)

FOR i = 1 TO 3
  IF i > 1 THEN
    Dislin.labels ("none","x")
  END IF

  Dislin.axspos (300, nya-(i-1)*800)
  Dislin.graf (0., 10., 0., 1., 0., 5., 0., 1.)

  IF i = 1 THEN
    Dislin.bargrp (3, 0.15)
    Dislin.color  ("red")
    Dislin.bars   (@x(0), @y(0), @y1(0), 9)
    Dislin.color  ("green")
    Dislin.bars   (@x(0), @y(0), @y2(0), 9)
    Dislin.color  ("blue")
    Dislin.bars   (@x(0), @y(0), @y3(0), 9)
    Dislin.color  ("fore")
    Dislin.reset  ("bargrp")
  ELSEIF i = 2 THEN
    Dislin.height (30)
    Dislin.labels ("delta","bars")
    Dislin.labpos ("center","bars")
    Dislin.color  ("red")
    Dislin.bars   (@x(0), @y(0), @y1(0), 9)
    Dislin.color  ("green")
    Dislin.bars   (@x(0), @y1(0), @y2(0), 9)
    Dislin.color  ("blue")
    Dislin.bars   (@x(0), @y2(0), @y3(0), 9)
    Dislin.color  ("fore")
    Dislin.reset  ("height") 
  ELSEIF i = 3 THEN
    Dislin.labels ("second", "bars")
    Dislin.labpos ("outside", "bars")
    Dislin.color  ("red")
    Dislin.bars   (@x(0), @y(0), @y1(0), 9)
    Dislin.color  ("fore")
  END IF

  IF i <> 3 THEN
    Dislin.legend (cbuf, 7)
  END IF

  IF i = 3 THEN
    Dislin.height (50)
    Dislin.title  ()
  END IF

  Dislin.endgrf ()
NEXT i

Dislin.disfin ()
END
