altair.HeaderConfig#

class altair.HeaderConfig(format=Undefined, formatType=Undefined, labelAlign=Undefined, labelAnchor=Undefined, labelAngle=Undefined, labelBaseline=Undefined, labelColor=Undefined, labelExpr=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelFontStyle=Undefined, labelFontWeight=Undefined, labelLimit=Undefined, labelLineHeight=Undefined, labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, orient=Undefined, title=Undefined, titleAlign=Undefined, titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, titleLineHeight=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds)#

HeaderConfig schema 包装器。

Parameters:
formatstr, dict, Dict

当与默认的 "number""time" 格式类型一起使用时,文本 格式化模式适用于引导(坐标轴、图例、标题)的标签和文本标记。

  • 如果格式类型是 "number"(例如,对于定量字段),这是D3的 数字格式模式

  • 如果格式类型是 "time"(例如,对于时间字段),这是D3的 时间格式模式

查看格式文档以获取更多示例。

当与 custom formatType 一起使用时,这个值将作为 formatdatum.value 一起传递给注册的函数。

默认值: 来源于 numberFormat 配置的数字 格式和来自 timeFormat 配置的时间 格式。

formatTypestr

标签的格式类型。可以是 "number""time",或一个 注册的自定义格式类型

默认值:

  • "time" 用于时间字段以及带有 timeUnit 的序数和名义字段。

  • "number" 用于定量字段以及没有 timeUnit 的顺序和名义字段。

labelAligndict, 对齐, ExprRef, Literal[‘left’, ‘center’, ‘right’]

表头标签的水平文本对齐方式。可以是 "left""center""right"

labelAnchorTitleAnchor, Literal[None, ‘start’, ‘middle’, ‘end’]

放置标签的锚点位置。可以是 "start""middle""end"。例如,当标签方向为顶部时,这些锚点位置分别对应左对齐、居中对齐或右对齐的标签。

labelAnglefloat

标题标签的旋转角度。

默认值: 0 用于列标题, -90 用于行标题。

labelBaselinedict, ExprRef, 基线, TextBaseline, Literal[‘alphabetic’, ‘line-bottom’, ‘line-top’, ‘top’, ‘middle’, ‘bottom’]

标题标签的垂直文本基线。可以是 "alphabetic"(默认),"top""middle""bottom""line-top""line-bottom""line-top""line-bottom" 的值操作与 "top""bottom" 类似,但相对于 titleLineHeight 而不是单独的 titleFontSize 进行计算。

labelColorstr, dict, 颜色, ExprRef, HexColor, ColorName, Literal[‘black’, ‘silver’, ‘gray’, ‘white’, ‘maroon’, ‘red’, ‘purple’, ‘fuchsia’, ‘green’, ‘lime’, ‘olive’, ‘yellow’, ‘navy’, ‘blue’, ‘teal’, ‘aqua’, ‘orange’, ‘aliceblue’, ‘antiquewhite’, ‘aquamarine’, ‘azure’, ‘beige’, ‘bisque’, ‘blanchedalmond’, ‘blueviolet’, ‘brown’, ‘burlywood’, ‘cadetblue’, ‘chartreuse’, ‘chocolate’, ‘coral’, ‘cornflowerblue’, ‘cornsilk’, ‘crimson’, ‘cyan’, ‘darkblue’, ‘darkcyan’, ‘darkgoldenrod’, ‘darkgray’, ‘darkgreen’, ‘darkgrey’, ‘darkkhaki’, ‘darkmagenta’, ‘darkolivegreen’, ‘darkorange’, ‘darkorchid’, ‘darkred’, ‘darksalmon’, ‘darkseagreen’, ‘darkslateblue’, ‘darkslategray’, ‘darkslategrey’, ‘darkturquoise’, ‘darkviolet’, ‘deeppink’, ‘deepskyblue’, ‘dimgray’, ‘dimgrey’, ‘dodgerblue’, ‘firebrick’, ‘floralwhite’, ‘forestgreen’, ‘gainsboro’, ‘ghostwhite’, ‘gold’, ‘goldenrod’, ‘greenyellow’, ‘grey’, ‘honeydew’, ‘hotpink’, ‘indianred’, ‘indigo’, ‘ivory’, ‘khaki’, ‘lavender’, ‘lavenderblush’, ‘lawngreen’, ‘lemonchiffon’, ‘lightblue’, ‘lightcoral’, ‘lightcyan’, ‘lightgoldenrodyellow’, ‘lightgray’, ‘lightgreen’, ‘lightgrey’, ‘lightpink’, ‘lightsalmon’, ‘lightseagreen’, ‘lightskyblue’, ‘lightslategray’, ‘lightslategrey’, ‘lightsteelblue’, ‘lightyellow’, ‘limegreen’, ‘linen’, ‘magenta’, ‘mediumaquamarine’, ‘mediumblue’, ‘mediumorchid’, ‘mediumpurple’, ‘mediumseagreen’, ‘mediumslateblue’, ‘mediumspringgreen’, ‘mediumturquoise’, ‘mediumvioletred’, ‘midnightblue’, ‘mintcream’, ‘mistyrose’, ‘moccasin’, ‘navajowhite’, ‘oldlace’, ‘olivedrab’, ‘orangered’, ‘orchid’, ‘palegoldenrod’, ‘palegreen’, ‘paleturquoise’, ‘palevioletred’, ‘papayawhip’, ‘peachpuff’, ‘peru’, ‘pink’, ‘plum’, ‘powderblue’, ‘rosybrown’, ‘royalblue’, ‘saddlebrown’, ‘salmon’, ‘sandybrown’, ‘seagreen’, ‘seashell’, ‘sienna’, ‘skyblue’, ‘slateblue’, ‘slategray’, ‘slategrey’, ‘snow’, ‘springgreen’, ‘steelblue’, ‘tan’, ‘thistle’, ‘tomato’, ‘turquoise’, ‘violet’, ‘wheat’, ‘whitesmoke’, ‘yellowgreen’, ‘rebeccapurple’]

