View Title
Edit this pageThe title
property of a view specification in Vega-lite adds a descriptive title to a chart. The title property can be either a string or an object defining the title parameters.
For example, the following bar chart is titled “A Simple Bar Chart”.
Title Parameter Object
A title
parameter object can contain the following properties:
Property | Type | Description |
---|---|---|
text | String |
Required. The title text. |
anchor | String |
The anchor position for placing the title. One of Default value: Note: For now, |
offset | Number |
The orthogonal offset in pixels by which to displace the title from its position along the edge of the chart. |
orient | String |
The orientation of the title relative to the chart. One of |
style | String | String[] |
A mark style property to apply to the title text mark. Default value: |
For example, we can customize the anchor
of the title of a bar chart.
Title Config
// Top-level View Specification
{
...
"config": {
"title": : {
...
}
}
}
To provide themes for all titles, the title config config: {title: {...}}
can contain the following properties:
Property | Type | Description |
---|---|---|
anchor | String |
The anchor position for placing the title. One of Default value: Note: For now, |
angle | Number |
Angle in degrees of title text. |
baseline | String |
Vertical text baseline for title text. |
color | String |
Text color for title text. |
font | String |
Font name for title text. |
fontSize | Number |
Font size in pixels for title text. Default value: |
fontWeight | String |
Font weight for title text.
This can be either a string (e.g |
limit | Number |
The maximum allowed length in pixels of legend labels. |
offset | Number |
Offset in pixels of the title from the chart body and axes. |
orient | String |
Default title orientation (“top”, “bottom”, “left”, or “right”) |