Class FacetField

java.lang.Object
smile.plot.vega.FacetField

public class FacetField extends Object
Facet field definition object.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toPrettyString

      public String toPrettyString()
      Returns the specification in pretty print.
      Returns:
      the specification in pretty print.
    • type

      public FacetField type(String type)
      Sets the field's type of measurement.
      Parameters:
      type - The encoded field's type of measurement ("quantitative", "temporal", "ordinal", or "nominal"). It can also be a "geojson" type for encoding ‘geoshape'.

      Data type describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.

      Data values for a temporal field can be either a date-time string (e.g., "2015-03-07 12:32:17", "17:01", "2015-03-16", "2015") or a timestamp number (e.g., 1552199579097).

      Returns:
      this object.
    • bin

      public FacetField bin(boolean flag)
      Turns on/off binning a quantitative field.
      Parameters:
      flag - If true, default binning parameters will be applied.
      Returns:
      this object.
    • bin

      public FacetField bin(String bin)
      Indicates that the data for x or y channel are binned before they are imported into Vega-Lite.
      Parameters:
      bin - it should be set to "binned".
      Returns:
      this object.
    • timeUnit

      public FacetField timeUnit(String timeUnit)
      Sets the time unit for a temporal field. Vega-Lite supports the following time units:

      "year" - Gregorian calendar years. "quarter" - Three-month intervals, starting in one of January, April, July, and October. "month" - Calendar months (January, February, etc.). "date" - Calendar day of the month (January 1, January 2, etc.). "week" - Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, etc. "day" - Day of the week (Sunday, Monday, etc.). "dayofyear" - Day of the year (1, 2, …, 365, etc.). "hours" - Hours of the day (12:00am, 1:00am, etc.). "minutes" - Minutes in an hour (12:00, 12:01, etc.). "seconds" - Seconds in a minute (12:00:00, 12:00:01, etc.). "milliseconds" - Milliseconds in a second.

      Parameters:
      timeUnit - Time unit.
      Returns:
      this object.
    • header

      public FacetField header(String title)
      Sets the header of facet.
      Parameters:
      title - the header text.
      Returns:
      this object.
    • align

      public FacetField align(String alignment)
      Sets the alignment to apply to row/column facet's subplot. For "none", a flow layout will be used, in which adjacent subviews are simply placed one after the other.

      For "each", subviews will be aligned into a clean grid structure, but each row or column may be of variable size.

      For "all", subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.

      Parameters:
      alignment - "all", "each", or "none".
      Returns:
      this object.
    • center

      public FacetField center(boolean flag)
      Sets if facet's subviews should be centered relative to their respective rows or columns.
      Parameters:
      flag - A flag indicating if facet's subviews should be centered relative to their respective rows or columns.
      Returns:
      this object.
    • spacing

      public FacetField spacing(double spacing)
      Sets the spacing in pixels between facet's sub-views.
      Parameters:
      spacing - the spacing in pixels between facet's sub-views.
      Returns:
      this object.
    • spacing

      public FacetField spacing(int columns)
      For the facet channel, sets the number of columns to include in the view composition layout.
      Parameters:
      columns - the number of columns to include in the view composition layout.
      Returns:
      this object.