Class BinParams

java.lang.Object
smile.plot.vega.BinParams

public class BinParams extends Object
To test a data point in a filter transform or a test property in conditional encoding, a predicate definition of the following forms must be specified:

- a Vega expression string, where datum can be used to refer to the current data object. For example, datum.b2 > 60 would test if the value in the field b2 for each data point is over 60.

- one of the field predicates: equal, lt, lte, gt, gte, range, oneOf, or valid.

- a parameter predicate, which defines the names of a selection that the data point should belong to (or a logical composition of selections).

- a logical composition of (1), (2), or (3).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    anchor(double value)
    Sets the value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.
    base(int base)
    Sets the number base to use for automatic bin determination (default is base 10).
    divide(int... factors)
    Sets the scale factors indicating allowable subdivisions.
    extent(double min, double max)
    Sets the range of desired bin values
    maxBins(int bins)
    Sets the maximum number of bins.
    minStep(double size)
    Sets the minimum allowable step size (particularly useful for integer values).
    nice(int flag)
    If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.
    step(double size)
    Sets the exact step size between bins.
    steps(double... steps)
    Sets an array of allowable step sizes to choose from.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BinParams

      public BinParams()
      Constructor.
  • Method Details

    • anchor

      public BinParams anchor(double value)
      Sets the value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.
      Parameters:
      value - the anchor value.
      Returns:
      this object.
    • base

      public BinParams base(int base)
      Sets the number base to use for automatic bin determination (default is base 10).
      Parameters:
      base - the base number.
      Returns:
      this object.
    • divide

      public BinParams divide(int... factors)
      Sets the scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.
      Parameters:
      factors - the scale factors
      Returns:
      this object.
    • extent

      public BinParams extent(double min, double max)
      Sets the range of desired bin values
      Parameters:
      min - the lower bound of desired bin values.
      max - the upper bound of desired bin values.
      Returns:
      this object.
    • maxBins

      public BinParams maxBins(int bins)
      Sets the maximum number of bins.
      Parameters:
      bins - the maximum number of bins.
      Returns:
      this object.
    • minStep

      public BinParams minStep(double size)
      Sets the minimum allowable step size (particularly useful for integer values).
      Parameters:
      size - the minimum allowable step size.
      Returns:
      this object.
    • step

      public BinParams step(double size)
      Sets the exact step size between bins.
      Parameters:
      size - the exact step size between bins.
      Returns:
      this object.
    • steps

      public BinParams steps(double... steps)
      Sets an array of allowable step sizes to choose from.
      Parameters:
      steps - an array of allowable step sizes to choose from.
      Returns:
      this object.
    • nice

      public BinParams nice(int flag)
      If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.
      Parameters:
      flag - If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.
      Returns:
      this object.