Class CurveLabel
- java.lang.Object
-
- eu.webtoolkit.jwt.chart.CurveLabel
-
public class CurveLabel extends java.lang.ObjectA curve label.Curve labels can be added with
WCartesianChart#addCurveLabel(). They are associated with a particular series, and are drawn at the given point in model coordinates. When the chart is transformed (zoom or pan) or the associated series is manipulated, the curve label's position will change, but not its size.
A curve label
-
-
Constructor Summary
Constructors Constructor Description CurveLabel(WDataSeries series, WPointF point, java.lang.String label)Create a new curve label.CurveLabel(WDataSeries series, java.lang.Object x, java.lang.Object y, java.lang.String label)Create a new curve label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WBrushgetBoxBrush()Get the brush to use for the box around the text.java.lang.StringgetLabel()Get the label that should be drawn in the box.WPengetLinePen()Get the pen to use for the connecting line.WBrushgetMarkerBrush()Get the brush used to fill the circle atgetPoint().WPointFgetOffset()Get the offset the text should be placed at.WPointFgetPoint()Get the point in model coordinates this label is associated with.WDataSeriesgetSeries()Get the series this curve label is associated with.WPengetTextPen()Get the pen for the text in the box.intgetWidth()Get the width of the box in pixels.java.lang.ObjectgetX()Get the x position for this label.java.lang.ObjectgetY()Get the y position for this label.voidrender(WPainter painter)voidsetBoxBrush(WBrush brush)Set the brush to use for the box around the text.voidsetLabel(java.lang.String label)Set the label that should be drawn in the box.voidsetLinePen(WPen pen)Set the pen to use for the connecting line.voidsetMarkerBrush(WBrush brush)Set the brush used to fill the circle atgetPoint().voidsetOffset(WPointF offset)Set the offset the text should be placed at.voidsetPoint(WPointF point)Set the point in model coordinates this label is associated with.voidsetPoint(java.lang.Object x, java.lang.Object y)Set the point in model coordinates this label is associated with.voidsetSeries(WDataSeries series)Set the series this curve label is associated with.voidsetTextPen(WPen pen)Set the pen for the text in the box.voidsetWidth(int width)Set the width of the box in pixels.
-
-
-
Constructor Detail
-
CurveLabel
public CurveLabel(WDataSeries series, WPointF point, java.lang.String label)
Create a new curve label.Create a new curve label for given series, at the given point with the given text.
-
CurveLabel
public CurveLabel(WDataSeries series, java.lang.Object x, java.lang.Object y, java.lang.String label)
Create a new curve label.Create a new curve label for given series, at the given x, y coordinates and the given text.
-
-
Method Detail
-
setSeries
public void setSeries(WDataSeries series)
Set the series this curve label is associated with.
-
getSeries
public WDataSeries getSeries()
Get the series this curve label is associated with.- See Also:
setSeries(WDataSeries series)
-
setPoint
public void setPoint(WPointF point)
Set the point in model coordinates this label is associated with.
-
setPoint
public void setPoint(java.lang.Object x, java.lang.Object y)Set the point in model coordinates this label is associated with.
-
getPoint
public WPointF getPoint()
Get the point in model coordinates this label is associated with.Note: This uses asNumber(), which may not be the same conversion that
WCartesianChart#mapToDevice()uses, depending on the scale of the axis.getX()andgetY()will perform no conversion, so they may be safer to use.- See Also:
setPoint(WPointF point)
-
getX
public java.lang.Object getX()
Get the x position for this label.- See Also:
setPoint(WPointF point)
-
getY
public java.lang.Object getY()
Get the y position for this label.- See Also:
setPoint(WPointF point)
-
setLabel
public void setLabel(java.lang.String label)
Set the label that should be drawn in the box.
-
getLabel
public java.lang.String getLabel()
Get the label that should be drawn in the box.- See Also:
setLabel(String label)
-
setOffset
public void setOffset(WPointF offset)
Set the offset the text should be placed at.The offset is defined in pixels, with x values going from left to right, and y values from top to bottom.
The default offset is (60, -20), which means the middle of the
getLabel()is drawn 60 pixels to the right, and 20 pixels above the point.
-
getOffset
public WPointF getOffset()
Get the offset the text should be placed at.- See Also:
setOffset(WPointF offset)
-
setWidth
public void setWidth(int width)
Set the width of the box in pixels.If the width is 0 (the default), server side font metrics will be used to determine the size of the box.
-
getWidth
public int getWidth()
Get the width of the box in pixels.- See Also:
setWidth(int width)
-
setLinePen
public void setLinePen(WPen pen)
Set the pen to use for the connecting line.This sets the pen to use for the line connecting the
getPoint()to the box with thegetLabel()atgetOffset()pixels from the point.
-
getLinePen
public WPen getLinePen()
Get the pen to use for the connecting line.- See Also:
setLinePen(WPen pen)
-
setTextPen
public void setTextPen(WPen pen)
Set the pen for the text in the box.
-
getTextPen
public WPen getTextPen()
Get the pen for the text in the box.- See Also:
setTextPen(WPen pen)
-
setBoxBrush
public void setBoxBrush(WBrush brush)
Set the brush to use for the box around the text.This sets the brush used to fill the box with the text defined in
getLabel().
-
getBoxBrush
public WBrush getBoxBrush()
Get the brush to use for the box around the text.- See Also:
setBoxBrush(WBrush brush)
-
setMarkerBrush
public void setMarkerBrush(WBrush brush)
Set the brush used to fill the circle atgetPoint().
-
getMarkerBrush
public WBrush getMarkerBrush()
Get the brush used to fill the circle atgetPoint().- See Also:
setMarkerBrush(WBrush brush)
-
render
public void render(WPainter painter)
-
-