Skip to contents

Add headerRow config (HeaderConfig) to a vega-lite spec.

Usage

vl_config_headerRow(
  spec,
  format = NULL,
  formatType = NULL,
  labelAlign = NULL,
  labelAnchor = NULL,
  labelAngle = NULL,
  labelBaseline = NULL,
  labelColor = NULL,
  labelExpr = NULL,
  labelFont = NULL,
  labelFontSize = NULL,
  labelFontStyle = NULL,
  labelFontWeight = NULL,
  labelLimit = NULL,
  labelLineHeight = NULL,
  labelOrient = NULL,
  labelPadding = NULL,
  labels = NULL,
  orient = NULL,
  title = NULL,
  titleAlign = NULL,
  titleAnchor = NULL,
  titleAngle = NULL,
  titleBaseline = NULL,
  titleColor = NULL,
  titleFont = NULL,
  titleFontSize = NULL,
  titleFontStyle = NULL,
  titleFontWeight = NULL,
  titleLimit = NULL,
  titleLineHeight = NULL,
  titleOrient = NULL,
  titlePadding = NULL,
  .object = NULL
)

Arguments

spec

An input vega-lite spec

format

When used with the default "number" and "time" format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.

See the format documentation for more examples.

When used with a custom formatType, this value will be passed as format alongside datum.value to the registered function.

Default value: Derived from numberFormat config for number format and from timeFormat config for time format.

formatType

The format type for labels. One of "number", "time", or a registered custom format type.

Default value:

  • "time" for temporal fields and ordinal and nominal fields with timeUnit.

  • "number" for quantitative fields as well as ordinal and nominal fields without timeUnit.

labelAlign

Horizontal text alignment of header labels. One of "left", "center", or "right".

labelAnchor

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

labelAngle

The rotation angle of the header labels.

Default value: 0 for column header, -90 for row header.

labelBaseline

The vertical text baseline for the header labels. One of "alphabetic" (default), "top", "middle", "bottom", "line-top", or "line-bottom". The "line-top" and "line-bottom" values operate similarly to "top" and "bottom", but are calculated relative to the titleLineHeight rather than titleFontSize alone.

labelColor

The color of the header label, can be in hex color code or regular color name.

labelExpr

Vega expression for customizing labels.

Note: The label text and value can be assessed via the label and value properties of the header's backing datum object.

labelFont

The font of the header label.

labelFontSize

The font size of the header label, in pixels.

labelFontStyle

The font style of the header label.

labelFontWeight

The font weight of the header label.

labelLimit

The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.

Default value: 0, indicating no limit

labelLineHeight

Line height in pixels for multi-line header labels or title text with "line-top" or "line-bottom" baseline.

labelOrient

The orientation of the header label. One of "top", "bottom", "left" or "right".

labelPadding

The padding, in pixel, between facet header's label and the plot.

Default value: 10

labels

A boolean flag indicating if labels should be included as part of the header.

Default value: true.

orient

Shortcut for setting both labelOrient and titleOrient.

title

Set to null to disable title for the axis, legend, or header.

titleAlign

Horizontal text alignment (to the anchor) of header titles.

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.

titleAngle

The rotation angle of the header title.

Default value: 0.

titleBaseline

The vertical text baseline for the header title. One of "alphabetic" (default), "top", "middle", "bottom", "line-top", or "line-bottom". The "line-top" and "line-bottom" values operate similarly to "top" and "bottom", but are calculated relative to the titleLineHeight rather than titleFontSize alone.

Default value: "middle"

titleColor

Color of the header title, can be in hex color code or regular color name.

titleFont

Font of the header title. (e.g., "Helvetica Neue").

titleFontSize

Font size of the header title.

titleFontStyle

The font style of the header title.

titleFontWeight

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

titleLimit

The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.

Default value: 0, indicating no limit

titleLineHeight

Line height in pixels for multi-line header title text or title text with "line-top" or "line-bottom" baseline.

titleOrient

The orientation of the header title. One of "top", "bottom", "left" or "right".

titlePadding

The padding, in pixel, between facet header's title and the label.

Default value: 10

.object

Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than spec. Objects can be of type: HeaderConfig

Value

A modified Vega-Lite Spec