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.
|
-
anchor_strings
-
-
anchor_values
-
-
ATTACH_COORD
-
-
ATTACH_DATACOORD
-
-
ATTACH_DATAINDEX
-
-
ATTACH_NONE
-
-
attachMethod_strings
-
-
attachMethod_values
-
-
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.
-
draw(Graphics)
- Recalculate the label and repaint
using the provided graphics context
-
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.
-
loadParams(String, JCChart)
- Load JCChart parameters from HTML file
-
recalc()
- Determine the correct location of the label and move there
-
saveParams(String, JCChart)
- Save JCChart parameters as HTML tags
-
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
attachMethod_values
public static final int attachMethod_values[]
attachMethod_strings
public static final String attachMethod_strings[]
anchor_values
public static final int anchor_values[]
anchor_strings
public static final String anchor_strings[]
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
recalc
public void recalc()
- Determine the correct location of the label and move there
- Overrides:
- recalc in class JCTitle
draw
public void draw(Graphics g)
- Recalculate the label and repaint
using the provided graphics context
- Overrides:
- draw in class JCTitle
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.
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
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
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