All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.chart.JCChartLabel

java.lang.Object
   |
   +----jclass.chart.TrackChange
           |
           +----jclass.chart.ChartRegion
                   |
                   +----jclass.chart.ChartText
                           |
                           +----jclass.chart.JCTitle
                                   |
                                   +----jclass.chart.JCChartLabel

public class JCChartLabel
extends JCTitle
implements JCSerializable, HTMLHandler
JCChartLabel manages and renders a floating label attached somewhere on the chart.

Properties

Name Description
Adjust The Adjust property determines how text is justified (positioned) in the label. Valid values include ChartText.LEFT, ChartText.CENTER and ChartText.RIGHT. Default value is ChartText.LEFT.
Anchor Specifies how the label is to be positioned relative to the specified point. Valid values are JCChartLabel.NORTHEAST, JCChartLabel.NORTHWEST, JCChartLabel.NORTH, JCChartLabel.EAST, JCChartLabel.WEST, JCChartLabel.SOUTHEAST, JCChartLabel.SOUTHWEST and JCChartLabel.SOUTH.
AttachMethod Specifies how the label is attached to the chart. Valid values are JCChartLabel.ATTACH_COORD (attach label to an absolute point anywhere on the chart), JCChartLabel.ATTACH_DATACOORD (attach label to a point in the data space on the chart area), and JCChartLabel.ATTACH_DATAINDEX (attach the label to a specific point/bar/slice on the chart)
Background The Background property determines the background color used to draw inside the chart region. Note that the Background property is inherited from the parent JCTitle.
BorderType Determines the style of border drawn around the label. Valid values come from BWTEnum, and include SHADOW_NONE, SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_PLAIN, SHADOW_FRAME_IN, SHADOW_FRAME_OUT. Default value is BWTEnum.SHADOW_IN.
BorderWidth The BorderWidth property determines the width of the border drawn around the chart label. Default value is 2.
Coord The coordinate in the chart's space where the label is to be attached.
DataCoord The coordinate in the chart area's data space where the label is to be attached.
DataIndex A data index representing the point/bar/slice in the chart to which the label is to be attached.
DataView For labels using ATTACH_DATACOORD, this property specifies which ChartDataView's axes should be used.
DwellDelay Value in milliseconds representing the delay after the mouse arrives at a data point to which a Dwell Label is attached before showing the label. Default is 0, to display the label immediately.
Font The Font property determines what font is used to render text inside the chart region. Note that the Font property is inherited from the parent JCTitle.
Foreground The Foreground property determines the foreground color used to draw inside the chart region. Note that the Foreground property is inherited from the parent JCTitle.
Height The Height property determines the height of the label. Default value is generated.
HeightIsDefault The HeightIsDefault property determines whether the height of the label is calculated by Chart (true) or taken from the Height property (false). Default value is true.
IsDwellLabel When IsDwellLabel is set to true, the label is only displayed when the cursor is over the point/bar/slice that the label is attached to. This property is only used when the label is attached using ATTACH_DATAINDEX. When set to false (the default), the label is always displayed.
IsShowing The IsShowing property determines whether the associated label is currently visible. Default value is true.
Left The Left property determines the location of the left of the label. Default value is generated.
LeftIsDefault The LeftIsDefault property determines whether the left position of the label is calculated by Chart (true) or taken from the Left property (false). Default value is true.
Name The Name property specifies a string identifier for the JCChartLabel object.
Offset Offset specifies where the label should be positioned relative to the position the labels thinks it should be, depending on what the label's attachMethod is.
Parent The Parent property assures the connection to the chart on which the JCChartLabel appears. Default value is null.
ParentRegion The ParentRegion property is the ChartRegion parent. Default value is null.
Text The Text property controls the text displayed inside the label.
Top The Top property determines the location of the top of the label. The default value is calculated.
TopIsDefault The TopIsDefault property determines whether the top position of the label is calculated by Chart (true) or taken from the Top property (false). Default value is true.
Width The Width property determines the width of the label. Default value is generated.
WidthIsDefault The WidthIsDefault property determines whether the width of the label is calculated by Chart (true) or taken from the Width property (false). Default value is true.


Variable Index

 o anchor_strings
 o anchor_values
 o ATTACH_COORD
 o ATTACH_DATACOORD
 o ATTACH_DATAINDEX
 o ATTACH_NONE
 o attachMethod_strings
 o attachMethod_values
 o AUTO
 o CENTER
 o EAST
 o NORTH
 o NORTHEAST
 o NORTHWEST
 o SOUTH
 o SOUTHEAST
 o SOUTHWEST
 o WEST

