This website is for Vega-Lite v3. Go to the main Vega-Lite homepage for the latest release.

View Title

Edit this page

The 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 TitleAnchor

The anchor position for placing the title. One of "start", "middle", or "end". For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.

Default value: "middle" for single and layered views. "start" for other composite views.

Note: For now, anchor is only customizable only for single and layered views. For other composite views, anchor is always "start".

angle Number

Angle in degrees of title text.

baseline String

Vertical text baseline for title text. One of "top", "middle", "bottom", or "alphabetic".

color Color

Text color for title text.

font String

Font name for title text.

fontSize Number

Font size in pixels for title text.

Default value: 10.

fontStyle FontStyle

Font style for title text.

fontWeight String | Number

Font weight for title text. This can be either a string (e.g "bold", "normal") or a number (100, 200, 300, …, 900 where "normal" = 400 and "bold" = 700).

frame String

The reference frame for the anchor position, one of "bounds" (to anchor relative to the full bounding box) or "group" (to anchor relative to the group width or height).

limit Number

The maximum allowed length in pixels of legend labels.

offset Number

The orthogonal offset in pixels by which to displace the title from its position along the edge of the chart.

orient String

Default title orientation ("top", "bottom", "left", or "right")

style String | String[]

A mark style property to apply to the title text mark.

Default value: "group-title".

zindex Number

The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.

Default value: 0.

For example, we can customize the anchor of the title of a bar chart.

// Top-level View Specification
  "config": {
    "title": : {

Title Config

To provide themes for all titles, the title configuration (config: {title: {...}}) supports all title parameters.