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.customFormatTypes为true,这个值将作为format与datum.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.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,暴露为 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])在根架构的上下文中,根据属性架构验证一个属性。