Constructor Index

 o JCChartLabel()
Default constructor for JCChartLabel, required by Java Beans
 o JCChartLabel(String, boolean)
Constructor for JCChartLabel.

Method Index

 o draw(Graphics)
Recalculate the label and repaint using the provided graphics context
 o getAnchor()
Gets the Anchor property.
 o getAttachMethod()
Get the Attachment Method of the label.
 o getChart()
Get the chart associated with this label
 o getCoord()
Get the coordinates to which the label is attached.
 o getDataCoord()
Get the data coordinates to which the label is attached.
 o getDataIndex()
Get the data item to which the label is attached.
 o getDataView()
Get the view to which the label is attached.
 o getDwellDelay()
Get the amount of time to wait before displaying this (dwell) label.
 o getIsDwellLabel()
Get the value indicating if this is a dwell label or not.
 o getOffset()
Get the adjustment to the location of the label relative to the position determined by the attachMethod.
 o loadParams(String, JCChart)
Load JCChart parameters from HTML file
 o recalc()
Determine the correct location of the label and move there
 o saveParams(String, JCChart)
Save JCChart parameters as HTML tags
 o setAnchor(int)
Sets the Anchor property.
 o setAttachMethod(int)
Set the Attachment Method of the label.
 o setCoord(Point)
Set the coordinates to which the label is attached.
 o setDataCoord(JCDataCoord)
Set the data coordinates to which the label is attached.
 o setDataIndex(JCDataIndex)
Set the data item to which the label is attached.
 o setDataView(ChartDataView)
Set the view to which the label is attached.
 o setDwellDelay(int)
Set the amount of time to wait before displaying this (dwell) label.
 o setIsDwellLabel(boolean)
Set this label to only be displayed when the cursor is over the data to which the label is attached or displayed always.
 o setOffset(Point)
Set the Offset to adjust the location of the label relative to the position determined by the attachMethod.

Variables

 o NORTHEAST
 public static final int NORTHEAST
 o NORTH
 public static final int NORTH
 o NORTHWEST
 public static final int NORTHWEST
 o EAST
 public static final int EAST
 o WEST
 public static final int WEST
 o SOUTHEAST
 public static final int SOUTHEAST
 o SOUTH
 public static final int SOUTH
 o SOUTHWEST
 public static final int SOUTHWEST
 o CENTER
 public static final int CENTER
 o AUTO
 public static final int AUTO
 o ATTACH_NONE
 public static final int ATTACH_NONE
 o ATTACH_COORD
 public static final int ATTACH_COORD
 o ATTACH_DATACOORD
 public static final int ATTACH_DATACOORD
 o ATTACH_DATAINDEX
 public static final int ATTACH_DATAINDEX
 o attachMethod_values
 public static final int attachMethod_values[]
 o attachMethod_strings
 public static final String attachMethod_strings[]
 o anchor_values
 public static final int anchor_values[]
 o anchor_strings
 public static final String anchor_strings[]

Constructors

 o JCChartLabel
 public JCChartLabel(String contents,
                     boolean jcstring)
Constructor for JCChartLabel.

Parameters:
contents - the text to be displayed in the label
jcstring - indicates if the contents should be parsed as a JCString.
 o JCChartLabel
 public JCChartLabel()
Default constructor for JCChartLabel, required by Java Beans

Methods

 o recalc
 public void recalc()
Determine the correct location of the label and move there

Overrides:
recalc in class JCTitle
 o draw
 public void draw(Graphics g)
Recalculate the label and repaint using the provided graphics context

Overrides:
draw in class JCTitle
 o setAnchor
 public void setAnchor(int a)
Sets the Anchor property. This property determines the position of the label relative to the its attachment location.

Parameters:
anchor - one of NORTH, SOUTH, EAST, WEST, NORTHWEST, SOUTHWEST, NORTHEAST or SOUTHEAST
IllegalArgumentException - If the anchor value is not one of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST, CENTER or AUTO.
 o getAnchor
 public int getAnchor()
Gets the Anchor property. This property determines the position of the label relative to the its attachment location.

Returns:
one of NORTH, SOUTH, EAST, WEST, NORTHWEST, SOUTHWEST, NORTHEAST, SOUTHEAST, CENTER or AUTO.
 o setAttachMethod
 public void setAttachMethod(int newMethod)
