Java 2D Line Methods

get/setLineBasicStrokeType()

These methods get/set which BasicStroke to create using Java2D BasicStroke constructors.

SYNTAX:

int getLineBasicStrokeType (IdentObj id);
void setLineBasicStrokeType (IdentObj id, int newValue);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

newValue; 0...5

0 = Don't use Java2D. Draw line with regular JDK 1.1.8 code

1 = Use Java2D BasicStroke() which constructs a new BasicStroke with defaults for all attributes. 

2 = Use Java2D BasicStroke (float width) which constructs a solid BasicStroke with the specified line width and default values for the cap and join styles.

3 = Use Java2D BasicStroke (float width, int cap, int join) which constructs a solid BasicStroke with the specified attributes.

4 = Use Java2D BasicStroke (float width, int cap, int join, float miterlimit) which constructs a solid BasicStroke with the specified attributes.

5 = Use Java2D BasicStroke (float width, int cap, int join, float miterlimit, float[] dash, float dash_phase) which constructs a new BasicStroke with the specified attributes

RETURN:

int; 0...5; Line basic stroke type set by setLineBasicStrokeType()

ALSO SEE:

get/setLineCap(), get/setLineDash(), setLineDashPhase(), get/setLineJoin(), get/setLineMiterLimit()

get/setLineCap()

When setLineBasicStrokeType() is set to a value greater than zero to use the Java2D BasicStroke object, these methods get/set an end cap style for a specified line object.

SYNTAX:

int setLineCap (IdentObj id);
void setLineCap (IdentObj id, int newValue);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

newValue; Defines the decoration to be applied to the ends of unclosed subpaths and dash segments of a specified line as defined by the Java 2D BasicStroke object (e.g., CAP_BUTT, CAP_ROUND or CAP_SQUARE).

RETURN:

int; Cap style assigned to the object by setLineCap().

EXAMPLE:

setLineBasicStrokeType (getO1MajorGrid(), 5);
setLineWidth (getO1MajorGrid(), 3);
setLineCap (getO1MajorGrid(), BasicStroke.CAP_SQUARE); 

NOTES:

See the java.awt.BasicStroke constructors for values that may be returned.

get/setLineDash()

When setLineBasicStrokeType() is set to a value greater than zero to use the Java2D BasicStroke object, these methods get/set the dash pattern of a specified line object. Use setLineDashPhase() to specify the offset to start the dashing pattern.

SYNTAX:

Vector getLineDash (IdentObj id);
void setLineDash (IdentObj id, Vector vectDashFloat);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

Vector; a vector (java.lang.Float) of floating point numbers that defines the dash pattern

RETURN:

Vector; a vector (java.lang.Float) of floating point numbers that defines the dash pattern

ALSO SEE:

get/setLineBasicStrokeType(), get/setLineDashPhase()

getLineDashFloat()

This method returns an array representing the lengths of the dash segments specified by setLineDash() for a specified line object. It translates a Vector of Floats into a float[] array.

SYNTAX:

float[] getLineDashFloat (IdentObj id)

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

RETURN:

float[]; array of dash segment lengths

ALSO SEE:

get/setLineDash()

get/setLineDashPhase()

When setLineBasicStrokeType() is set to a value greater than zero to use the Java2D BasicStroke object and a line dashing pattern has been specified with setLineDash(), these methods get/set the offset to start the dashing pattern for a specified line object.

SYNTAX:

float getLineDashPhase (IdentObj id);
void setLineDashPhase (IdentObj id, float fNewValue);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

fNewValue; the offset to start the dashing pattern.

RETURN:

float; offset to where the dashing pattern begins set by setLineDashPhase()

ALSO SEE:

get/setLineBasicStrokeType(), get/setLineDash()

get/setLineJoin()

When setLineBasicStrokeType() is set to a value greater than zero to use the Java2D BasicStroke object, these methods get/set the decoration to be applied to the line object where line path segments meet.

SYNTAX:

int getLineJoin (IdentObj id);
void setLineJoin (IdentObj id, int newValue);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

NewValue; the decoration to be applied where path segments meet (e.g., JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER).

RETURN:

int; the decoration that has been applied where path segments meet

EXAMPLE:

setLineBasicStrokeType (getO1MajorGrid(), 3);
setLineWidth (getO1MajorGrid(), 3);
setLineCap (getO1MajorGrid(), BasicStroke.CAP_ROUND); 
setLineJoin (getO1MajorGrid(), BasicStroke.JOIN_BEVEL);

NOTES:

See the java.awt.BasicStroke constructors for constants that can be specified in NewValue.

ALSO SEE:

get/setLineBasicStrokeType()

get/setLineMiterLimit()

When setLineJoin() applies JOIN_MITER to a line object, these methods get/set the limit to trim the miter join.

SYNTAX:

float getLineMiterLimit (IdentObj id);
void setLineMiterLimit (IdentObj id, float fNewValue);

INPUT:

id; Object ID of a line object returned by a getObject() method (i.e., getY1MajorGrid())

fNewValue; the limit to trim the miter join. The miterlimit must be greater than or equal to 1.0f.

RETURN:

float; miter limit applied to the specified line object by setLineMiterLimit()

EXAMPLE:

setLineBasicStrokeType (getO1MajorGrid(), 4); 
setLineBasicStrokeType (getO1MajorGrid(), 3);
setLineWidth (getO1MajorGrid(), 3); 
setLineCap (getO1MajorGrid(), BasicStroke.CAP_ROUND); 
setLineJoin (getO1MajorGrid(), BasicStroke.JOIN_MITER);
setLineMiterLimit (getO1MajorGrid(), 10.0f);

ALSO SEE:

get/setLineJoin()

get/setLineWidth()

These methods get/set the thickness (in pixels) of a series line.

SYNTAX:

int getLineWidth (IdentObj id);
void setLineWidth (IdentObj id, int newValue);
void setLineWidth (int newValue);

INPUT:

id; object ID of a line object

newValue; line width in pixels

RETURN:

int; width of the data line in pixels

EXAMPLE:

setGraphType (67);
setLineWidth (getSeries (3), 10);
setLineWidth (getSeries (1), 10);

NOTES:

If an object ID (id) is not specified, newValue is assigned to the first item in the selection list (if applicable).

ALSO SEE:

setLineWidthAllSeries()