org.moxieapps.gwt.highcharts.client
Class ChartTitle

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

public class ChartTitle
extends Configurable<ChartTitle>

A configurable class that can be used to represent custom title options for the chart, which can then be set the chart (via the BaseChart.setChartTitle(ChartTitle) method.) Example usage:

   chart.setChartTitle(
     new ChartTitle()
       .setText("Sales by Month")
       .setAlign(ChartTitle.Align.MIDDLE)
   );
 

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

Nested Class Summary
static class ChartTitle.Align
          An enumeration of supported chart title horizontal alignment types, which can be passed to methods like setAlign(ChartTitle.Align).
static class ChartTitle.VerticalAlign
          An enumeration of supported chart title vertical alignment types, which can be passed to methods like setVerticalAlign(ChartTitle.VerticalAlign).
 
Constructor Summary
ChartTitle()
           
 
Method Summary
 ChartTitle setAlign(ChartTitle.Align align)
          Convenience method for setting the 'align' option of the title.
 ChartTitle setFloating(boolean floating)
          Convenience method for setting the 'floating' option of the title.
 ChartTitle setMargin(Number margin)
          Convenience method for setting the 'margin' option of the title.
 ChartTitle setStyle(Style style)
          Convenience method for setting the 'style' options of the title.
 ChartTitle setText(String text)
          Convenience method for setting the 'text' option of the title.
 ChartTitle setVerticalAlign(ChartTitle.VerticalAlign verticalAlign)
          Convenience method for setting the 'verticalAlign' option of the title.
 ChartTitle setX(Number x)
          Convenience method for setting the 'x' position option of the title.
 ChartTitle setY(Number y)
          Convenience method for setting the 'y' position option of the title.
 
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

ChartTitle

public ChartTitle()
Method Detail

setAlign

public ChartTitle setAlign(ChartTitle.Align align)
Convenience method for setting the 'align' option of the title. Equivalent to:

     chartTitle.setOption("align", ChartTitle.Align.LEFT);
 
The horizontal alignment of the title. Can be one of "left", "center" and "right". Defaults to ChartTitle.Align.CENTER.

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

setFloating

public ChartTitle setFloating(boolean floating)
Convenience method for setting the 'floating' option of the title. Equivalent to:

     chartTitle.setOption("floating", true);
 
When the title is floating, the plot area will not move to make space for it. Defaults to false.

Parameters:
floating - 'true' to float the title above the plot area, or 'false' (the default) to make space for it.
Returns:
A reference to this ChartTitle instance for convenient method chaining.

setMargin

public ChartTitle setMargin(Number margin)
Convenience method for setting the 'margin' option of the title. Equivalent to:

     chartTitle.setOption("margin", 60);
 
The margin between the title and the plot area, or if a subtitle is present, the margin between the subtitle and the plot area. Defaults to 15.

Parameters:
margin - The margin between the title and the plot area, or if a subtitle is present, the margin between the subtitle and the plot area.
Returns:
A reference to this ChartTitle instance for convenient method chaining.

setStyle

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

     chartTitle.setOption("/style/fontWeight", "bold");
     chartTitle.setOption("/style/fontFamily", "serif");
     etc.
 
CSS styles for the title. Use this for font styling, but use setAlign(org.moxieapps.gwt.highcharts.client.ChartTitle.Align), setX(Number), and setY(Number) for text alignment. Defaults to:

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

setText

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

     chartTitle.setOption("text", "Sales by Month");
 
The actual text of the axis title. It can contain basic HTML text markup like <b>, <i> and spans with style. Defaults to null.

Note to disable an axis title from being displayed completely, simply set the text to "null". (This can also be accomplished more simply by just setting the title text to null directly on the axis via the Axis.setAxisTitleText(String) method.)

Parameters:
text - The actual text of the axis title.
Returns:
A reference to this ChartTitle instance for convenient method chaining.

setVerticalAlign

public ChartTitle setVerticalAlign(ChartTitle.VerticalAlign verticalAlign)
Convenience method for setting the 'verticalAlign' option of the title. Equivalent to:

     chartTitle.setOption("verticalAlign", ChartTitle.VerticalAlign.BOTTOM);
 
The vertical alignment of the title. Can be one of "top", "middle" and "bottom". Defaults to "top". Defaults to ChartTitle.VerticalAlign.TOP.

Parameters:
verticalAlign - The vertical alignment of the title.
Returns:
A reference to this ChartTitle instance for convenient method chaining.

setX

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

     chartTitle.setOption("x", 70);
 
The x position of the title relative to the alignment within the spacing set on the chart controlled via BaseChart.setSpacingLeft(Number) and BaseChart.setSpacingRight(Number). Defaults to 0.

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

setY

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

     chartTitle.setOption("y", -20);
 
The y position of the title relative to the alignment within the spacing set on the chart controlled via BaseChart.setSpacingTop(Number) and BaseChart.setSpacingBottom(Number). Defaults to 25.

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


Copyright © 2015. All Rights Reserved.