jas2.plot
Class StringAxis
- java.lang.Object
-
- jas2.plot.AxisType
-
- jas2.plot.StringAxis
-
- All Implemented Interfaces:
- CoordinateTransformation, StringCoordinateTransformation, java.io.Externalizable, java.io.Serializable
public final class StringAxis extends AxisType implements StringCoordinateTransformation
This class simply displays a given array of strings. Use for a histogram with a string partition, or if there are very specific labels (numeric or other) you want on the axis. This class displays strings in two formats, represented by two static constants:CENTER_TEXT_IN_DIVISION: a tick mark and label will be centered in a divisionTEXT_BESIDE_DIVISION: a tick mark and label will be on either side of a division
Use the method
setLabelPlacementStyle(int)to change the setting.Labels are displayed in the order as they appear in the array given to the method
setLabels(String[])from left to right on a horizontal axis and from bottom to top on a vertical axis.
-
-
Field Summary
Fields Modifier and Type Field and Description static intCENTER_TEXT_IN_DIVISIONRepresents a display style where a tick and label are centered in a division.static intTEXT_BESIDE_DIVISIONRepresents a display style where a tick and label are on either side of a division.
-
Constructor Summary
Constructors Constructor and Description StringAxis()Creates a new string axis type object, with labels and ticks centered in a division.StringAxis(int labelPlacementStyle)Creates a new string axis type object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebinWidth()doubleconvert(java.lang.String s)intgetLabelPlacementStyle()Returns the label placement style: eitherCENTER_TEXT_IN_DIVISIONorTEXT_BESIDE_DIVISION.java.lang.String[]getLabels()Returns the labels used for this axis.voidreadExternal(java.io.ObjectInput in)voidsetLabelPlacementStyle(int labelPlacementStyle)Sets the label placement style.voidsetLabels(java.lang.String[] labels)Sets the labels to display.voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
CENTER_TEXT_IN_DIVISION
public static final int CENTER_TEXT_IN_DIVISION
Represents a display style where a tick and label are centered in a division.- See Also:
- Constant Field Values
-
TEXT_BESIDE_DIVISION
public static final int TEXT_BESIDE_DIVISION
Represents a display style where a tick and label are on either side of a division.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringAxis
public StringAxis()
Creates a new string axis type object, with labels and ticks centered in a division.- See Also:
CENTER_TEXT_IN_DIVISION
-
StringAxis
public StringAxis(int labelPlacementStyle)
Creates a new string axis type object.- Parameters:
labelPlacementStyle- how to place labels (supply eitherCENTER_TEXT_IN_DIVISIONorTEXT_BESIDE_DIVISION)- See Also:
CENTER_TEXT_IN_DIVISION,TEXT_BESIDE_DIVISION
-
-
Method Detail
-
setLabelPlacementStyle
public void setLabelPlacementStyle(int labelPlacementStyle)
Sets the label placement style. Supply eitherCENTER_TEXT_IN_DIVISIONorTEXT_BESIDE_DIVISION.- See Also:
CENTER_TEXT_IN_DIVISION,TEXT_BESIDE_DIVISION
-
getLabelPlacementStyle
public int getLabelPlacementStyle()
Returns the label placement style: eitherCENTER_TEXT_IN_DIVISIONorTEXT_BESIDE_DIVISION.- See Also:
CENTER_TEXT_IN_DIVISION,TEXT_BESIDE_DIVISION
-
setLabels
public void setLabels(java.lang.String[] labels)
Sets the labels to display.
-
getLabels
public java.lang.String[] getLabels()
Returns the labels used for this axis.
-
convert
public double convert(java.lang.String s)
- Specified by:
convertin interfaceStringCoordinateTransformation
-
binWidth
public double binWidth()
- Specified by:
binWidthin interfaceStringCoordinateTransformation
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG