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.
|
-
ATTACH_COORD
-
-
ATTACH_DATACOORD
-
-
ATTACH_DATAINDEX
-
-
ATTACH_NONE
-
-
AUTO
-
-
CENTER
-
-
EAST
-
-
NORTH
-
-
NORTHEAST
-
-
NORTHWEST
-
-
SOUTH
-
-
SOUTHEAST
-
-
SOUTHWEST
-
-
WEST
-
-
JCChartLabel()
- Default constructor for JCChartLabel, required by Java Beans
-
JCChartLabel(String, boolean)
- Constructor for JCChartLabel.
-
addNotify()
- Send addNotify() to superclass and recalculate values
-
changeChart(JCChartEvent)
- If the chart has been translated or otherwise updated,
recalculate the location of this label.
-
getAnchor()
- Gets the Anchor property.
-
getAttachMethod()
- Get the Attachment Method of the label.
-
getChart()
- Get the chart associated with this label
-
getCoord()
- Get the coordinates to which the label is attached.
-
getDataCoord()
- Get the data coordinates to which the label is attached.
-
getDataIndex()
- Get the data item to which the label is attached.
-
getDataView()
- Get the view to which the label is attached.
-
getDwellDelay()
- Get the amount of time to wait before displaying
this (dwell) label.
-
getIsDwellLabel()
- Get the value indicating if this is a dwell label or not.
-
getOffset()
- Get the adjustment to the location of the label relative to
the position determined by the attachMethod.
-
paint(Graphics)
- Recalculate the label and repaint
using the provided graphics context
-
paintChart(JCChart)
- No action required if the chart paints itself
-
paintComponent(Graphics)
- Recalculate the label and repaint the component
using the provided graphics context
-
recalc()
- Determine the correct location of the label and move there
-
setAnchor(int)
- Sets the Anchor property.
-
setAttachMethod(int)
- Set the Attachment Method of the label.
-
setCoord(Point)
- Set the coordinates to which the label is attached.
-
setDataCoord(JCDataCoord)
- Set the data coordinates to which the label is attached.
-
setDataIndex(JCDataIndex)
- Set the data item to which the label is attached.
-
setDataView(ChartDataView)
- Set the view to which the label is attached.
-
setDwellDelay(int)
- Set the amount of time to wait before displaying
this (dwell) label.
-
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.
-
setOffset(Point)
- Set the Offset to adjust the location of the label relative to
the position determined by the attachMethod.
NORTHEAST
public static final int NORTHEAST
NORTH
public static final int NORTH
NORTHWEST
public static final int NORTHWEST
EAST
public static final int EAST
WEST
public static final int WEST
SOUTHEAST
public static final int SOUTHEAST
SOUTH
public static final int SOUTH
SOUTHWEST
public static final int SOUTHWEST
CENTER
public static final int CENTER
AUTO
public static final int AUTO
ATTACH_NONE
public static final int ATTACH_NONE
ATTACH_COORD
public static final int ATTACH_COORD
ATTACH_DATACOORD
public static final int ATTACH_DATACOORD
ATTACH_DATAINDEX
public static final int ATTACH_DATAINDEX
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.
JCChartLabel
public JCChartLabel()
- Default constructor for JCChartLabel, required by Java Beans
addNotify
public void addNotify()
- Send addNotify() to superclass and recalculate values
- Overrides:
- addNotify in class JCComponent
recalc
public void recalc()
- Determine the correct location of the label and move there
- Overrides:
- recalc in class JCTitle
paint
public void paint(Graphics g)
- Recalculate the label and repaint
using the provided graphics context
- Overrides:
- paint in class JCComponent
paintComponent
public void paintComponent(Graphics g)
- Recalculate the label and repaint the component
using the provided graphics context
- Overrides:
- paintComponent in class JCTitle
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.
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.
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.
getAttachMethod
public int getAttachMethod()
- Get the Attachment Method of the label.
- Returns:
- one of ATTACH_NONE, ATTACH_COORD, ATTACH_DATACOORD,
or ATTACH_DATAINDEX
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
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
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.
getDataView
public ChartDataView getDataView()
- Get the view to which the label is attached.
- Returns:
- dv the ChartDataView that the label is attached relative to.
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
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
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
getDataIndex
public JCDataIndex getDataIndex()
- Get the data item to which the label is attached.
- Returns:
- di the data index to attach the label to
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.
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.
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.
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
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
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
getChart
public JCChart getChart()
- Get the chart associated with this label
- Returns:
- the chart instance that is the parent of this label
changeChart
public void changeChart(JCChartEvent e)
- If the chart has been translated or otherwise updated,
recalculate the location of this label.
paintChart
public void paintChart(JCChart chart)
- No action required if the chart paints itself
All Packages Class Hierarchy This Package Previous Next Index