Class View

Direct Known Subclasses:
Layer

public class View extends VegaLite
Single view specification, which describes a view that uses a single mark type to visualize the data.
  • Constructor Details

    • View

      public View()
      Constructor.
    • View

      public View(String title)
      Constructor.
      Parameters:
      title - a descriptive title.
  • Method Details

    • width

      public View width(int width)
      Sets the width of a plot with a continuous x-field, or the fixed width of a plot a discrete x-field or no x-field.
    • height

      public View height(int height)
      Sets the height of a plot with a continuous y-field, or the fixed height of a plot a discrete y-field or no y-field.
    • width

      public View width(String width)
      To enable responsive sizing on width.
      Parameters:
      width - it should be set to "container".
    • height

      public View height(String height)
      To enable responsive sizing on height.
      Parameters:
      height - it should be set to "container".
    • widthStep

      public View widthStep(int step)
      For a discrete x-field, sets the width per discrete step.
    • heightStep

      public View heightStep(int step)
      For a discrete y-field, sets the height per discrete step.
    • mark

      public Mark mark(String type)
      Returns the mark definition object.
      Parameters:
      type - The mark type. This could a primitive mark type (one of "bar", "circle", "square", "tick", "line", "area", "point", "geoshape", "rule", and "text") or a composite mark type ("boxplot", "errorband", "errorbar").
      Returns:
      the mark definition object.
    • background

      public Background background()
      Returns the view background's fill and stroke object.
    • projection

      public Projection projection(String type)
      Returns the defining properties of geographic projection, which will be applied to shape path for "geoshape" marks and to latitude and "longitude" channels for other marks.
      Parameters:
      type - The cartographic projection to use.
    • encode

      public Field encode(String channel, String field)
      Returns the field object for encoding a channel.
      Parameters:
      channel - Vega-Lite supports the following groups of encoding channels: - Position Channels: x, y, x2, y2, xError, yError, xError2, yError2 - Position Offset Channels: xOffset, yOffset - Polar Position Channels: theta, theta2, radius, radius2 - Geographic Position Channels: longitude, latitude, longitude2, latitude2 - Mark Property Channels: angle, color (and fill / stroke), opacity, fillOpacity, strokeOpacity, shape, size, strokeDash, strokeWidth - Text and Tooltip Channels: text, tooltip - Hyperlink Channel: href - Description Channel: description - Level of Detail Channel: detail - Key Channel: key - Order Channel: order - Facet Channels: facet, row, column
      field - A string defining the name of the field from which to pull a data value. Dots (.) and brackets ([ and ]) can be used to access nested objects (e.g., "field": "foo.bar" and "field": "foo['bar']"). If field names contain dots or brackets but are not nested, you can use \\ to escape dots and brackets (e.g., "a\\.b" and "a\\[0\\]").
      Returns:
      the field object for encoding the channel.
    • encodeValue

      public View encodeValue(String channel, int value)
      Sets an encoded constant visual value.
      Parameters:
      channel - the encoding channel.
      value - the constant visual value.
      Returns:
      this object.
    • encodeValue

      public View encodeValue(String channel, double value)
      Sets an encoded constant visual value.
      Parameters:
      channel - the encoding channel.
      value - the constant visual value.
      Returns:
      this object.
    • encodeValue

      public View encodeValue(String channel, String value)
      Sets an encoded constant visual value.
      Parameters:
      channel - the encoding channel.
      value - the constant visual value.
      Returns:
      this object.
    • encodeDatum

      public View encodeDatum(String channel, int datum)
      Sets a constant data value encoded via a scale.
      Parameters:
      channel - the encoding channel.
      datum - the constant data value.
      Returns:
      this object.
    • encodeDatum

      public View encodeDatum(String channel, double datum)
      Sets a constant data value encoded via a scale.
      Parameters:
      channel - the encoding channel.
      datum - the constant data value.
      Returns:
      this object.
    • encodeDatum

      public View encodeDatum(String channel, String datum)
      Sets a constant data value encoded via a scale.
      Parameters:
      channel - the encoding channel.
      datum - the constant data value.
      Returns:
      this object.
    • usermeta

      public View usermeta(com.fasterxml.jackson.databind.JsonNode metadata)
      Description copied from class: VegaLite
      Optional metadata that will be passed to Vega. This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.
      Overrides:
      usermeta in class VegaLite
    • usermeta

      public View usermeta(Object metadata)
      Description copied from class: VegaLite
      Optional metadata that will be passed to Vega. This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.
      Overrides:
      usermeta in class VegaLite
    • background

      public View background(String color)
      Description copied from class: VegaLite
      Sets the background of the entire view with CSS color property.
      Overrides:
      background in class VegaLite
    • padding

      public View padding(int size)
      Description copied from class: VegaLite
      Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.
      Overrides:
      padding in class VegaLite
    • padding

      public View padding(int left, int top, int right, int bottom)
      Description copied from class: VegaLite
      Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.
      Overrides:
      padding in class VegaLite
    • autosize

      public View autosize()
      Description copied from class: VegaLite
      Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.
      Overrides:
      autosize in class VegaLite
    • autosize

      public View autosize(String type, boolean resize, String contains)
      Description copied from class: VegaLite
      Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.
      Overrides:
      autosize in class VegaLite
      Parameters:
      type - The sizing format type. One of "pad", "fit", "fit-x", "fit-y", or "none". See Vega-Lite documentation for descriptions of each.
      resize - A boolean flag indicating if autosize layout should be re-calculated on every view update.
      contains - Determines how size calculation should be performed, one of "content" or "padding". The default setting ("content") interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the "padding" setting includes the padding within the view size calculations, such that the width and height settings indicate the total intended size of the view.
    • name

      public View name(String name)
      Description copied from class: VegaLite
      Sets the name of the visualization for later reference.
      Overrides:
      name in class VegaLite
    • description

      public View description(String description)
      Description copied from class: VegaLite
      Sets the description of this mark for commenting purpose.
      Overrides:
      description in class VegaLite
    • title

      public View title(String title)
      Description copied from class: VegaLite
      Sets a descriptive title to a chart.
      Overrides:
      title in class VegaLite
      Parameters:
      title - a descriptive title.
      Returns:
      this object.