标题标签的颜色,可以使用十六进制颜色代码或常规颜色名称。

labelExprstr

Vega 表达式 用于自定义 标签。

注意: 标签文本和数值可以通过头部的支持 datum 对象的 labelvalue 属性进行访问。

labelFontstr, dict, ExprRef

标题标签的字体。

labelFontSizedict, float, ExprRef

标题标签的字体大小,单位为像素。

labelFontStylestr, dict, ExprRef, FontStyle

标题标签的字体样式。

labelFontWeightdict, ExprRef, FontWeight, Literal[‘normal’, ‘bold’, ‘lighter’, ‘bolder’, 100, 200, 300, 400, 500, 600, 700, 800, 900]

标题标签的字体粗细。

labelLimitdict, float, ExprRef

标题标签的最大长度(以像素为单位)。如果渲染的大小超过限制,文本值将自动截断。

默认值: 0,表示没有限制

labelLineHeightdict, float, ExprRef

多行标题标签或标题文本的行高(以像素为单位),带有 "line-top""line-bottom" 基线。

labelOrientOrient, Literal[‘left’, ‘right’, ‘top’, ‘bottom’]

标题标签的方向。可以是 "top""bottom""left""right"

labelPaddingdict, float, ExprRef

图形头部标签与图表之间的填充,单位为像素。

默认值: 10

labelsbool

一个布尔标志,指示是否应将标签包含在标题中。

默认值: true

orientOrient, Literal[‘left’, ‘right’, ‘top’, ‘bottom’]

快捷方式设置 labelOrient 和 titleOrient。

titleNone

设置为null以禁用轴、图例或标题的标题。

titleAligndict, 对齐, ExprRef, Literal[‘left’, ‘center’, ‘right’]

标题的水平文本对齐(相对于锚点)。

titleAnchorTitleAnchor, Literal[None, ‘start’, ‘middle’, ‘end’]

设置标题的位置。可以是 "start""middle""end"。例如,当方向为顶部时,这些锚点位置对应于左对齐、中间对齐或右对齐的标题。

titleAnglefloat

标题的旋转角度。

默认值: 0.

titleBaselinedict, ExprRef, 基线, TextBaseline, Literal[‘alphabetic’, ‘line-bottom’, ‘line-top’, ‘top’, ‘middle’, ‘bottom’]

标题的垂直文本基线。可以是 "alphabetic"(默认),"top""middle""bottom""line-top""line-bottom""line-top""line-bottom" 的值的操作方式类似于 "top""bottom",但相对于 titleLineHeight 而不是 titleFontSize 单独计算。

默认值: "middle"

