All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.chart.JCChartLabel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----jclass.bwt.JCComponent
                           |
                           +----jclass.chart.ChartCanvas
                                   |
                                   +----jclass.chart.JCTitle
                                           |
                                           +----jclass.chart.JCChartLabel

public class JCChartLabel
extends JCTitle
implements JCSerializable, JCChartListener
A JCChartLabel object represents a floating label attached somewhere on the chart. Currently the labels are implemented by inheriting (indirectly) from java.awt.Canvas and are thus non-transparent. Hopefully, this will be changed in the future.

Properties

Name Method
IsShowing If true, the ChartLabel will appear on the screen. If false, it will not appear on the screen. Default value is true.
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. (Note that legend, header, footer and chart area are all ChartCanvas instances). Default value is BWTEnum.SHADOW_IN.
BorderWidth The BorderWidth property determines the width of the border drawn around the canvas. Default value is 2.
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.
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.
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.
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.
Adjust The Adjust property determines how text is justified or 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 Specified what type of point the label is attached to. 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

JCChartLabel.ATTACH_DATAINDEX - attach the label to a specific point/bar/slice on the chart

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.
Data Index A data index representing the point/bar/slice in the chart to which the label is to be attached.
IsDwellLabel If 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 flag is only valid for for labels using ATTACH_DATAINDEX as its attachMethod. If IsDwellLabel is false (the default), the label will always be displayed.
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.
DataView For labels using ATTACH_DATACOORD, this property specifies which ChartDataView's axes should be used.
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.


Variable Index

 o ATTACH_COORD
 o ATTACH_DATACOORD
 o ATTACH_DATAINDEX
 o ATTACH_NONE
 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 addNotify()
Send addNotify() to superclass and recalculate values
 o changeChart(JCChartEvent)
If the chart has been translated or otherwise updated, recalculate the location of this label.
 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 paint(Graphics)
Recalculate the label and repaint using the provided graphics context
 o paintChart(JCChart)
No action required if the chart paints itself
 o paintComponent(Graphics)
Recalculate the label and repaint the component using the provided graphics context
 o recalc()
Determine the correct location of the label and move there
 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

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 addNotify
 public void addNotify()
Send addNotify() to superclass and recalculate values

Overrides:
addNotify in class JCComponent
 o recalc
 public void recalc()
Determine the correct location of the label and move there

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

Overrides:
paint in class JCComponent
 o paintComponent
 public void paintComponent(Graphics g)
Recalculate the label and repaint the component using the provided graphics context

Overrides:
paintComponent in class JCTitle
 o setAnchor
 public synchronized 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 changeChart
 public void changeChart(JCChartEvent e)
If the chart has been translated or otherwise updated, recalculate the location of this label.

 o paintChart
 public void paintChart(JCChart chart)
No action required if the chart paints itself


All Packages  Class Hierarchy  This Package  Previous  Next  Index