Object Reference : Object View and Procedure Reference : Graph
  
 
draw
Place horizontal or vertical lines and shaded areas on the graph.
Syntax
graph_name.draw(draw_type, axis_id [,options]) position1 [position2]
where draw_type may be one of the following:
 
line / l
A line
shade
A shaded area
Note that the “dashline” option has been removed (though it is supported for backward compatibility). You should use the “pattern” option to specify whether the line is solid or patterned.
axis_id may take the values:
 
left / l
Draw a horizontal line or shade using the left axis to define the drawing position
right / r
Draw a horizontal line or shade using the right axis to define the drawing position
bottom / b
Draw a vertical line or shade using the bottom axis to define the drawing position
If drawing a line, the drawing position is taken from position1. If drawing a shaded area, you must provide a position1 and position2 to define the boundaries of the shaded region.
Line/Shade Options
The following options may be provided to change the characteristics of the specified line or shade. Any unspecified options will use the default text settings of the graph.
 
color(arg)
Specifies the color of the line or shade. The argument may be made up of n1, n2, and n3, a set of three integers from 0 to 255, representing the RGB values of the line or shade, or it may be one of the predefined color keywords (“blue”, “red”, “green”, “black”, “white”, “purple”, “orange”, “yellow”, “gray”, “ltgray”). For a full description of the keywords, see Table::setfillcolor.
The default is black for lines and gray for shades. RGB values may be examined by calling up the color palette in the Graph Options dialog.
pattern(index)
Sets the line pattern to the type specified by index. index can be an integer from 1 to 12 or one of the matching keywords (“solid”, “dash1” through “dash10”, “none”). See Graph::setelem for a description of the available patterns. The “none” keyword turns on solid lines.
width(n1)
Specify the width, where n1 is the line width in points (used only if object_type is “line” or “dashline”). The default is 0.5 points.
top
Specifies that the line be drawn on top of the graph. (Note that this option has no effect on shades.)
Examples
graph1.draw(line, left, rgb(0,0,127)) 5.25
draws a horizontal blue line at the value “5.25” as measured on the left axis while:
graph1.draw(shade, right) 7.1 9.7
draws a shaded horizontal region bounded by the right axis values “7.1” and “9.7”. You may also draw vertical regions by using the “bottom” axis_id:
graph1.draw(shade, bottom) 1980:1 1990:2
draws a shaded vertical region bounded by the dates “1980:1” and “1990:2”.
graph1.draw(line, bottom, pattern(dash1)) 1985:1
draws a vertical dashed line at “1985:1”.
Cross-references
See “Graph Objects” for a discussion of graph options.
See Graph::drawdefault for setting defaults.