public class PlotBandLabel extends Configurable<PlotBandLabel>
PlotBand, and
can then be passed to the PlotBand.setLabel(PlotBandLabel) method. Example usage:
XAxis xAxis = chart.getXAxis();
xAxis.setPlotBands(
xAxis.createPlotBand()
.setColor("#CC0000")
.setFrom(40)
.setTo(80)
.setPlotBandLabel(
new PlotBandLabel()
.setAlign(PlotBandLabel.LEFT)
.setX(20)
),
xAxis.createPlotBand()
.setColor("#009900")
.setFrom(80)
.setTo(120)
);
| Modifier and Type | Class and Description |
|---|---|
static class |
PlotBandLabel.Align
An enumeration of supported plot band label alignment types, which can be passed to methods
like
setAlign(Align) method. |
static class |
PlotBandLabel.TextAlign
An enumeration of supported plot band label text alignment types, which can be passed to methods
like
setTextAlign(TextAlign) method. |
static class |
PlotBandLabel.VerticalAlign
An enumeration of supported plot band label vertical alignment types, which can be passed to methods
like
setVerticalAlign(PlotBandLabel.VerticalAlign). |
| Constructor and Description |
|---|
PlotBandLabel() |
| Modifier and Type | Method and Description |
|---|---|
PlotBandLabel |
setAlign(PlotBandLabel.Align align)
Convenience method for setting the 'align' option for the label.
|
PlotBandLabel |
setRotation(Number rotation)
Convenience method for setting the 'rotation' option for the label.
|
PlotBandLabel |
setStyle(Style style)
Convenience method for setting the 'style' options of the labels.
|
PlotBandLabel |
setText(String text)
Convenience method for setting the 'text' option of the label.
|
PlotBandLabel |
setTextAlign(PlotBandLabel.TextAlign textAlign)
Convenience method for setting the 'textAlign' option for the label.
|
PlotBandLabel |
setVerticalAlign(PlotBandLabel.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option for the label.
|
PlotBandLabel |
setX(Number x)
Convenience method for setting the 'x' position option of the label.
|
PlotBandLabel |
setY(Number y)
Convenience method for setting the 'y' position option of the label.
|
getOptions, setOptionpublic PlotBandLabel setAlign(PlotBandLabel.Align align)
plotBandLabel.setOption("align", PlotBandLabel.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.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setRotation(Number rotation)
plotBandLabel.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.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setStyle(Style style)
plotBandLabel.setOption("/style/fontWeight", "bold");
plotBandLabel.setOption("/style/fontFamily", "serif");
etc.
style - CSS styles for the text labels.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setText(String text)
plotBandLabel.setOption("text", "Hi Mom!");
text - The raw text to display as the label.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setTextAlign(PlotBandLabel.TextAlign textAlign)
plotBandLabel.setOption("textAlign", PlotBandLabel.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.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setVerticalAlign(PlotBandLabel.VerticalAlign verticalAlign)
plotBandLabel.setOption("verticalAlign", PlotBandLabel.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.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setX(Number x)
plotBandLabel.setOption("x", 70);
Horizontal position relative the alignment. Default varies by orientation.x - The horizontal position relative the alignment.PlotBandLabel instance for convenient method chaining.public PlotBandLabel setY(Number y)
plotBandLabel.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.PlotBandLabel instance for convenient method chaining.Copyright © 2015. All Rights Reserved.