Class Mark

java.lang.Object
smile.plot.vega.Mark

public class Mark extends Object
Mark definition object. Marks are the basic visual building block of a visualization. They provide basic shapes whose properties (such as position, size, and color) can be used to visually encode data, either from a data field, or a constant value.
  • Method Summary

    Modifier and Type
    Method
    Description
    aria(boolean aria)
    Sets the aria.
    blend(String mode)
    Sets the color blend mode for drawing an item on its current background.
    clip(boolean flag)
    Sets whether a mark be clipped to the enclosing group's width and height.
    color(String color)
    Sets the default color.
    cornerRadius(double radius)
    Sets the radius in pixels of rounded rectangles or arcs' corners.
    cornerRadiusBottomLeft(double radius)
    Sets the radius in pixels of rounded rectangles' bottom left corner.
    cornerRadiusBottomRight(double radius)
    Sets the radius in pixels of rounded rectangles' bottom right corner.
    cornerRadiusEnd(double radius)
    For vertical bars, sets the top-left and top-right corner radius.
    cornerRadiusTopLeft(double radius)
    Sets the radius in pixels of rounded rectangles' top left corner.
    cornerRadiusTopRight(double radius)
    Sets the radius in pixels of rounded rectangles' top right corner.
    description(String description)
    Sets the description.
    extent(String extent)
    Sets the extent of the band.
    fill(String color)
    Sets the default fill color.
    filled(boolean flag)
    Sets whether the mark's color should be used as fill color instead of stroke color.
    fillOpacity(double opacity)
    Sets the fill opacity.
    height(double height)
    Sets the height of the marks.
    innerRadius(double radius)
    Sets the secondary (inner) radius in pixels for arc mark.
    Sets the line interpolation method to use for line and area marks.
    invalid(String invalid)
    Sets how Vega-Lite should handle marks for invalid values (null and NaN).
    line(boolean flag)
    Sets whether the line mark is shown.
    opacity(double opacity)
    Sets the overall opacity.
    order(boolean flag)
    For line and trail marks, sets this order property false to make the lines use the original order in the data sources.
    orient(String orient)
    Sets the orientation of a non-stacked bar, tick, area, and line charts.
    outerRadius(double radius)
    Sets the primary (inner) radius in pixels for arc mark.
    padAngle(double angle)
    Setsthe angular padding applied to sides of the arc in radians.
    point(boolean flag)
    Sets whether overlaying points on top of line or area marks.
    radius(double radius)
    Sets the primary (outer) radius in pixels for arc mark, or polar coordinate radial offset of the text from the origin determined by the x and y properties for text marks.
    radius2(double radius)
    Sets the secondary (inner) radius in pixels for arc mark.
    radius2Offset(double offset)
    Sets the offset for radius2.
    radiusOffset(double offset)
    Sets the offset for radius.
    shape(String shape)
    Sets the shape of the point marks.
    size(int size)
    Sets the size of the point marks.
    stroke(String color)
    Sets the default stroke color.
    Sets the stroke cap for line ending style.
    strokeDash(double stroke, double space)
    Sets the alternating [stroke, space] lengths for dashed lines.
    strokeDashOffset(double offset)
    Sets the pixel offset at which to start drawing with the dash array.
    Sets the stroke line join method.
    strokeMiterLimit(double limit)
    Sets the miter limit at which to bevel a line join.
    strokeOpacity(double opacity)
    Sets the stroke opacity.
    strokeWidth(double width)
    Sets the stroke width of axis domain line.
    style(String... style)
    Sets the style.
    tension(double value)
    Depending on the interpolation type, sets the tension parameter (for line and area marks).
    theta(double angle)
    For arc marks, sets the arc length in radians if theta2 is not specified, otherwise the start arc angle.
    theta2(double angle)
    Sets the end angle of arc marks in radians.
    theta2Offset(double offset)
    Sets the offset for theta2.
    thetaOffset(double offset)
    Sets the offset for theta.
    tooltip(boolean flag)
    Turns on/off the tooltip.
    tooltip(String tooltip)
    Sets the tooltip text string to show upon mouse hover or which fields should the tooltip be derived from.
    Returns the specification in pretty print.
     
    width(double width)
    Sets the width of the marks.
    x(double value)
    Sets the X coordinates of the marks.
    x(String width)
    Sets the width of horizontal "bar" and "area" without specified x2 or width.
    x2(double value)
    Sets the X2 coordinates for ranged "area", "bar", "rect", and "rule".
    x2(String width)
    Sets the width.
    x2Offset(double offset)
    Sets the offset for x2-position.
    xOffset(double offset)
    Sets the offset for x-position.
    y(double value)
    Sets the Y coordinates of the marks.
    y(String height)
    Sets the height of horizontal "bar" and "area" without specified x2 or width.
    y2(double value)
    Sets the Y2 coordinates for ranged "area", "bar", "rect", and "rule".
    y2(String height)
    Sets the width.
    y2Offset(double offset)
    Sets the offset for y2-position.
    yOffset(double offset)
    Sets the offset for y-position.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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.
    • aria

      public Mark aria(boolean aria)
      Sets the aria.
      Parameters:
      aria - A boolean flag indicating if ARIA attributes should be included (SVG output only). If false, the "aria-hidden" attribute will be set on the output SVG element, removing the mark item from the ARIA accessibility tree.
      Returns:
      this object.
    • description

      public Mark description(String description)
      Sets the description.
      Parameters:
      description - A text description of the mark item for ARIA accessibility (SVG output only). If specified, this property determines the “aria-label” attribute.
      Returns:
      this object.
    • style

      public Mark style(String... style)
      Sets the style. Note: Any specified style will augment the default style.
      Parameters:
      style - A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the style configuration. If style is an array, later styles will override earlier styles. Any mark properties explicitly defined within the encoding will override a style default. The default value is the mark's name. For example, a bar mark will have style "bar" by default.
      Returns:
      this object.
    • tooltip

      public Mark tooltip(String tooltip)
      Sets the tooltip text string to show upon mouse hover or which fields should the tooltip be derived from.
      Parameters:
      tooltip - "encoding", "data", or tooltip text. If "encoding", then all fields from encoding will be used. If "data", then all fields that appear in the highlighted data point will be used.
      Returns:
      this object.
    • tooltip

      public Mark tooltip(boolean flag)
      Turns on/off the tooltip.
      Parameters:
      flag - If true, then all fields from encoding will be used. If false, then no tooltip will be used.
      Returns:
      this object.
    • clip

      public Mark clip(boolean flag)
      Sets whether a mark be clipped to the enclosing group's width and height.
      Parameters:
      flag - whether a mark be clipped to the enclosing group's width and height.
      Returns:
      this object.
    • invalid

      public Mark invalid(String invalid)
      Sets how Vega-Lite should handle marks for invalid values (null and NaN).
      Parameters:
      invalid - If set to "filter", all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). If null, all data items are included. In this case, invalid values will be interpreted as zeroes.
      Returns:
      this object.
    • order

      public Mark order(boolean flag)
      For line and trail marks, sets this order property false to make the lines use the original order in the data sources.
      Parameters:
      flag - if false, use the original order in the data sources.
      Returns:
      this object.
    • x

      public Mark x(double value)
      Sets the X coordinates of the marks.
      Parameters:
      value - the X coordinates.
      Returns:
      this object.
    • x

      public Mark x(String width)
      Sets the width of horizontal "bar" and "area" without specified x2 or width.
      Parameters:
      width - "width" for the width of the plot.
      Returns:
      this object.
    • x2

      public Mark x2(double value)
      Sets the X2 coordinates for ranged "area", "bar", "rect", and "rule".
      Parameters:
      value - the X2 coordinates.
      Returns:
      this object.
    • x2

      public Mark x2(String width)
      Sets the width.
      Parameters:
      width - "width" for the width of the plot.
      Returns:
      this object.
    • y

      public Mark y(double value)
      Sets the Y coordinates of the marks.
      Parameters:
      value - the Y coordinates.
      Returns:
      this object.
    • y

      public Mark y(String height)
      Sets the height of horizontal "bar" and "area" without specified x2 or width.
      Parameters:
      height - "height" for the height of the plot.
      Returns:
      this object.
    • y2

      public Mark y2(double value)
      Sets the Y2 coordinates for ranged "area", "bar", "rect", and "rule".
      Parameters:
      value - the Y2 coordinates.
      Returns:
      this object.
    • y2

      public Mark y2(String height)
      Sets the width.
      Parameters:
      height - "height" for the height of the plot.
      Returns:
      this object.
    • xOffset

      public Mark xOffset(double offset)
      Sets the offset for x-position.
      Parameters:
      offset - the offset for x-position.
      Returns:
      this object.
    • x2Offset

      public Mark x2Offset(double offset)
      Sets the offset for x2-position.
      Parameters:
      offset - the offset for x2-position.
      Returns:
      this object.
    • yOffset

      public Mark yOffset(double offset)
      Sets the offset for y-position.
      Parameters:
      offset - the offset for y-position.
      Returns:
      this object.
    • y2Offset

      public Mark y2Offset(double offset)
      Sets the offset for y2-position.
      Parameters:
      offset - the offset for y2-position.
      Returns:
      this object.
    • width

      public Mark width(double width)
      Sets the width of the marks.
      Parameters:
      width - the width of the marks.
      Returns:
      this object.
    • height

      public Mark height(double height)
      Sets the height of the marks.
      Parameters:
      height - the height of the marks.
      Returns:
      this object.
    • filled

      public Mark filled(boolean flag)
      Sets whether the mark's color should be used as fill color instead of stroke color.
      Parameters:
      flag - A flag indicating whether the mark's color should be used as fill color instead of stroke color.
      Returns:
      this object.
    • color

      public Mark color(String color)
      Sets the default color. The fill and stroke properties have higher precedence than color and will override color.
      Parameters:
      color - the default color.
      Returns:
      this object.
    • fill

      public Mark fill(String color)
      Sets the default fill color. This property has higher precedence than config.color.
      Parameters:
      color - the default fill color.
      Returns:
      this object.
    • stroke

      public Mark stroke(String color)
      Sets the default stroke color. This property has higher precedence than config.color.
      Parameters:
      color - the default stroke color.
      Returns:
      this object.
    • blend

      public Mark blend(String mode)
      Sets the color blend mode for drawing an item on its current background.
      Parameters:
      mode - Any valid CSS mix-blend-mode value can be used.
      Returns:
      this object.
    • opacity

      public Mark opacity(double opacity)
      Sets the overall opacity.
      Parameters:
      opacity - a value between [0, 1].
      Returns:
      this object.
    • fillOpacity

      public Mark fillOpacity(double opacity)
      Sets the fill opacity.
      Parameters:
      opacity - a value between [0, 1].
      Returns:
      this object.
    • strokeOpacity

      public Mark strokeOpacity(double opacity)
      Sets the stroke opacity.
      Parameters:
      opacity - a value between [0, 1].
      Returns:
      this object.
    • strokeCap

      public Mark strokeCap(String cap)
      Sets the stroke cap for line ending style.
      Parameters:
      cap - "butt", "round" or "square".
      Returns:
      this object.
    • strokeDash

      public Mark strokeDash(double stroke, double space)
      Sets the alternating [stroke, space] lengths for dashed lines.
      Parameters:
      stroke - the stroke length.
      space - the space length.
      Returns:
      this object.
    • strokeDashOffset

      public Mark strokeDashOffset(double offset)
      Sets the pixel offset at which to start drawing with the dash array.
      Parameters:
      offset - the pixel offset at which to start drawing with the dash array.
      Returns:
      this object.
    • strokeJoin

      public Mark strokeJoin(String join)
      Sets the stroke line join method.
      Parameters:
      join - "miter", "round" or "bevel".
      Returns:
      this object.
    • strokeMiterLimit

      public Mark strokeMiterLimit(double limit)
      Sets the miter limit at which to bevel a line join.
      Parameters:
      limit - the miter limit at which to bevel a line join.
      Returns:
      this object.
    • strokeWidth

      public Mark strokeWidth(double width)
      Sets the stroke width of axis domain line.
      Parameters:
      width - the stroke width of axis domain line.
      Returns:
      this object.
    • point

      public Mark point(boolean flag)
      Sets whether overlaying points on top of line or area marks.
      Parameters:
      flag - A flag indicating whether overlaying points on top of line or area marks.
      Returns:
      this object.
    • shape

      public Mark shape(String shape)
      Sets the shape of the point marks.
      Parameters:
      shape - "circle", "square", "cross", "diamond", "triangle-up", "triangle-down", "triangle-right", or "triangle-left".
      Returns:
      this object.
    • size

      public Mark size(int size)
      Sets the size of the point marks.
      Parameters:
      size - the pixel area of the marks.
      Returns:
      this object.
    • extent

      public Mark extent(String extent)
      Sets the extent of the band. Available options include: "ci" - Extend the band to the confidence interval of the mean. "stderr" - The size of band are set to the value of standard error, extending from the mean. "stdev" - The size of band are set to the value of standard deviation, extending from the mean. "iqr" - Extend the band to the q1 and q3.
      Parameters:
      extent - "ci", "stderr", "stdev", or "iqr".
      Returns:
      this object.
    • line

      public Mark line(boolean flag)
      Sets whether the line mark is shown.
      Parameters:
      flag - A flag indicating whether the line mark is shown.
      Returns:
      this object.
    • orient

      public Mark orient(String orient)
      Sets the orientation of a non-stacked bar, tick, area, and line charts.
      Parameters:
      orient - "horizontal" or "vertical".
      Returns:
      this object.
    • interpolate

      public Mark interpolate(String method)
      Sets the line interpolation method to use for line and area marks. Available options include: "linear" - piecewise linear segments, as in a polyline. "linear-closed" - close the linear segments to form a polygon. "step" - alternate between horizontal and vertical segments, as in a step function. "step-before" - alternate between vertical and horizontal segments, as in a step function. "step-after" - alternate between horizontal and vertical segments, as in a step function. "basis" - a B-spline, with control point duplication on the ends. "basis-open" - an open B-spline; may not intersect the start or end. "basis-closed" - a closed B-spline, as in a loop. "cardinal" - a Cardinal spline, with control point duplication on the ends. "cardinal-open" - an open Cardinal spline; may not intersect the start or end, but will intersect other control points. "cardinal-closed" - a closed Cardinal spline, as in a loop. "bundle" - equivalent to basis, except the tension parameter is used to straighten the spline. "monotone" - cubic interpolation that preserves monotonicity in y.
      Parameters:
      method - the line interpolation method.
      Returns:
      this object.
    • tension

      public Mark tension(double value)
      Depending on the interpolation type, sets the tension parameter (for line and area marks).
      Parameters:
      value - the tension value.
      Returns:
      this object.
    • radius

      public Mark radius(double radius)
      Sets the primary (outer) radius in pixels for arc mark, or polar coordinate radial offset of the text from the origin determined by the x and y properties for text marks.
      Parameters:
      radius - the radius in pixels.
      Returns:
      this object.
    • radius2

      public Mark radius2(double radius)
      Sets the secondary (inner) radius in pixels for arc mark.
      Parameters:
      radius - the radius in pixels.
      Returns:
      this object.
    • outerRadius

      public Mark outerRadius(double radius)
      Sets the primary (inner) radius in pixels for arc mark. outerRadius is an alias for radius.
      Parameters:
      radius - the radius in pixels.
      Returns:
      this object.
    • innerRadius

      public Mark innerRadius(double radius)
      Sets the secondary (inner) radius in pixels for arc mark. innerRadius is an alias for radius2.
      Parameters:
      radius - the radius in pixels.
      Returns:
      this object.
    • radiusOffset

      public Mark radiusOffset(double offset)
      Sets the offset for radius.
      Parameters:
      offset - the offset for radius.
      Returns:
      this object.
    • radius2Offset

      public Mark radius2Offset(double offset)
      Sets the offset for radius2.
      Parameters:
      offset - the offset for radius2.
      Returns:
      this object.
    • theta

      public Mark theta(double angle)
      For arc marks, sets the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or "north", increasing values proceed clockwise.)
      Parameters:
      angle - the arc length in radians.
      Returns:
      this object.
    • theta2

      public Mark theta2(double angle)
      Sets the end angle of arc marks in radians. A value of 0 indicates up or "north", increasing values proceed clockwise.
      Parameters:
      angle - the end angle in radians.
      Returns:
      this object.
    • thetaOffset

      public Mark thetaOffset(double offset)
      Sets the offset for theta.
      Parameters:
      offset - the offset for theta.
      Returns:
      this object.
    • theta2Offset

      public Mark theta2Offset(double offset)
      Sets the offset for theta2.
      Parameters:
      offset - the offset for theta2.
      Returns:
      this object.
    • padAngle

      public Mark padAngle(double angle)
      Setsthe angular padding applied to sides of the arc in radians.
      Parameters:
      angle - the angular padding applied to sides of the arc in radians.
      Returns:
      this object.
    • cornerRadius

      public Mark cornerRadius(double radius)
      Sets the radius in pixels of rounded rectangles or arcs' corners.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.
    • cornerRadiusEnd

      public Mark cornerRadiusEnd(double radius)
      For vertical bars, sets the top-left and top-right corner radius. For horizontal bars, sets the top-right and bottom-right corner radius.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.
    • cornerRadiusTopLeft

      public Mark cornerRadiusTopLeft(double radius)
      Sets the radius in pixels of rounded rectangles' top left corner.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.
    • cornerRadiusTopRight

      public Mark cornerRadiusTopRight(double radius)
      Sets the radius in pixels of rounded rectangles' top right corner.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.
    • cornerRadiusBottomLeft

      public Mark cornerRadiusBottomLeft(double radius)
      Sets the radius in pixels of rounded rectangles' bottom left corner.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.
    • cornerRadiusBottomRight

      public Mark cornerRadiusBottomRight(double radius)
      Sets the radius in pixels of rounded rectangles' bottom right corner.
      Parameters:
      radius - the corner radius in pixels.
      Returns:
      this object.