The title directive adds a descriptive title to a chart. Similar to scales, axes, and legends, a title can be defined at the top-level of a specification or as part of a group mark.

Title Properties

Properties for specifying a title.

Property Type Description
text String Required. The title text.
orient String The orientation of the title relative to the chart. One of top (the default), bottom, left, or right.
align String Horizontal text alignment of the title. If specified, this value overrides automatic alignment based on the anchor value.
anchor String The anchor position for placing the title. One of start, middle (the default), or end. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.
angle Number Angle in degrees of the title text.
baseline String Vertical baseline of the title text.
color Color Text color of the title text.
dx Number Horizontal offset added to the title x-coordinate. ≥ 5.2
dy Number Vertical offset added to the title y-coordinate. ≥ 5.2
encode Object Optional mark encodings for custom title styling. This is a standard encode block for text marks, and may contain enter, exit, update, and hover property sets. To set a custom font, font size, etc. for a title, one can either use custom encode blocks or update the title config.
font String Font name of the title text.
fontSize Number Font size in pixels of the title text.
fontStyle String Font style of the title text (e.g., normal or italic). ≥ 5.0
fontWeight String | Number Font weight of the title text.
frame String The reference frame for the anchor position, one of "bounds" (the default, to anchor relative to the full bounding box) or "group" (to anchor relative to the group width or height).
interactive Boolean A boolean flag indicating if the title element should respond to input events such as mouse hover.
limit Number The maximum allowed length in pixels of legend labels.
name String A mark name property to apply to the title text mark.
style String | String[ ] A mark style property to apply to the title text mark. If not specified, a default style of "group-title" is applied.
offset Number | Value The orthogonal offset in pixels by which to displace the title from its position along the edge of the chart.
zindex Number The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups. The default value is 0.

To create themes, new default values for many title properties can be set using a config object.