// Single View Specification{ "data": ... , "mark": "rect", "encoding": ... , ...}
Therect
mark represents an arbitrary rectangle.
// Single View Specification{ ... "mark": { "type": "rect", ... }, "encoding": ... , ...}
A rect mark definition can contain anystandard mark properties and the following special properties:
Property | Type | Description |
---|---|---|
width | Number |ExprRef | Width of the marks. |
height | Number |ExprRef | Height of the marks. |
align | String |ExprRef | The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of Note: Expression reference isnot supported for range marks. |
baseline | String |ExprRef | For text marks, the vertical text baseline. One of For range marks, the vertical alignment of the marks. One of Note: Expression reference isnot supported for range marks. |
cornerRadius | Number |ExprRef | The radius in pixels of rounded rectangles or arcs’ corners. Default value: |
binSpacing | Any |
Using therect
marks with discrete fields onx
andy
channels creates a heatmap.
We can similarly use rect with binned fields and discretized temporal fields.
Specifying bothx
andx2
and/ory
andy2
creates a rectangle that spans over certain x and/or y values.
For example, we can userect
to create an annotationlayer
that provides a shading between globalmin
andmax
values.
// Top-level View Specification{ ... "config": { "rect": ..., ... }}
Therect
property of the top-levelconfig
object sets the default properties for all rect marks. Ifmark property encoding channels are specified for marks, these config values will be overridden.
Besides standardrect mark properties (excepttype
,style
, andclip
), rect config can contain the following additional properties:
Property | Type | Description |
---|---|---|
continuousBandSize | Number | The default size of the bars on continuous scales. Default value: |
discreteBandSize | Number | RelativeBandSize | The default size of the bars with discrete dimensions. If unspecified, the default size is |
minBandSize | Number |ExprRef | The minimum band size for bar and rectangle marks.Default value: |