Package smile.plot.vega
Class Mark
java.lang.Object
smile.plot.vega.Mark
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 TypeMethodDescriptionaria
(boolean aria) Sets the aria.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.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.Sets the extent of the band.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.interpolate
(String method) Sets the line interpolation method to use for line and area marks.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.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.Sets the shape of the point marks.size
(int size) Sets the size of the point marks.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.strokeJoin
(String join) 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.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.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.toString()
width
(double width) Sets the width of the marks.x
(double value) Sets the X coordinates of the marks.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".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.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".Sets the width.y2Offset
(double offset) Sets the offset for y2-position.yOffset
(double offset) Sets the offset for y-position.
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
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
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
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
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
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
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
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
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
Sets the X coordinates of the marks.- Parameters:
value
- the X coordinates.- Returns:
- this object.
-
x
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
Sets the X2 coordinates for ranged "area", "bar", "rect", and "rule".- Parameters:
value
- the X2 coordinates.- Returns:
- this object.
-
x2
Sets the width.- Parameters:
width
- "width" for the width of the plot.- Returns:
- this object.
-
y
Sets the Y coordinates of the marks.- Parameters:
value
- the Y coordinates.- Returns:
- this object.
-
y
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
Sets the Y2 coordinates for ranged "area", "bar", "rect", and "rule".- Parameters:
value
- the Y2 coordinates.- Returns:
- this object.
-
y2
Sets the width.- Parameters:
height
- "height" for the height of the plot.- Returns:
- this object.
-
xOffset
Sets the offset for x-position.- Parameters:
offset
- the offset for x-position.- Returns:
- this object.
-
x2Offset
Sets the offset for x2-position.- Parameters:
offset
- the offset for x2-position.- Returns:
- this object.
-
yOffset
Sets the offset for y-position.- Parameters:
offset
- the offset for y-position.- Returns:
- this object.
-
y2Offset
Sets the offset for y2-position.- Parameters:
offset
- the offset for y2-position.- Returns:
- this object.
-
width
Sets the width of the marks.- Parameters:
width
- the width of the marks.- Returns:
- this object.
-
height
Sets the height of the marks.- Parameters:
height
- the height of the marks.- Returns:
- this object.
-
filled
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
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
Sets the default fill color. This property has higher precedence than config.color.- Parameters:
color
- the default fill color.- Returns:
- this object.
-
stroke
Sets the default stroke color. This property has higher precedence than config.color.- Parameters:
color
- the default stroke color.- Returns:
- this object.
-
blend
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
Sets the overall opacity.- Parameters:
opacity
- a value between [0, 1].- Returns:
- this object.
-
fillOpacity
Sets the fill opacity.- Parameters:
opacity
- a value between [0, 1].- Returns:
- this object.
-
strokeOpacity
Sets the stroke opacity.- Parameters:
opacity
- a value between [0, 1].- Returns:
- this object.
-
strokeCap
Sets the stroke cap for line ending style.- Parameters:
cap
- "butt", "round" or "square".- Returns:
- this object.
-
strokeDash
Sets the alternating [stroke, space] lengths for dashed lines.- Parameters:
stroke
- the stroke length.space
- the space length.- Returns:
- this object.
-
strokeDashOffset
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
Sets the stroke line join method.- Parameters:
join
- "miter", "round" or "bevel".- Returns:
- this object.
-
strokeMiterLimit
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
Sets the stroke width of axis domain line.- Parameters:
width
- the stroke width of axis domain line.- Returns:
- this object.
-
point
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
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
Sets the size of the point marks.- Parameters:
size
- the pixel area of the marks.- Returns:
- this object.
-
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
Sets whether the line mark is shown.- Parameters:
flag
- A flag indicating whether the line mark is shown.- Returns:
- this object.
-
orient
Sets the orientation of a non-stacked bar, tick, area, and line charts.- Parameters:
orient
- "horizontal" or "vertical".- Returns:
- this object.
-
interpolate
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
Depending on the interpolation type, sets the tension parameter (for line and area marks).- Parameters:
value
- the tension value.- Returns:
- this object.
-
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
Sets the secondary (inner) radius in pixels for arc mark.- Parameters:
radius
- the radius in pixels.- Returns:
- this object.
-
outerRadius
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
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
Sets the offset for radius.- Parameters:
offset
- the offset for radius.- Returns:
- this object.
-
radius2Offset
Sets the offset for radius2.- Parameters:
offset
- the offset for radius2.- Returns:
- this object.
-
theta
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
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
Sets the offset for theta.- Parameters:
offset
- the offset for theta.- Returns:
- this object.
-
theta2Offset
Sets the offset for theta2.- Parameters:
offset
- the offset for theta2.- Returns:
- this object.
-
padAngle
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
Sets the radius in pixels of rounded rectangles or arcs' corners.- Parameters:
radius
- the corner radius in pixels.- Returns:
- this object.
-
cornerRadiusEnd
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
Sets the radius in pixels of rounded rectangles' top left corner.- Parameters:
radius
- the corner radius in pixels.- Returns:
- this object.
-
cornerRadiusTopRight
Sets the radius in pixels of rounded rectangles' top right corner.- Parameters:
radius
- the corner radius in pixels.- Returns:
- this object.
-
cornerRadiusBottomLeft
Sets the radius in pixels of rounded rectangles' bottom left corner.- Parameters:
radius
- the corner radius in pixels.- Returns:
- this object.
-
cornerRadiusBottomRight
Sets the radius in pixels of rounded rectangles' bottom right corner.- Parameters:
radius
- the corner radius in pixels.- Returns:
- this object.
-