edu.rit.numeric.plot.impl
Class Ticks
- java.lang.Object
-
- edu.rit.numeric.plot.impl.Ticks
-
public class Ticks extends java.lang.ObjectClass Ticks provides information about tick marks to be drawn on a NumericalAxis.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.awt.FontDEFAULT_LABEL_FONTThe default tick label font (sanserif, plain, 12).static doubleDEFAULT_LABEL_OFFSETThe default offset from the tick mark to the tick label (5).static java.awt.PaintDEFAULT_LABEL_PAINTThe default tick label paint (black).static doubleDEFAULT_LENGTHThe default tick mark length (5).static java.awt.PaintDEFAULT_PAINTThe default tick mark paint (black).static java.awt.StrokeDEFAULT_STROKEThe default tick mark stroke (solid, width=1).
-
Constructor Summary
Constructors Constructor and Description Ticks()Construct a new ticks information object.Ticks(java.text.DecimalFormat theLabelFormat)Construct a new ticks information object.Ticks(java.text.DecimalFormat theLabelFormat, double theLabelScale)Construct a new ticks information object.Ticks(java.awt.Stroke theStroke, java.awt.Paint thePaint, double theLength, java.text.DecimalFormat theLabelFormat, double theLabelScale, java.awt.Font theLabelFont, java.awt.Paint theLabelPaint, double theLabelOffset)Construct a new ticks information object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddrawAbove(java.awt.Graphics2D g2d)Draw a tick above.voiddrawAbove(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick above.voiddrawBelow(java.awt.Graphics2D g2d)Draw a tick below.voiddrawBelow(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick below.voiddrawLeft(java.awt.Graphics2D g2d)Draw a tick to the left.voiddrawLeft(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick to the left.voiddrawRight(java.awt.Graphics2D g2d)Draw a tick to the right.voiddrawRight(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick to the right.java.awt.FontgetLabelFont()Returns the font for drawing tick labels on the display.java.text.DecimalFormatgetLabelFormat()Returns the format for the tick labels.doublegetLabelOffset()Returns the offset from the tick marks to the tick labels.java.awt.PaintgetLabelPaint()Returns the paint for drawing tick labels on the display.doublegetLabelScale()Returns the scale factor for the tick labels.doublegetLength()Returns the length of the tick marks on the display.java.awt.PaintgetPaint()Returns the paint for drawing tick marks on the display.java.awt.StrokegetStroke()Returns the stroke for drawing tick marks on the display.
-
-
-
Field Detail
-
DEFAULT_STROKE
public static final java.awt.Stroke DEFAULT_STROKE
The default tick mark stroke (solid, width=1).
-
DEFAULT_PAINT
public static final java.awt.Paint DEFAULT_PAINT
The default tick mark paint (black).
-
DEFAULT_LENGTH
public static final double DEFAULT_LENGTH
The default tick mark length (5).- See Also:
- Constant Field Values
-
DEFAULT_LABEL_FONT
public static final java.awt.Font DEFAULT_LABEL_FONT
The default tick label font (sanserif, plain, 12).
-
DEFAULT_LABEL_PAINT
public static final java.awt.Paint DEFAULT_LABEL_PAINT
The default tick label paint (black).
-
DEFAULT_LABEL_OFFSET
public static final double DEFAULT_LABEL_OFFSET
The default offset from the tick mark to the tick label (5).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Ticks
public Ticks()
Construct a new ticks information object. The tick marks have the default stroke, the default paint, and the default length. There are no tick labels.
-
Ticks
public Ticks(java.text.DecimalFormat theLabelFormat)
Construct a new ticks information object. The tick marks have the default stroke, the default paint, and the default length. The tick labels have the given decimal format, no scaling, the default font, the default paint, and the default offset from the tick marks.- Parameters:
theLabelFormat- Format for the tick labels. If null, no tick labels are drawn.
-
Ticks
public Ticks(java.text.DecimalFormat theLabelFormat, double theLabelScale)Construct a new ticks information object. The tick marks have the default stroke, the default paint, and the default length. The tick labels have the given decimal format, the given scaling, the default font, the default paint, and the default offset from the tick marks.- Parameters:
theLabelFormat- Format for the tick labels. If null, no tick labels are drawn.theLabelScale- Scale factor for the tick labels. Each tick label's numerical value is divided by theLabelScale before being displayed. Use a value of 1.0 for no scaling.- Throws:
java.lang.IllegalArgumentException- (unchecked exception) Thrown if theLabelFormat is non-null and theLabelScale is equal to 0.
-
Ticks
public Ticks(java.awt.Stroke theStroke, java.awt.Paint thePaint, double theLength, java.text.DecimalFormat theLabelFormat, double theLabelScale, java.awt.Font theLabelFont, java.awt.Paint theLabelPaint, double theLabelOffset)Construct a new ticks information object. The tick marks have the given stroke, the given paint, and the given length. The tick labels have the given decimal format, the given scaling, the given font, the given paint, and the given offset from the tick marks.- Parameters:
theStroke- Stroke for drawing tick marks on the display.thePaint- Paint for drawing tick marks on the display.theLength- Length of the tick marks on the display.theLabelFormat- Format for the tick labels. If null, no tick labels are drawn.theLabelScale- Scale factor for the tick labels. Each tick label's numerical value is divided by theLabelScale before being displayed. Use a value of 1.0 for no scaling.theLabelFont- Font for drawing tick labels on the display, if any. Ignored if no tick labels are to be drawn.theLabelPaint- Paint for drawing tick labels on the display, if any. Ignored if no tick labels are to be drawn.theLabelOffset- Offset from the tick marks to the tick labels, if any. Ignored if no tick labels are to be drawn.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theStroke is null, thePaint is null, theLabelFormat is non-null and theLabelFont is null, or theLabelFormat is non-null and theLabelPaint is null.java.lang.IllegalArgumentException- (unchecked exception) Thrown if theLength is less than or equal to 0, theLabelFormat is non-null and theLabelScale is equal to 0, or theLabelFormat is non-null and theLabelOffset is less than or equal to 0.
-
-
Method Detail
-
getStroke
public java.awt.Stroke getStroke()
Returns the stroke for drawing tick marks on the display.
-
getPaint
public java.awt.Paint getPaint()
Returns the paint for drawing tick marks on the display.
-
getLength
public double getLength()
Returns the length of the tick marks on the display.
-
getLabelFormat
public java.text.DecimalFormat getLabelFormat()
Returns the format for the tick labels. If no tick labels are to be drawn, null is returned.
-
getLabelScale
public double getLabelScale()
Returns the scale factor for the tick labels. Each tick label's numerical value is divided by the scale factor before being displayed. If no tick labels are to be drawn, 1.0 is returned.
-
getLabelFont
public java.awt.Font getLabelFont()
Returns the font for drawing tick labels on the display. If no tick labels are to be drawn, null is returned.
-
getLabelPaint
public java.awt.Paint getLabelPaint()
Returns the paint for drawing tick labels on the display. If no tick labels are to be drawn, null is returned.
-
getLabelOffset
public double getLabelOffset()
Returns the offset from the tick marks to the tick labels. If no tick labels are to be drawn, 0 is returned.
-
drawLeft
public void drawLeft(java.awt.Graphics2D g2d)
Draw a tick to the left. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going to the left. There is no tick label.- Parameters:
g2d- 2-D graphics context.
-
drawLeft
public void drawLeft(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick to the left. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going to the left. The tick label, if any, is drawn to the left of the tick mark with the given numerical value.- Parameters:
g2d- 2-D graphics context.theLabelValue- Numerical value for the tick label, if any.
-
drawRight
public void drawRight(java.awt.Graphics2D g2d)
Draw a tick to the right. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going to the right. There is no tick label.- Parameters:
g2d- 2-D graphics context.
-
drawRight
public void drawRight(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick to the right. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going to the right. The tick label, if any, is drawn to the right of the tick mark with the given numerical value.- Parameters:
g2d- 2-D graphics context.theLabelValue- Numerical value for the tick label, if any.
-
drawBelow
public void drawBelow(java.awt.Graphics2D g2d)
Draw a tick below. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going downwards. There is no tick label.- Parameters:
g2d- 2-D graphics context.
-
drawBelow
public void drawBelow(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick below. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going downwards. The tick label, if any, is drawn below the tick mark with the given numerical value.- Parameters:
g2d- 2-D graphics context.theLabelValue- Numerical value for the tick label, if any.
-
drawAbove
public void drawAbove(java.awt.Graphics2D g2d)
Draw a tick above. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going upwards. There is no tick label.- Parameters:
g2d- 2-D graphics context.
-
drawAbove
public void drawAbove(java.awt.Graphics2D g2d, double theLabelValue)Draw a tick above. The tick mark is drawn in the given graphics context starting at coordinates (0, 0) and going upwards. The tick label, if any, is drawn above the tick mark with the given numerical value.- Parameters:
g2d- 2-D graphics context.theLabelValue- Numerical value for the tick label, if any.
-
-
DMelt 3.0 © DataMelt by jWork.ORG