org.moxieapps.gwt.highcharts.client
Class RangeSelector

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

public class RangeSelector
extends Configurable<RangeSelector>

The range selector is a tool for selecting ranges to display within a StockChart. It provides buttons to select preconfigured ranges in the chart, like 1 day, 1 week, 1 month, etc. It also provides input boxes where min and max dates can be manually input. Basic usage is as follows:


 stockChart.setRangeSelector(new RangeSelector()
    .setButtons(
       new RangeSelector.Button()
          .setButtonType(RangeSelector.ButtonType.DAY)
          .setCount(1)
          .setText("1d"),
       new RangeSelector.Button()
          .setButtonType(RangeSelector.ButtonType.WEEK)
          .setCount(2)
          .setText("2w"),
       new RangeSelector.Button()
          .setButtonType(RangeSelector.ButtonType.MONTH)
          .setCount(3)
          .setText("2m")
    )
    .setSelected(1)
    .setButtonSpacing(10));
 

Since:
1.5.0
Author:
myersj@gmail.com (Jeff Myers)

Nested Class Summary
static class RangeSelector.Align
          An enumeration of supported range selector horizontal alignment types, which can be passed to methods like setInputPositionAlign(org.moxieapps.gwt.highcharts.client.RangeSelector.Align) method.
static class RangeSelector.Button
          Manages the options for configuring the buttons to show within the RangeSelector of a StockChart.
static class RangeSelector.ButtonType
          An enumeration of supported range selector button types, which can be used with the RangeSelector.Button.setType(RangeSelector.ButtonType) method.
static class RangeSelector.VerticalAlign
          An enumeration of supported range selector vertical alignment types, which can be passed to methods like Credits.setVerticalAlign(Credits.VerticalAlign) method.
 
Constructor Summary
RangeSelector()
           
 
Method Summary
 RangeSelector setButtons(RangeSelector.Button... buttons)
          Configure the buttons to show in the range selector.
 RangeSelector setButtonSpacing(Number buttonSpacing)
          Set the space in pixels between the buttons in the range selector.
 RangeSelector setEnabled(boolean enabled)
          Enable or disable the range selector.
 RangeSelector setInputDateFormat(String inputDateFormat)
          The date format in the input boxes when not selected for editing.
 RangeSelector setInputEditDateFormat(String inputEditDateFormat)
          The date format in the input boxes when they are selected for editing.
 RangeSelector setInputEnabled(boolean inputEnabled)
          Enable or disable the date input boxes.
 RangeSelector setInputPositionAlign(RangeSelector.Align align)
          Convenience method for setting the 'inputPosition' option for the rangeSelector.
 RangeSelector setInputPositionVerticalAlign(RangeSelector.VerticalAlign verticalAlign)
          Convenience method for setting the 'inputPosition' option for the rangeSelector.
 RangeSelector setInputPositionX(Number x)
          Convenience method for setting the 'inputPosition' option for the rangeSelector.
 RangeSelector setInputPositionY(Number y)
          Convenience method for setting the 'inputPosition' option for the rangeSelector.
 RangeSelector setInputStyle(Style inputStyle)
          CSS for the HTML inputs in the range selector.
 RangeSelector setLabelStyle(Style labelStyle)
          CSS styles for the labels - the Zoom, From and To texts.
 RangeSelector setSelected(Number selected)
          Set the index of the button to appear pre-selected.
 
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

RangeSelector

public RangeSelector()
Method Detail

setButtonSpacing

public RangeSelector setButtonSpacing(Number buttonSpacing)
Set the space in pixels between the buttons in the range selector. Defaults to 0.

Parameters:
buttonSpacing - the pixel space between the buttons
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setButtons

public RangeSelector setButtons(RangeSelector.Button... buttons)
Configure the buttons to show in the range selector. See RangeSelector.Button for button configuration options.

Parameters:
buttons - the buttons to display in the range selector.
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setEnabled

public RangeSelector setEnabled(boolean enabled)
Enable or disable the range selector. Defaults to true.

Parameters:
enabled - true to enable the range selector, false to disable.
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setInputDateFormat

public RangeSelector setInputDateFormat(String inputDateFormat)
The date format in the input boxes when not selected for editing. Defaults to "%b %e, %Y".

Parameters:
inputDateFormat - the date format in the input boxes when not selected for editing.
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setInputEditDateFormat

public RangeSelector setInputEditDateFormat(String inputEditDateFormat)
The date format in the input boxes when they are selected for editing. This must be a format that is recognized by JavaScript Date.parse. Defaults to "%Y-%m-%d".

Parameters:
inputEditDateFormat - The date format in the input boxes when they are selected for editing.
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setInputEnabled

public RangeSelector setInputEnabled(boolean inputEnabled)
Enable or disable the date input boxes.

Parameters:
inputEnabled - true to enable the date input boxes, false to disable.
Returns:
A reference to this RangeSelector instance for convenient method chaining.

setInputPositionAlign

public RangeSelector setInputPositionAlign(RangeSelector.Align align)
Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:

     stockChart.setOption("/inputPosition/VerticalAlign", center);
 
Sample usage:

     stockChart.setRangeSelector(
         new RangeSelector()
              .setInputPositionAlign(Align.LEFT)
     );
 
Can be one of either 'left, 'center', or right'

Parameters:
align - The horizontal alignment for the input box.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setInputPositionVerticalAlign

public RangeSelector setInputPositionVerticalAlign(RangeSelector.VerticalAlign verticalAlign)
Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:

     stockChart.setOption("/inputPosition/verticalAlign", top);
 
Sample usage:

     stockChart.setRangeSelector(
         new RangeSelector()
              .setInputPositionAlign(VerticalAlign.TOP)
     );
 
Can be one of either 'top, 'middle', or 'bottom'

Parameters:
verticalAlign - The vertical position for the input box.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setInputPositionX

public RangeSelector setInputPositionX(Number x)
Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:

     stockChart.setOption("/inputPosition/x", 15);
 
Sample usage:

     stockChart.setRangeSelector(
         new RangeSelector()
              .setInputPositionX(15)
     );
 

Parameters:
x - the x offset for the input box.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setInputPositionY

public RangeSelector setInputPositionY(Number y)
Convenience method for setting the 'inputPosition' option for the rangeSelector. Equivalent to:

     stockChart.setOption("/inputPosition/y", 10);
 
Sample usage:

     stockChart.setRangeSelector(
         new RangeSelector()
              .setInputPositionY(10)
     );
 

Parameters:
y - The y offset for the input box.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setInputStyle

public RangeSelector setInputStyle(Style inputStyle)
CSS for the HTML inputs in the range selector.

Parameters:
inputStyle - The CSS style object containing the style for the range selector inputs.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setLabelStyle

public RangeSelector setLabelStyle(Style labelStyle)
CSS styles for the labels - the Zoom, From and To texts.

Parameters:
labelStyle - The CSS style object containing the style for the range selector label.
Returns:
A reference to this RangeSelector instance for convenient method chaining.
Since:
1.6.0

setSelected

public RangeSelector setSelected(Number selected)
Set the index of the button to appear pre-selected. Defaults to null.

Parameters:
selected - the index of the button to appear pre-selected.
Returns:
A reference to this RangeSelector instance for convenient method chaining.


Copyright © 2015. All Rights Reserved.