<> <> <> <> DIRECTORY Graph USING [CaretIndex, CaretSpec, ColorIndex, Entity, FontIndex, GraphColors, GraphFonts, GraphHandle, GraphProc, JustifX, JustifY, Mark, NullBox, ROPE, TargetSpec, Text, UnitLineWidth, ValueList, XY], Imager USING [Box, VEC]; GraphOps: CEDAR DEFINITIONS = { OPEN Graph; <> Lock, Unlock: GraphProc; NewGraph: PROC [ <> fileName, -- suggested file name to save the graph. <> <> <> groupName, -- name of the group of curves in this graph being created. comment, -- will show up on graph table following the name, but not on graph viewer. xName: ROPE _ NIL, autoBounds, autoDivisions: BOOL _ TRUE, bounds: Imager.Box _ NullBox, -- [xmin, ymin, xmax, ymax] divisions: ARRAY XY OF INT _ ALL[5], grids: ARRAY XY OF BOOL _ ALL[FALSE], -- true: on. targets: ARRAY XY OF TargetSpec _ ALL[NIL], carets: ARRAY CaretIndex OF CaretSpec _ ALL[NIL], showSlope: BOOL _ FALSE, -- slope between primary and secondary carets colors: GraphColors _ NIL, fonts: GraphFonts _ NIL, oldGraph: GraphHandle _ NIL, -- Create new viewer iff nil. replace: BOOL _ FALSE -- true: remove all existing curves and texts on old handle; false: merge new curves and texts with existing ones. ] RETURNS [newGraph: GraphHandle, groupId: INT]; <<>> <> <<1. SetXValues then call AddCurve for each y; or>> <<2. EnlistEntities then call AddCrossSection to append y values for each x (x must be in ascending order).>> <<>> AddText: PROC [handle: GraphHandle, rope: ROPE, <> place: Imager.VEC _ [0.0, 0.0], -- location with respect to origion and relative to size of axes box fontIndex: FontIndex _ 0, colorIndex: ColorIndex _ 15, -- black rotation: REAL _ 0.0, -- angle of rotation, ccw, in degrees. justifX: JustifX _ left, justifY: JustifY _ bottom ] RETURNS [text: Text]; <> SetXValues: PROC [handle: GraphHandle, values: ValueList, groupId: INT _ 0, reverse, discard: BOOL _ TRUE] RETURNS [xEntity: Entity]; <> <> <> AddCurve: PROC [handle: GraphHandle, values: ValueList, groupId: INT _ 0, name, comment: ROPE _ NIL, colorIndex: ColorIndex _ 0, -- If this argument is zero, a nonzero color index will be assigned for this curve automatically when it is plotted. mark: Mark _ none, width: REAL _ UnitLineWidth, reverse, discard: BOOL _ TRUE -- refer to values ] RETURNS [curve: Entity]; <> <> <> EnlistEntity: PROC [handle: GraphHandle, groupId: INT _ 0, name, comment: ROPE _ NIL, colorIndex: ColorIndex _ 0, -- If this argument is zero, a nonzero color index will be assigned for this curve automatically when it is plotted. mark: Mark _ none, width: REAL _ UnitLineWidth ] RETURNS [curve: Entity _ NIL]; <<>> AddCrossSection: PROC [ handle: GraphHandle, x: REAL, yvalues: ValueList, groupId: INT _ 0, reverse, discard: BOOL _ TRUE]; <> <> <> <> <> SaveGraph: PROC[handle: GraphHandle, plottedOnly: BOOL _ TRUE] RETURNS [msg: ROPE]; <> <> }. LOG. SChen, October 26, 1985 3:48:07 pm PDT, created.