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

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

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

A common base class for both DataLabels and ProportionalDataLabels to prevent code duplication while still maintaining a cleaner way for the user to utilize the method chaining with the generics in place. You should not use this class directly, but instead use one of the base classes.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.moxieapps.gwt.highcharts.client.labels.Labels
Labels.Align, Labels.VerticalAlign
 
Constructor Summary
BaseDataLabels()
           
 
Method Summary
 DataLabelsFormatter getFormatter()
          Returns the custom data labels formatter that has been applied to the labels, or null if the built-in generic formatter is being used instead.
 T setBackgroundColor(String backgroundColor)
          Convenience method for setting the 'backgroundColor' option for the data labels.
 T setBorderColor(String borderColor)
          Convenience method for setting the 'borderColor' option for the data labels.
 T setBorderRadius(Number borderRadius)
          Convenience method for setting the 'borderRadius' option for the data labels.
 T setBorderWidth(Number borderWidth)
          Convenience method for setting the 'borderWidth' option for the data labels.
 T setFormat(String format)
          Convenience method for setting the 'format' option for a dataLabel.
 T setFormatter(DataLabelsFormatter dataLabelsFormatter)
          Sets a custom formatter for the labels that can be used to control how the text of the data labels will be displayed.
 T setPadding(Number padding)
          Convenience method for setting the 'padding' option for the data labels.
 T setShadow(boolean shadow)
          Convenience method for setting the 'shadow' option for the data labels.
 T setUseHTML(Boolean useHTML)
          Convenience method for setting the 'useHTML' option for the data labels.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.labels.Labels
setAlign, setColor, setEnabled, setRotation, setStyle, setVerticalAlign, setX, setY
 
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

BaseDataLabels

public BaseDataLabels()
Method Detail

setBackgroundColor

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

     labels.setOption("backgroundColor", "#CC0000");
 
The background color or gradient for the data label. Defaults to undefined.

Parameters:
backgroundColor - The background color or gradient for the data label.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setBorderColor

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

     labels.setOption("borderColor", "#CC0000");
 
The border color for the data label. Defaults to undefined.

Parameters:
borderColor - The border color for the data label.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setBorderRadius

public T setBorderRadius(Number borderRadius)
Convenience method for setting the 'borderRadius' option for the data labels. Equivalent to:

     labels.setOption("borderRadius", 3);
 
The border radius in pixels for the data label. Defaults to 0.

Parameters:
borderRadius - The border radius in pixels for the data label.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setBorderWidth

public T setBorderWidth(Number borderWidth)
Convenience method for setting the 'borderWidth' option for the data labels. Equivalent to:

     labels.setOption("borderWidth", 3);
 
The border width in pixels for the data label. Defaults to 0.

Parameters:
borderWidth - The border width in pixels for the data label.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setPadding

public T setPadding(Number padding)
Convenience method for setting the 'padding' option for the data labels. Equivalent to:

     labels.setOption("padding", 3);
 
When either the borderWidth or the backgroundColor is set, this is the padding within the box. Defaults to 2.

Parameters:
padding - The padding within the box (only visible when 'borderWidth' is non-zero).
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setShadow

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

     labels.setOption("shadow", true);
 
The shadow of the box. Works best with borderWidth or backgroundColor Defaults to false.

Parameters:
shadow - 'true' to disable a shadow around the box.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.3.0

setUseHTML

public T setUseHTML(Boolean useHTML)
Convenience method for setting the 'useHTML' option for the data labels. Equivalent to:

     labels.setOption("useHTML", false);
 
Whether to use HTML to render the data label text. Using HTML allows for advanced formatting, images and reliable bi-directional text rendering. Note that exported images won't respect the HTML, and that HTML won't respect Z-index settings.

Parameters:
useHTML - 'true' to use HTML to render label texts.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.

setFormat

public T setFormat(String format)
Convenience method for setting the 'format' option for a dataLabel. Equivalent to:

     dataLabel.setOption("format", "{y} mm");
 
A format string for the data label. Available variables are the same as for formatter. Defaults to {y}.

Parameters:
format - A format string used to set the format for s series on a chart.
Returns:
A reference to this BaseDataLabels instance for convenient method chaining.
Since:
1.6.0

setFormatter

public T setFormatter(DataLabelsFormatter dataLabelsFormatter)
Sets a custom formatter for the labels that can be used to control how the text of the data labels will be displayed. See the DataLabelsFormatter interface, and in particular the DataLabelsFormatter.format(DataLabelsData) method for more details on the capabilities available to custom formatters.

Parameters:
dataLabelsFormatter - The custom formatter to use for the labels (if not given a built-in generic formatter is used which simply returns the Y value of the point).
Returns:
A reference to this DataLabels instance for convenient method chaining.

getFormatter

public DataLabelsFormatter getFormatter()
Returns the custom data labels formatter that has been applied to the labels, or null if the built-in generic formatter is being used instead.

Returns:
The custom data labels formatter that has been applied, or null if it has not been set.


Copyright © 2015. All Rights Reserved.