home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / PGLINEMS.BA$ / PGLINEMS.bin
Encoding:
Text File  |  1990-06-24  |  2.4 KB  |  58 lines

  1. ' PGLINEMS.BAS - Program to generate a simple multi-data series line chart
  2.  
  3. DEFINT A-Z
  4. '$INCLUDE: 'CHRTB.BI'                 ' Declarations and Definitions
  5. DIM Env AS ChartEnvironment           ' Variable to hold environment structure
  6. DIM AxisLabels(1 TO 4) AS STRING      ' Array of categories
  7. DIM LegendLabels(1 TO 2) AS STRING    ' Array of series labels
  8. DIM Values(1 TO 4, 1 TO 3) AS SINGLE  ' 2-dimentsion array of values to plot
  9.  
  10. DIM Col%(0 TO cPalLen)          ' Define arrays to hold values retrieved with
  11. DIM Lines%(0 TO cPalLen)        ' call to GetPaletteDef. By modifying these
  12. DIM Fill$(0 TO cPalLen)         ' values, then calling ResetPaletteDef, you
  13. DIM Char%(0 TO cPalLen)         ' can change colors, plot characters, borders,
  14. DIM Bord%(0 TO cPalLen)         ' and even the line styles and fill patterns
  15.  
  16. ' Read the data to display into the arrays
  17.  
  18. FOR index = 1 TO 2: READ LegendLabels(index): NEXT index
  19. FOR index = 1 TO 4: READ AxisLabels(index): NEXT index
  20.  
  21. FOR columnindex = 1 TO 2                ' The array has 2 columns, each of
  22.   FOR rowindex = 1 TO 4                 ' which has 4 rows. Each column rep-
  23.     READ Values(rowindex, columnindex)  ' resents 1 full data series. First,
  24.   NEXT rowindex                         ' fill column 1, then fill column 2
  25. NEXT columnindex                        ' with values from the last DATA
  26.                                         ' statement (below).
  27. CLS
  28.  
  29. ChartScreen 2                           ' Set a common graphics mode
  30.  
  31. ' Retrieve current palette settings, then assign some new values
  32.  
  33. GetPaletteDef Col%(), Lines%(), Fill$(), Char%(), Bord%()
  34.  
  35.  Col%(2) = (15)          '  Assign white as color for second-series plot line
  36.  Char%(1) = (4)          '  Assign  "" as plot character for 1st plot line
  37.  Char%(2) = (18)         '  Assign  "" as plot character for 2nd plot line
  38.  
  39. ' Reset the palettes with modified arrays
  40.  
  41. SetPaletteDef Col%(), Lines%(), Fill$(), Char%(), Bord%()   ' Enter the changes
  42.  
  43. DefaultChart Env, cLine, cLines         ' Set up multi-series line chart
  44.  
  45. ' Display the chart
  46.  
  47. ChartMS Env, AxisLabels(), Values(), 4, 1, 2, LegendLabels()
  48.  
  49. SLEEP                                   ' Keep it onscreen until user presses
  50.                                         ' a key
  51. END
  52.  
  53. ' Simulated data to be shown on chart
  54. DATA "Qtr 1","Qtr 2"
  55. DATA "Admn","Markg","Prodn","Devel"
  56. DATA 38,30,40,32,18,40,20,12
  57.  
  58.