|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jidesoft.chart.annotation.AbstractAnnotation
com.jidesoft.chart.annotation.AbstractLabel
com.jidesoft.chart.annotation.ChartLabel
public class ChartLabel
A Chart Label is a simple label of textual information that can be used as an annotation on a point of a Chart. It can be used to point out particular features of a chart such as maxima or minima, to label regions of interest, or to give more details about the points that they annotate such as the precise x and y coordinates or other (unshown) attributes of the point object.
Note that when providing the coordinates to be used for displaying the label, they:
pixelOffset
if you
are labelling a point at the given position.
The following screenshot shows ChartLabels being used to give additional information on all the points in a model when the user moves his mouse over an item in the legend:
Constructor Summary | |
---|---|
ChartLabel(double x,
double y)
Create a ChartLabel at the given user coordinates, but with the text of the label set to null . |
|
ChartLabel(double x,
double y,
String label)
Create a chart label annotation to be placed at the given position. |
|
ChartLabel(Positionable x,
Positionable y)
Create a ChartLabel at the given user coordinates, but with the text of the label set to null . |
|
ChartLabel(Positionable x,
Positionable y,
String label)
Create a ChartLabel at the given user coordinates, with the supplied text label. |
|
ChartLabel(Positionable x,
Positionable y,
String label,
Color color)
Create ChartLabel at the given user coordinates, with the supplied text label and text color. |
|
ChartLabel(Positionable x,
Positionable y,
String label,
Color color,
Font font)
Create ChartLabel at the given user coordinates, with the supplied text label and text color. |
Method Summary | |
---|---|
int |
compareTo(Chartable other)
Compares with other Chartables based on their x coordinates |
void |
draw(Graphics2D g,
Chart chart)
Draws this Chart Label onto the supplied graphics context using properties of the supplied chart instance. |
boolean |
equals(Object obj)
|
Color |
getBackground()
Returns the current background color used for the label |
Border |
getBorder()
Returns the current border on the ChartLabel (or null if none has been set) |
Point |
getPixelOffset()
Returns the offset in pixel values that is applied to the position of the ChartLabel after the x,y user coordinates have been calculated |
Positionable |
getX()
Gets the x coordinate of the Chartable object |
Positionable |
getY()
Gets the y coordinate of the Chartable object |
int |
hashCode()
|
void |
setBackground(Color background)
Specify the background color to be used for the label. |
void |
setBorder(Border border)
Specify the border to use for the ChartLabel. |
void |
setPixelOffset(Point pixelOffset)
Specify the offset in pixel values to be applied to the position of the ChartLabel after the x,y user coordinates have been calculated |
String |
toString()
|
Methods inherited from class com.jidesoft.chart.annotation.AbstractLabel |
---|
getColor, getFont, getLabel, getLabelComponent, getLabelStyle, getRotation, paint, paint, setColor, setFont, setLabel, setLabelStyle, setRotation, size |
Methods inherited from class com.jidesoft.chart.annotation.AbstractAnnotation |
---|
getZOrder, setZOrder |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jidesoft.chart.annotation.ChartAnnotation |
---|
getZOrder |
Constructor Detail |
---|
public ChartLabel(double x, double y, String label)
x
- the x coordinate in the user spacey
- the y coordinate in the user spacelabel
- the label to drawpublic ChartLabel(double x, double y)
null
.
To make the label useful, you will presumably be calling setLabel()
with a string value at
some later stage.
x
- the x coordinate in the user spacey
- the y coordinate in the user spacepublic ChartLabel(Positionable x, Positionable y)
null
.
This constructor accepts Positionable
objects to specify the user coordinates, so you may be
using a ChartCategory
or a RealPosition
to define the location.
x
- the x coordinate of the labely
- the y coordinate of the labelpublic ChartLabel(Positionable x, Positionable y, String label)
x
- the x coordinate of the centre of the labely
- the y coordinate of the centre of the labellabel
- the text of the label. If the label starts with '' it will be interpreted as an HTML fragment.public ChartLabel(Positionable x, Positionable y, String label, Color color)
x
- the x coordinate of the centre of the labely
- the y coordinate of the centre of the labellabel
- the text of the label. If the label starts with '' it will be interpreted as an HTML fragment.color
- the color of the text of the labelpublic ChartLabel(Positionable x, Positionable y, String label, Color color, Font font)
x
- the x coordinate of the centre of the labely
- the y coordinate of the centre of the labellabel
- the text of the label. If the label starts with '' it will be interpreted as an HTML fragment.color
- the color of the text of the labelfont
- the font to be used for the labelMethod Detail |
---|
public Color getBackground()
public void setBackground(Color background)
background
- the background color to be used on the labelpublic Border getBorder()
public void setBorder(Border border)
border
- the border to usepublic Positionable getX()
getX
in interface Chartable
public Positionable getY()
getY
in interface Chartable
public Point getPixelOffset()
public void setPixelOffset(Point pixelOffset)
pixelOffset
- the pixel offset to be applied to the position of the chart labelpublic int compareTo(Chartable other)
compareTo
in interface Comparable<Chartable>
other
- the other Chartable with which this object is to be compared
public void draw(Graphics2D g, Chart chart)
draw
in interface ChartAnnotation
g
- the Graphics contextchart
- the chart from which property values may be taken and applied to the labelpublic int hashCode()
hashCode
in class AbstractLabel
public boolean equals(Object obj)
equals
in class AbstractLabel
public String toString()
toString
in class AbstractLabel
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |