org.moxieapps.gwt.highcharts.client.plotOptions
Class DataGrouping

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

public class DataGrouping
extends Configurable<DataGrouping>

A configurable class to set the options for the data grouping of the plot. Sample usage: chart.setPlotOptions( new plotOptions() .setDataGrouping( .newDataGrouping() .setEnabled(true) .setGroupPixelWidth(10) ) );

Since:
1.6.0
Author:
cskowron@moxiegroup.com (Cory Skowronek)

Nested Class Summary
static class DataGrouping.Approximation
           
static class DataGrouping.Unit
          Basic class to support DataGrouping.
 
Constructor Summary
DataGrouping()
           
 
Method Summary
 DataGrouping setApproximation(DataGrouping.Approximation approximation)
          Convenience method for setting the "approximation" option for the data grouping of the plot.
 DataGrouping setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
          Convenience method for setting the 'dateTimeLabelFormats' options of the dataGrouping.
 DataGrouping setEnabled(boolean enabled)
          Convenience method for setting the "enabled" option for the data grouping of the plot.
 DataGrouping setForced(boolean forced)
          Convenience method for setting the "forced" option for the data grouping of the plot.
 DataGrouping setGroupPixelWidth(Number groupPixelWidth)
          Convenience method for setting the "groupPixelWidth" option for the data grouping of the plot.
 DataGrouping setSmoothed(boolean smoothed)
          Convenience method for setting the "smoothed" option for the data grouping of the plot.
 DataGrouping setUnits(DataGrouping.Unit... units)
          Convenience method for setting the "units" option for the data grouping of the plot.
 
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

DataGrouping

public DataGrouping()
Method Detail

setApproximation

public DataGrouping setApproximation(DataGrouping.Approximation approximation)
Convenience method for setting the "approximation" option for the data grouping of the plot. Equivalent to:

     dataGrouping.setOption("approximation", "high");
 
The method of approximation inside a group. When for example 30 days are grouped into one month, this determines what value should represent the group. Possible values are "average", "open", "high", "low", "close" and "sum". For OHLC and candlestick series the approximation is "ohlc" by default, which finds the open, high, low and close values within all the grouped data. For ranges, the approximation is "range", which finds the low and high values.

Defaults to average for line-type series, sum for columns, range for range series and ohlc for OHLC and candlestick.

Parameters:
approximation - The approximation type to use for the grouping.
Returns:
A reference to this DataGrouping for convenient method chaining.

setDateTimeLabelFormats

public DataGrouping setDateTimeLabelFormats(DateTimeLabelFormats dateTimeLabelFormats)
Convenience method for setting the 'dateTimeLabelFormats' options of the dataGrouping. Equivalent to code like:

     dataGrouping.setOption("/dateTimeLabelFormats/second", "%H:%M:%S");
     dataGrouping.setOption("/dateTimeLabelFormats/minute", "%H:%M");
 
For each of these array definitions, the first item is the format used when the active time span is one unit. For instance, if the current data applies to one week, the first item of the week array is used. The second and third items are used when the active time span is more than two units. For instance, if the current data applies to two weeks, the second and third item of the week array are used, and applied to the start and end date of the time span. Defaults to: Example usage:
   axis.setDateTimeLabelFormats(
     new DateTimeLabelFormats()
       .setHour("%A, %b %e, %H:%M", "%A, %b %e, %H:%M", "-%H:%M")
       .setMinute("%A, %b %e, %H:%M", "%A, %b %e, %H:%M", "-%H:%M")
   );
 
Note that for the DataGrouping instance of DateTimeLabelFormats, one should use the setter methods which take multiple strings as a parameter, and not the ones with a single string parameter.

Parameters:
dateTimeLabelFormats - The formats to use for time series information on this axis.
Returns:
A reference to this DataGrouping instance for convenient method chaining.
See Also:
DateTimeLabelFormats

setEnabled

public DataGrouping setEnabled(boolean enabled)
Convenience method for setting the "enabled" option for the data grouping of the plot. Equivalent to:

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

Parameters:
enabled - Whether to enable data grouping.
Returns:
A reference to this DataGrouping for convenient method chaining.

setForced

public DataGrouping setForced(boolean forced)
Convenience method for setting the "forced" option for the data grouping of the plot. Equivalent to:

     dataGrouping.setOption("forced", true);
 
When data grouping is forced, it runs no matter how small the intervals are. This can be handy for example, when the sum should be calculated for values appearing at random times within each hour. Defaults to false.

Parameters:
forced - Whether to force data grouping.
Returns:
A reference to this DataGrouping for convenient method chaining.

setGroupPixelWidth

public DataGrouping setGroupPixelWidth(Number groupPixelWidth)
Convenience method for setting the "groupPixelWidth" option for the data grouping of the plot. Equivalent to:

     dataGrouping.setOption("groupPixelWidth", 10);
 
The approximate pixel width of each group. If for example a series with 30 points is displayed over a 600 pixel wide plot area, no grouping is performed. If however the series contains so many points that the spacing is less than the groupPixelWidth, Highcharts will try to group it into appropriate groups so that each is more or less two pixels wide. If multiple series with different group pixel widths are drawn on the same x axis, all series will take the greatest width. For example, line series have 2px default group width, while column series have 10px. If combined, both the line and the column will have 10px by default. Defaults to 2.

Parameters:
groupPixelWidth - The width of area in which to group points.
Returns:
A reference to this DataGrouping for convenient method chaining.

setSmoothed

public DataGrouping setSmoothed(boolean smoothed)
Convenience method for setting the "smoothed" option for the data grouping of the plot. Equivalent to:

     dataGrouping.setOption("smoothed", true);
 
Normally, a group is indexed by the start of that group, so for example when 30 daily values are grouped into one month, that month's x value will be the 1st of the month. This apparently shifts the data to the left. When the smoothed option is true, this is compensated for. The data is shifted to the middle of the group, and min and max values are preserved. Internally, this is used in the Navigator series. Defaults to false. Defaults to false.

Parameters:
smoothed - Whether to smooth the data when it is shifted due to grouping.
Returns:
A reference to this DataGrouping for convenient method chaining.

setUnits

public DataGrouping setUnits(DataGrouping.Unit... units)
Convenience method for setting the "units" option for the data grouping of the plot. Sample usage:

      chart.setDataGrouping(
          new DataGrouping()
              .setUnits(
                  new Unit("minute", {1, 2, 5, 10, 15, 30}),
                  new Unit("hour", {1, 2, 3, 4, 6, 8})
              )
      );

 
An array determining what time intervals the data is allowed to be grouped to. Each array item is an array where the first value is the time unit and the second value another array of allowed multiples.

Defaults to:

 units: [
    ['millisecond', // unit name
     [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples
 ], ['second',
     [1, 2, 5, 10, 15, 30]
 ], ['minute',
     [1, 2, 5, 10, 15, 30]
 ], ['hour',
     [1, 2, 3, 4, 6, 8, 12]
 ], ['day',
     [1]
 ], ['week',
     [1]
 ], ['month',
     [1, 3, 6]
 ], ['year',
     null
 ]]
 
* @param units

Returns:
A reference to this DataGrouping for convenient method chaining.


Copyright © 2015. All Rights Reserved.