home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l216 / 2.ddi / XBAR.PRO < prev    next >
Encoding:
Text File  |  1987-03-23  |  2.8 KB  |  115 lines

  1. /****************************************************************
  2.  
  3.      Turbo Prolog Toolbox
  4.      (C) Copyright 1987 Borland International.
  5.  
  6.         Demo of    bar graph
  7. ****************************************************************/
  8.  
  9. project "xbar"
  10.  
  11. include "tdoms.pro"
  12. include "gdoms.pro"
  13. include "gglobs.pro"
  14. include "tpreds.pro"
  15. include "gpreds.pro"
  16. include "gbar.pro"
  17.  
  18. goal
  19.   Theta=0.3,
  20.   Graph1Ratio=0.5,
  21.   graphics(1,1,1),
  22.   gwrite(0,12,"3-D BAR-CHART.",3,0),
  23.   gwrite(1,12,"--------------",2,0),
  24.   gwrite(2,1,"SALES IN BILLION $",1,1),
  25.   gwrite(22,0,"Resolution: 320x200 pixels in 4 colors",1,0),
  26.   BarGraph3D(3,6,4,4,Theta,Graph1Ratio,
  27.       [bar(2,"",1,2),
  28.        bar(3,"1984",1,3),
  29.        bar(5,"",1,2),
  30.      space,
  31.      bar(4,"",1,2),
  32.      bar(7,"1985",1,3),
  33.      bar(7,"",1,2),
  34.      space,
  35.      bar(4,"",1,2),
  36.      bar(7,"1986",1,3),
  37.      bar(7,"",1,2),
  38.      space,
  39.        space,
  40.        space,
  41.        bar(10,"Estim. 1987",1,3)],_),
  42.   gwrite(24,0,"Press space bar",1,0),
  43.   readchar(_),
  44.   graphics(2,1,1),
  45.   makewindow(1,1,0,"",0,0,25,80),
  46.   gwrite(0,30,"2-D BAR-CHART",1,0),
  47.   gwrite(1,30,"-------------",1,0),
  48.   Graph2Ratio=0.9,
  49.   gwrite(24,0,"Resolution: 640x200 in 2 colors.",1,0),
  50.   BarGraph(5,5,4,4,
  51.       Graph2Ratio,
  52.       [bar(52,"",1,0),
  53.        bar(33,"1983",1,1),
  54.        bar(70,"",1,0),
  55.        space,
  56.        bar(49,"",1,1),
  57.        bar(80,"1984",1,0),
  58.        bar(100,"",1,1),
  59.        space,
  60.        bar(40,"",1,0),
  61.        bar(50,"1985",1,1),
  62.        bar(70,"",1,0),
  63.      space,
  64.        bar(100,"Reference",1,1)],SFactor),
  65.   gwrite(22,0,"The graph is automatically scaled to fit a specified area.",1,0),
  66.   str_real(ScaleStr,SFactor),
  67.   concat("The scaling factor in this example is =",ScaleStr,Str1),
  68.   gwrite(23,0,Str1,1,0),
  69.   gwrite(24,50,"Press space bar",1,0),
  70.   readchar(_),
  71.   clearwindow,
  72.   gwrite(23,0,"Enter E if an EGA card is installed (press any other key to end)",1,0),
  73.   readchar(E),
  74.   E= 'e',
  75.   graphics(4,1,1),
  76.   makewindow(4,7,0,"",0,0,25,80),
  77.   Graph3Ratio=0.9,
  78.   gwrite(23,0,"Resolution: EGA 640 x 200 in 16 Colors",1,0),
  79.   BarGraph3D(7,7,7,7,Theta,Graph3Ratio,
  80.       [bar(2,"",1,2),
  81.        bar(3,"1983",3,4),
  82.        bar(5,"",5,6),
  83.        space,
  84.        bar(4,"",7,8),
  85.        bar(7,"1984",9,10),
  86.        bar(7,"",11,12),
  87.        space,
  88.        bar(4,"",13,14),
  89.        bar(7,"1985",15,1),
  90.        bar(7,"",2,3),
  91.      space,
  92.        bar(10,"Reference",4,5)],_),
  93.   gwrite(24,0,"Press space bar to continue",1,0),
  94.   readchar(_),
  95.   graphics(5,1,1),
  96.   makewindow(4,7,0,"",0,0,25,80),
  97.   Graph3Ratio=0.9,
  98.   gwrite(23,0,"Resolution: EGA 640 x 350 in 16 Colors",1,0),
  99.   BarGraph3D(7,7,7,7,Theta,Graph3Ratio,
  100.       [bar(2,"",1,2),
  101.        bar(3,"1983",3,4),
  102.        bar(5,"",5,6),
  103.        space,
  104.        bar(4,"",7,8),
  105.        bar(7,"1984",9,10),
  106.        bar(7,"",11,12),
  107.        space,
  108.        bar(4,"",13,14),
  109.        bar(7,"1985",15,1),
  110.        bar(7,"",2,3),
  111.      space,
  112.        bar(10,"Reference",4,5)],_),
  113.   gwrite(24,0,"Press space bar",1,0),
  114.   readchar(_).
  115.