org.moxieapps.gwt.highcharts.client.labels
Class PlotBandLabel

java.lang.Object
  extended by org.moxieapps.gwt.highcharts.client.Configurable<PlotBandLabel>
      extended by org.moxieapps.gwt.highcharts.client.labels.PlotBandLabel

public class PlotBandLabel
extends Configurable<PlotBandLabel>

Represents the configuration options that can be set for the labels of a 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)
   );
 

Since:
1.0.0
Author:
squinn@moxiegroup.com (Shawn Quinn)

Nested Class Summary
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 Summary
PlotBandLabel()
           
 
Method Summary
 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.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable
getOptions, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotBandLabel

public PlotBandLabel()
Method Detail

setAlign

public PlotBandLabel setAlign(PlotBandLabel.Align align)
Convenience method for setting the 'align' option for the label. Equivalent to:

     plotBandLabel.setOption("align", PlotBandLabel.Align.CENTER);
 
Horizontal alignment of the label. Can be one of "left", "center" or "right". Defaults to "center".

Parameters:
align - The horizontal alignment of the label.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setRotation

public PlotBandLabel setRotation(Number rotation)
Convenience method for setting the 'rotation' option for the label. Equivalent to:

     plotBandLabel.setOption("rotation", 90.0f);
 
Rotation of the text label in degrees. Defaults to 0 for horizontal plot lines and 90 for vertical lines.

Parameters:
rotation - Rotation of the text label in degrees.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setStyle

public PlotBandLabel setStyle(Style style)
Convenience method for setting the 'style' options of the labels. Equivalent to:

     plotBandLabel.setOption("/style/fontWeight", "bold");
     plotBandLabel.setOption("/style/fontFamily", "serif");
     etc.
 

Parameters:
style - CSS styles for the text labels.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setText

public PlotBandLabel setText(String text)
Convenience method for setting the 'text' option of the label. Equivalent to:

     plotBandLabel.setOption("text", "Hi Mom!");
 

Parameters:
text - The raw text to display as the label.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setTextAlign

public PlotBandLabel setTextAlign(PlotBandLabel.TextAlign textAlign)
Convenience method for setting the 'textAlign' option for the label. Equivalent to:

     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.

Parameters:
textAlign - The text alignment for the label.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setVerticalAlign

public PlotBandLabel setVerticalAlign(PlotBandLabel.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option for the label. Equivalent to:

     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".

Parameters:
verticalAlign - The vertical alignment of the label relative to the plot band.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setX

public PlotBandLabel setX(Number x)
Convenience method for setting the 'x' position option of the label. Equivalent to:

     plotBandLabel.setOption("x", 70);
 
Horizontal position relative the alignment. Default varies by orientation.

Parameters:
x - The horizontal position relative the alignment.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.

setY

public PlotBandLabel setY(Number y)
Convenience method for setting the 'y' position option of the label. Equivalent to:

     plotBandLabel.setOption("y", -20);
 
Vertical position of the text baseline relative to the alignment. Default varies by orientation.

Parameters:
y - The vertical position of the text baseline relative to the alignment.
Returns:
A reference to this PlotBandLabel instance for convenient method chaining.


Copyright © 2015. All Rights Reserved.