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 封装器。
- 参数:
- formatstr, dict,
Dict
当与默认的
"number"
和"time"
格式类型一起使用时,这是导轨(轴、图例、头部)标签和文本标记的文本格式模式。更多示例请参见格式文档。
当与自定义格式类型一起使用时,此值将作为
format
与datum.value
一起传递给注册函数。默认值: 数值格式从 numberFormat 配置派生,时间格式从 timeFormat 配置派生。
- formatTypestr
标签的格式类型。可以是
"number"
、"time"
或注册的自定义格式类型之一。默认值
对于时间字段以及带有
timeUnit
的有序和名义字段,默认为"time"
。对于定量字段以及不带
timeUnit
的有序和名义字段,默认为"number"
。
- labelAligndict,
Align
,ExprRef
, Literal[‘left’, ‘center’, ‘right’] 头部标签的水平文本对齐方式。可以是
"left"
、"center"
或"right"
之一。- labelAnchor
TitleAnchor
, Literal[None, ‘start’, ‘middle’, ‘end’] 放置标签的锚点位置。可以是
"start"
、"middle"
或"end"
之一。例如,当标签方向为顶部时,这些锚点位置分别对应左对齐、居中对齐或右对齐标签。- labelAnglefloat
头部标签的旋转角度。
默认值: 列头部为
0
,行头部为-90
。- labelBaselinedict,
ExprRef
,Baseline
,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,
Color
,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
对象的label
和value
属性访问标签文本和值。- 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"
基线的标题文本的行高,单位像素。- labelOrient
Orient
, Literal[‘left’, ‘right’, ‘top’, ‘bottom’] 头部标签的方向。可以是
"top"
、"bottom"
、"left"
或"right"
之一。- labelPaddingdict, float,
ExprRef
切面头部标签与绘图之间的填充(像素)。
默认值:
10
- labelsbool
一个布尔标志,指示是否应将标签作为头部的一部分包含。
默认值:
true
。- orient
Orient
, Literal[‘left’, ‘right’, ‘top’, ‘bottom’] 同时设置 labelOrient 和 titleOrient 的快捷方式。
- titleNone
设置为 null 可禁用轴、图例或头部的标题。
- titleAligndict,
Align
,ExprRef
, Literal[‘left’, ‘center’, ‘right’] 头部标题的水平文本对齐方式(相对于锚点)。
- titleAnchor
TitleAnchor
, Literal[None, ‘start’, ‘middle’, ‘end’] 放置标题的锚点位置。可以是
"start"
、"middle"
或"end"
之一。例如,当方向为顶部时,这些锚点位置分别对应左对齐、居中对齐或右对齐标题。- titleAnglefloat
头部标题的旋转角度。
默认值:
0
。- titleBaselinedict,
ExprRef
,Baseline
,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,
Color
,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"
基线的标题文本的行高,单位像素。- titleOrient
Orient
, Literal[‘left’, ‘right’, ‘top’, ‘bottom’] 头部标题的方向。可以是
"top"
、"bottom"
、"left"
或"right"
之一。- titlePaddingdict, float,
ExprRef
切面头部标题与标签之间的填充(像素)。
默认值:
10
- formatstr, dict,
- __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__
([format, formatType, labelAlign, ...])copy
([deep, ignore])返回对象的副本。
from_dict
(dct[, validate])从字典表示构建类。
from_json
(json_string[, validate])从有效的 JSON 字符串实例化对象。
resolve_references
([schema])在对象的 schema 或根 schema 上下文中解析引用。
to_dict
([validate, ignore, context])返回对象的字典表示。
to_json
([validate, indent, sort_keys, ...])以字符串形式发出此对象的 JSON 表示。
validate
(instance[, schema])在根 schema 上下文中根据类 schema 验证实例。
validate_property
(name, value[, schema])在根 schema 上下文中根据属性 schema 验证属性。