Set the Attachment Method of the label.

Parameters:
newmethod - one of ATTACH_NONE, ATTACH_COORD, ATTACH_DATACOORD, or ATTACH_DATAINDEX. ATTACH_NONE means don't show the label. ATTACH_COORD means the label is attached is screen (pixel) coordinates relative to the chart. ATTACH_DATACOORD means the label is attached in axis coordinates relative to the associated data view. ATTACH_DATAINDEX means the label is attached to a data item.
IllegalArgumentException - If the anchor value is not one of ATTACH_NONE, ATTACH_COORD, ATTACH_DATACOORD, ATTACH_DATAINDEX.
 o getAttachMethod
 public int getAttachMethod()
Get the Attachment Method of the label.

Returns:
one of ATTACH_NONE, ATTACH_COORD, ATTACH_DATACOORD, or ATTACH_DATAINDEX
 o setCoord
 public void setCoord(Point p)
Set the coordinates to which the label is attached. This is used when the label's AttachMethod is ATTACH_COORD.

Parameters:
p - the point in chart pixel coordinates to attach the label
 o getCoord
 public Point getCoord()
Get the coordinates to which the label is attached.

Returns:
p the point in chart pixel coordinates to attach the label
 o setDataView
 public void setDataView(ChartDataView dv)
Set the view to which the label is attached. This indicates the axes or data to use to locate the label when the attachMethod is ATTACH_DATACOORD or ATTACH_DATAINDEX.

Parameters:
dv - the ChartDataView that the label is attached relative to.
 o getDataView
 public ChartDataView getDataView()
Get the view to which the label is attached.

Returns:
dv the ChartDataView that the label is attached relative to.
 o setDataCoord
 public void setDataCoord(JCDataCoord p)
Set the data coordinates to which the label is attached. if the label's AttachMethod is ATTACH_DATACOORD.

Parameters:
p - the coordinate in chart axis coordinates to attach the label
 o getDataCoord
 public JCDataCoord getDataCoord()
Get the data coordinates to which the label is attached. if the label's AttachMethod is ATTACH_DATACOORD.

Returns:
p the coordinate in chart axis coordinates to which the label is attached
 o setDataIndex
 public void setDataIndex(JCDataIndex di)
Set the data item to which the label is attached. This is used when the label's AttachMethod is ATTACH_DATAINDEX.

Parameters:
di - the data index to attach the label to
 o getDataIndex
 public JCDataIndex getDataIndex()
Get the data item to which the label is attached.

Returns:
di the data index to attach the label to
 o setOffset
 public void setOffset(Point point)
Set the Offset to adjust the location of the label relative to the position determined by the attachMethod.

Parameters:
point - the x and y adjustment to apply to the calculated location.
 o getOffset
 public Point getOffset()
Get the adjustment to the location of the label relative to the position determined by the attachMethod.

Returns:
point the x and y correction to applied to the calculated location.
 o setIsDwellLabel
 public void setIsDwellLabel(boolean b)
Set this label to only be displayed when the cursor is over the data to which the label is attached or displayed always.

Parameters:
b - if true, this is a transient label which will be displayed only when the mouse is over the data item. If false, the label will always be displayed.
 o getIsDwellLabel
 public boolean getIsDwellLabel()
Get the value indicating if this is a dwell label or not.

Returns:
true if this is a transient label, false if this is a 'permanent' label
 o setDwellDelay
 public void setDwellDelay(int delay)
Set the amount of time to wait before displaying this (dwell) label.

Parameters:
delay - the amount of time in milliseconds to wait
 o getDwellDelay
 public int getDwellDelay()
Get the amount of time to wait before displaying this (dwell) label.

Returns:
delay the amount of time in milliseconds to wait
 o getChart
 public JCChart getChart()
Get the chart associated with this label

Returns:
the chart instance that is the parent of this label
 o saveParams
 public void saveParams(String name,
                        JCChart comp)
Save JCChart parameters as HTML tags

Parameters:
name - the PARAM NAME
chart - the JCChart component
Overrides:
saveParams in class JCTitle
 o loadParams
 public void loadParams(String name,
                        JCChart comp)
Load JCChart parameters from HTML file

Parameters:
name - the PARAM NAME
chart - the JCChart component
Overrides:
loadParams in class JCTitle

All Packages  Class Hierarchy  This Package  Previous  Next  Index