// Single View Specification{ "data": ... , "mark": "area", "encoding": ... , ...}
area
represent multiple data element as a single area shape. Area marks are often used to show change over time, using either a single area or stacked areas.
// Single View Specification{ ... "mark": { "type": "area", ... }, "encoding": ... , ...}
An area mark definition can contain anystandard mark properties and the following line interpolation as well as line and point overlay properties:
Property | Type | Description |
---|---|---|
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. |
orient | String | The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.
|
interpolate | String |ExprRef | The line interpolation method to use for line and area marks. One of the following:
|
tension | Number |ExprRef | Depending on the interpolation type, sets the tension parameter (for line and area marks). |
line | Boolean | Object | A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.
Default value: |
point | Boolean | Object | String | A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.
Default value: |
Usingarea
mark with one temporal or ordinal field (typically onx
) and one quantitative field (typically ony
) produces an area chart. For example, the following area chart shows a number of unemployment people in the US over time.
By setting theline
andpoint
properties of the mark definition totrue
or an object defining a property of the overlaying point marks, we can overlay line and point markers on top of area.
Instead of using a single color as the fill color of the area, we can set it to agradient. In this example, we are also customizing the overlay.
Adding a color field to area chart creates stacked area chart by default. For example, here we split the area chart by industry.
You can also create a normalized stacked area chart by setting"stack"
to"normalize"
in the encoding channel. Here we can easily see the percentage of unemployment across industries.
We can also shift the stacked area chart’s baseline to center and produces astreamgraph by setting"stack"
to"center"
in the encoding channel.
Specifyingx2
ory2
for the quantitative axis of area marks produce ranged areas. For example, we can use ranged area with theci0
andci0
aggregation operators to highlight 95% confidence interval of a line chart that shows mean values over time.
// Top-level View Specification{ ... "config": { "area": ..., ... }}
Thearea
property of the top-levelconfig
object sets the default properties for all area marks. Ifmark property encoding channels are specified for marks, these config values will be overridden.
The area config can contain anyarea mark properties (excepttype
,style
,clip
, andorient
).