public class PlotLineLabel extends Configurable<PlotLineLabel>
PlotLine, and
can then be passed to the PlotLine.setLabel(PlotLineLabel) method. Example usage:
XAxis xAxis = chart.getXAxis();
xAxis.setPlotLines(
xAxis.createPlotLine()
.setColor("#CC0000")
.setValue(40)
.setPlotLineLabel(
new PlotLineLabel()
.setAlign(PlotLineLabel.LEFT)
.setX(20)
),
xAxis.createPlotLine()
.setColor("#009900")
.setValue(60)
);
| Modifier and Type | Class and Description |
|---|---|
static class |
PlotLineLabel.Align
An enumeration of supported plot line label alignment types, which can be passed to methods
like
setAlign(Align) method. |
static class |
PlotLineLabel.TextAlign
An enumeration of supported plot line label text alignment types, which can be passed to methods
like
setTextAlign(TextAlign) method. |
static class |
PlotLineLabel.VerticalAlign
An enumeration of supported plot line label vertical alignment types, which can be passed to methods
like
setVerticalAlign(PlotLineLabel.VerticalAlign). |
| Constructor and Description |
|---|
PlotLineLabel() |
| Modifier and Type | Method and Description |
|---|---|
PlotLineLabel |
setAlign(PlotLineLabel.Align align)
Convenience method for setting the 'align' option for the label.
|
PlotLineLabel |
setRotation(Number rotation)
Convenience method for setting the 'rotation' option for the label.
|
PlotLineLabel |
setStyle(Style style)
Convenience method for setting the 'style' options of the labels.
|
PlotLineLabel |
setText(String text)
Convenience method for setting the 'text' option of the label.
|
PlotLineLabel |
setTextAlign(PlotLineLabel.TextAlign textAlign)
Convenience method for setting the 'textAlign' option for the label.
|
PlotLineLabel |
setVerticalAlign(PlotLineLabel.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option for the label.
|
PlotLineLabel |
setX(Number x)
Convenience method for setting the 'x' position option of the label.
|
PlotLineLabel |
setY(Number y)
Convenience method for setting the 'y' position option of the label.
|
getOptions, setOptionpublic PlotLineLabel setAlign(PlotLineLabel.Align align)
plotLineLabel.setOption("align", PlotLineLabel.Align.CENTER);
Horizontal alignment of the label. Can be one of "left", "center" or "right". Defaults to "center".align - The horizontal alignment of the label.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setRotation(Number rotation)
plotLineLabel.setOption("rotation", 90.0f);
Rotation of the text label in degrees. Defaults to 0 for horizontal plot lines and 90 for vertical lines.rotation - Rotation of the text label in degrees.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setStyle(Style style)
plotLineLabel.setOption("/style/fontWeight", "bold");
plotLineLabel.setOption("/style/fontFamily", "serif");
etc.
style - CSS styles for the text labels.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setText(String text)
plotLineLabel.setOption("text", "Hi Mom!");
text - The raw text to display as the label.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setTextAlign(PlotLineLabel.TextAlign textAlign)
plotLineLabel.setOption("textAlign", PlotLineLabel.TextAlign.RIGHT);
The text alignment for the label. While align determines where the texts anchor point
is placed within the plot band, textAlign determines how the text is aligned against
its anchor point. Possible values are "left", "center" and "right".
Defaults to the same as the align option.textAlign - The text alignment for the label.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setVerticalAlign(PlotLineLabel.VerticalAlign verticalAlign)
plotLineLabel.setOption("verticalAlign", PlotLineLabel.VerticalAlign.TOP);
Vertical alignment of the label relative to the plot band. Can be one of "top", "middle" or "bottom". Defaults to "top".verticalAlign - The vertical alignment of the label relative to the plot band.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setX(Number x)
plotLineLabel.setOption("x", 70);
Horizontal position relative the alignment. Default varies by orientation.x - The horizontal position relative the alignment.PlotLineLabel instance for convenient method chaining.public PlotLineLabel setY(Number y)
plotLineLabel.setOption("y", -20);
Vertical position of the text baseline relative to the alignment. Default varies by orientation.y - The vertical position of the text baseline relative to the alignment.PlotLineLabel instance for convenient method chaining.Copyright © 2015. All Rights Reserved.