altair.FormatConfig#
- class altair.FormatConfig(normalizedNumberFormat=Undefined, normalizedNumberFormatType=Undefined, numberFormat=Undefined, numberFormatType=Undefined, timeFormat=Undefined, timeFormatType=Undefined, **kwds)#
FormatConfig 模式封装器。
- 参数:
- normalizedNumberFormatstr
如果未指定 normalizedNumberFormatType,则这是归一化堆叠字段(带有
stack: "normalize"
的字段)的轴标签、文本标记和工具提示的 D3 数字格式。例如,用于 SI 单位的"s"
。使用D3 的数字格式模式。如果指定了
config.normalizedNumberFormatType
并且config.customFormatTypes
为true
,则此值将作为format
与datum.value
一起传递给config.numberFormatType
函数。默认值:%
- normalizedNumberFormatTypestr
用于
config.normalizedNumberFormat
的自定义格式类型。默认值:
undefined
– 这等同于调用 D3-format,它在 Vega-Expression 中作为 format 公开。注意:您还必须将customFormatTypes
设置为true
才能使用此功能。- numberFormatstr
如果未指定 numberFormatType,则这是非归一化字段(不带
stack: "normalize"
的字段)的指南标签、文本标记和工具提示的 D3 数字格式。例如,用于 SI 单位的"s"
。使用D3 的数字格式模式。如果指定了
config.numberFormatType
并且config.customFormatTypes
为true
,则此值将作为format
与datum.value
一起传递给config.numberFormatType
函数。- numberFormatTypestr
用于
config.numberFormat
的自定义格式类型。默认值:
undefined
– 这等同于调用 D3-format,它在 Vega-Expression 中作为 format 公开。注意:您还必须将customFormatTypes
设置为true
才能使用此功能。- timeFormatstr
文本标记、图例标签和标题标签中原始时间值(不带时间单位)的默认时间格式。
默认值:
"%b %d, %Y"
注意:轴会自动确定每个标签的格式,因此此配置不影响轴。- timeFormatTypestr
用于
config.timeFormat
的自定义格式类型。默认值:
undefined
– 这等同于调用 D3-time-format,它在 Vega-Expression 中作为 timeFormat 公开。注意:您还必须将customFormatTypes
设置为true
,并且必须没有定义timeUnit
才能使用此功能。
- __init__(normalizedNumberFormat=Undefined, normalizedNumberFormatType=Undefined, numberFormat=Undefined, numberFormatType=Undefined, timeFormat=Undefined, timeFormatType=Undefined, **kwds)#
方法
__init__
([normalizedNumberFormat, ...])返回对象的副本。
copy
([deep, ignore])从字典表示构造类。
from_dict
(dct[, validate])从有效的 JSON 字符串实例化对象。
from_json
(json_string[, validate])在此对象的模式或根模式的上下文中解析引用。
resolve_references
([schema])返回对象的字典表示。
to_dict
([validate, ignore, context])将此对象的 JSON 表示作为字符串发出。
to_json
([validate, indent, sort_keys, ...])在根模式的上下文中根据类模式验证实例。
validate
(instance[, schema])在根模式的上下文中根据属性模式验证属性。
validate_property
(name, value[, schema])