org.moxieapps.gwt.highcharts.client.labels
Class Labels<T extends Labels>

java.lang.Object
  extended by org.moxieapps.gwt.highcharts.client.Configurable<T>
      extended by org.moxieapps.gwt.highcharts.client.labels.Labels<T>
Direct Known Subclasses:
BaseDataLabels, StackLabels, XAxisLabels, YAxisLabels

public abstract class Labels<T extends Labels>
extends Configurable<T>

Represents the common base class for all label configuration option types, which allows for general options to be set via the inherited Configurable.setOption(String, Object) method. But also exposes type specific methods that the caller is encouraged to use instead, such as setAlign(org.moxieapps.gwt.highcharts.client.labels.Labels.Align), setColor(String), etc.

Note that this class is abstract and therefore can't be instantiated directly. Instead you should create an instance of more specific sub type, such as XAxisLabels, YAxisLabels, or DataLabels.

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

Nested Class Summary
static class Labels.Align
          An enumeration of supported label alignment types, which can be passed to methods like setAlign(org.moxieapps.gwt.highcharts.client.labels.Labels.Align) method.
static class Labels.VerticalAlign
           
 
Constructor Summary
Labels()
           
 
Method Summary
 T setAlign(Labels.Align align)
          Convenience method for setting the 'align' option for the labels.
 T setColor(String color)
          Convenience method for setting the 'color' option for the data labels.
 T setEnabled(boolean enabled)
          Convenience method for setting the 'enabled' option for the data labels.
 T setRotation(Number rotation)
          Convenience method for setting the 'rotation' option for the labels.
 T setStyle(Style style)
          Convenience method for setting the 'style' options of the labels.
 T setVerticalAlign(Labels.VerticalAlign verticalAlign)
          Convenience method for setting the 'verticalAlign' option for the labels.
 T setX(Number x)
          Convenience method for setting the 'x' position option of the label.
 T 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

Labels

public Labels()
Method Detail

setAlign

public T setAlign(Labels.Align align)
Convenience method for setting the 'align' option for the labels. Equivalent to:

     labels.setOption("align", Labels.Align.CENTER);
 
The alignment of the data label compared to the point. Can be one of "left", "center" or "right". Defaults to "center".

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

setColor

public T setColor(String color)
Convenience method for setting the 'color' option for the data labels. Equivalent to:

     labels.setOption("color", "#CC0000");
 
The text color for the data labels. Defaults to null.

Parameters:
color - The text color to use for the labels.
Returns:
A reference to this Labels instance for convenient method chaining.

setEnabled

public T setEnabled(boolean enabled)
Convenience method for setting the 'enabled' option for the data labels. Equivalent to:

     labels.setOption("enabled", true);
 
Enable or disable the data labels. Defaults to false.

Parameters:
enabled - Whether or not to enable or disable the data labels.
Returns:
A reference to this Labels instance for convenient method chaining.

setRotation

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

     labels.setOption("rotation", 90.0f);
 
Text rotation in degrees. Defaults to 0.

Parameters:
rotation - Text rotation in degrees.
Returns:
A reference to this Labels instance for convenient method chaining.

setStyle

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

     labels.setOption("/style/fontWeight", "bold");
     labels.setOption("/style/fontFamily", "serif");
     etc.
 
CSS styles for the labels. Defaults to:

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

setVerticalAlign

public T setVerticalAlign(Labels.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option for the labels. Equivalent to:

     labels.setOption("verticalAlign", Labels.VerticalAlign.TOP);
 
The vertical alignment of the data label compared to the point. Can be one of "top", "middle" or "bottom". Defaults to "center".

Parameters:
verticalAlign - The vertical alignment of the label compared to the point.
Returns:
A reference to this Labels instance for convenient method chaining.

setX

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

     labels.setOption("x", 70);
 
The x position offset of the label relative to the point. Defaults to 0 for series data labels, -8 y-axis labels, and 0 x-axis labels.

Parameters:
x - The x position of the title, relative to the chart's spacing.
Returns:
A reference to this Labels instance for convenient method chaining.

setY

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

     labels.setOption("y", -20);
 
The y position offset of the label relative to the point. Defaults to -6 for series data labels, 3 for y-axis labels, and 0 for x-axis labels.

Parameters:
y - The y position of the title, relative to the chart's spacing.
Returns:
A reference to this Labels instance for convenient method chaining.


Copyright © 2015. All Rights Reserved.