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

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

public class PlotLineLabel
extends Configurable<PlotLineLabel>

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

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

Nested Class Summary
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 Summary
PlotLineLabel()
           
 
Method Summary
 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.
 
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

PlotLineLabel

public PlotLineLabel()
Method Detail

setAlign

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

     plotLineLabel.setOption("align", PlotLineLabel.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 PlotLineLabel instance for convenient method chaining.

setRotation

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

     plotLineLabel.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 PlotLineLabel instance for convenient method chaining.

setStyle

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

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

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

setText

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

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

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

setTextAlign

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

     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.

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

setVerticalAlign

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

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

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

setX

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

     plotLineLabel.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 PlotLineLabel instance for convenient method chaining.

setY

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

     plotLineLabel.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 PlotLineLabel instance for convenient method chaining.


Copyright © 2015. All Rights Reserved.