titleColorstr, dict, 颜色, ExprRef, HexColor, ColorName, Literal[‘black’, ‘silver’, ‘gray’, ‘white’, ‘maroon’, ‘red’, ‘purple’, ‘fuchsia’, ‘green’, ‘lime’, ‘olive’, ‘yellow’, ‘navy’, ‘blue’, ‘teal’, ‘aqua’, ‘orange’, ‘aliceblue’, ‘antiquewhite’, ‘aquamarine’, ‘azure’, ‘beige’, ‘bisque’, ‘blanchedalmond’, ‘blueviolet’, ‘brown’, ‘burlywood’, ‘cadetblue’, ‘chartreuse’, ‘chocolate’, ‘coral’, ‘cornflowerblue’, ‘cornsilk’, ‘crimson’, ‘cyan’, ‘darkblue’, ‘darkcyan’, ‘darkgoldenrod’, ‘darkgray’, ‘darkgreen’, ‘darkgrey’, ‘darkkhaki’, ‘darkmagenta’, ‘darkolivegreen’, ‘darkorange’, ‘darkorchid’, ‘darkred’, ‘darksalmon’, ‘darkseagreen’, ‘darkslateblue’, ‘darkslategray’, ‘darkslategrey’, ‘darkturquoise’, ‘darkviolet’, ‘deeppink’, ‘deepskyblue’, ‘dimgray’, ‘dimgrey’, ‘dodgerblue’, ‘firebrick’, ‘floralwhite’, ‘forestgreen’, ‘gainsboro’, ‘ghostwhite’, ‘gold’, ‘goldenrod’, ‘greenyellow’, ‘grey’, ‘honeydew’, ‘hotpink’, ‘indianred’, ‘indigo’, ‘ivory’, ‘khaki’, ‘lavender’, ‘lavenderblush’, ‘lawngreen’, ‘lemonchiffon’, ‘lightblue’, ‘lightcoral’, ‘lightcyan’, ‘lightgoldenrodyellow’, ‘lightgray’, ‘lightgreen’, ‘lightgrey’, ‘lightpink’, ‘lightsalmon’, ‘lightseagreen’, ‘lightskyblue’, ‘lightslategray’, ‘lightslategrey’, ‘lightsteelblue’, ‘lightyellow’, ‘limegreen’, ‘linen’, ‘magenta’, ‘mediumaquamarine’, ‘mediumblue’, ‘mediumorchid’, ‘mediumpurple’, ‘mediumseagreen’, ‘mediumslateblue’, ‘mediumspringgreen’, ‘mediumturquoise’, ‘mediumvioletred’, ‘midnightblue’, ‘mintcream’, ‘mistyrose’, ‘moccasin’, ‘navajowhite’, ‘oldlace’, ‘olivedrab’, ‘orangered’, ‘orchid’, ‘palegoldenrod’, ‘palegreen’, ‘paleturquoise’, ‘palevioletred’, ‘papayawhip’, ‘peachpuff’, ‘peru’, ‘pink’, ‘plum’, ‘powderblue’, ‘rosybrown’, ‘royalblue’, ‘saddlebrown’, ‘salmon’, ‘sandybrown’, ‘seagreen’, ‘seashell’, ‘sienna’, ‘skyblue’, ‘slateblue’, ‘slategray’, ‘slategrey’, ‘snow’, ‘springgreen’, ‘steelblue’, ‘tan’, ‘thistle’, ‘tomato’, ‘turquoise’, ‘violet’, ‘wheat’, ‘whitesmoke’, ‘yellowgreen’, ‘rebeccapurple’]

标题颜色,可以是十六进制颜色代码或常规颜色名称。

titleFontstr, dict, ExprRef

标题的字体。 (例如, "Helvetica Neue").

titleFontSizedict, float, ExprRef

标题的字体大小。

titleFontStylestr, dict, ExprRef, FontStyle

标题的字体样式。

titleFontWeightdict, ExprRef, FontWeight, Literal[‘normal’, ‘bold’, ‘lighter’, ‘bolder’, 100, 200, 300, 400, 500, 600, 700, 800, 900]

标题的字体粗细。可以是一个字符串(例如 "bold", "normal")或一个数字(100, 200, 300, …, 900, 其中 "normal" = 400"bold" = 700)。

titleLimitdict, float, ExprRef

标题的最大长度(以像素为单位)。如果渲染的尺寸超过限制,文本值将自动被截断。

默认值: 0,表示没有限制

titleLineHeightdict, float, ExprRef

多行标题文本或带有 "line-top""line-bottom" 基线的标题文本的行高(以像素为单位)。

titleOrientOrient, Literal[‘left’, ‘right’, ‘top’, ‘bottom’]

标题的方向。可以是 "top""bottom""left""right"

titlePaddingdict, float, ExprRef

面板标题与标签之间的填充,单位为像素。

默认值: 10

__init__(format=Undefined, formatType=Undefined, labelAlign=Undefined, labelAnchor=Undefined, labelAngle=Undefined, labelBaseline=Undefined, labelColor=Undefined, labelExpr=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelFontStyle=Undefined, labelFontWeight=Undefined, labelLimit=Undefined, labelLineHeight=Undefined, labelOrient=Undefined, labelPadding=Undefined, labels=Undefined, orient=Undefined, title=Undefined, titleAlign=Undefined, titleAnchor=Undefined, titleAngle=Undefined, titleBaseline=Undefined, titleColor=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, titleLimit=Undefined, titleLineHeight=Undefined, titleOrient=Undefined, titlePadding=Undefined, **kwds)#

方法

__init__([格式, 格式类型, 标签对齐, ...])

copy([深度, 忽略])

返回对象的副本。

from_dict(dct[, validate])

从字典表示构造类。

from_json(json_string[, validate])

从有效的 JSON 字符串实例化对象。

resolve_references([schema])

解析此对象的架构或根架构中的引用。

to_dict([validate, ignore, context])

返回对象的字典表示。

to_json([validate, indent, sort_keys, ...])

以字符串形式输出该对象的 JSON 表示。

validate(instance[, schema])

在rootschema的上下文中验证实例是否符合类模式。

validate_property(name, value[, schema])

在根架构的上下文中,根据属性架构验证一个属性。