altair.FormatConfig#

class altair.FormatConfig(normalizedNumberFormat=Undefined, normalizedNumberFormatType=Undefined, numberFormat=Undefined, numberFormatType=Undefined, timeFormat=Undefined, timeFormatType=Undefined, **kwds)#

FormatConfig 架构包装器。

Parameters:
normalizedNumberFormatstr

如果没有指定normalizedNumberFormatType,则使用D3数字格式用于轴标签、文本标记和标准化堆叠字段的工具提示(字段具有 stack: "normalize")。例如 "s" 表示SI单位。使用 D3的数字格式模式

如果 config.normalizedNumberFormatType 被指定并且 config.customFormatTypestrue,这个值将作为 formatdatum.value 一起传递给 config.numberFormatType 函数。 默认值: %

normalizedNumberFormatTypestr

自定义格式类型 用于 config.normalizedNumberFormat.

默认值: undefined – 这相当于调用 D3-format,它在 Vega-Expression 中作为 format 暴露。 注意: 您还必须将 customFormatTypes 设置为 true 以使用此功能。

numberFormatstr

如果未指定numberFormatType,则D3用于引导标签、文本标记和非规范化字段的工具提示的数字格式(字段 没有 stack: "normalize")。例如 "s" 表示SI单位。使用 D3的数字格式模式

如果 config.numberFormatType 被指定且 config.customFormatTypestrue,则此值将作为 formatdatum.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,暴露为 timeFormat in Vega-Expression注意: 您还必须将 customFormatTypes 设置为 true,并且必须定义 timeUnit 才能使用此功能。

__init__(normalizedNumberFormat=Undefined, normalizedNumberFormatType=Undefined, numberFormat=Undefined, numberFormatType=Undefined, timeFormat=Undefined, timeFormatType=Undefined, **kwds)#

方法

__init__([normalizedNumberFormat, ...])

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])

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