mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-04-22 18:32:15 +00:00
5325 lines
257 KiB
Python
5325 lines
257 KiB
Python
# The contents of this file are automatically written by
|
|
# tools/generate_schema_wrapper.py. Do not modify directly.
|
|
|
|
from . import core
|
|
import pandas as pd
|
|
from altair.utils.schemapi import Undefined
|
|
from altair.utils import parse_shorthand
|
|
|
|
|
|
class FieldChannelMixin(object):
|
|
def to_dict(self, validate=True, ignore=(), context=None):
|
|
context = context or {}
|
|
shorthand = self._get('shorthand')
|
|
field = self._get('field')
|
|
|
|
if shorthand is not Undefined and field is not Undefined:
|
|
raise ValueError("{} specifies both shorthand={} and field={}. "
|
|
"".format(self.__class__.__name__, shorthand, field))
|
|
|
|
if isinstance(shorthand, (tuple, list)):
|
|
# If given a list of shorthands, then transform it to a list of classes
|
|
kwds = self._kwds.copy()
|
|
kwds.pop('shorthand')
|
|
return [self.__class__(sh, **kwds).to_dict(validate=validate, ignore=ignore, context=context)
|
|
for sh in shorthand]
|
|
|
|
if shorthand is Undefined:
|
|
parsed = {}
|
|
elif isinstance(shorthand, str):
|
|
parsed = parse_shorthand(shorthand, data=context.get('data', None))
|
|
type_required = 'type' in self._kwds
|
|
type_in_shorthand = 'type' in parsed
|
|
type_defined_explicitly = self._get('type') is not Undefined
|
|
if not type_required:
|
|
# Secondary field names don't require a type argument in VegaLite 3+.
|
|
# We still parse it out of the shorthand, but drop it here.
|
|
parsed.pop('type', None)
|
|
elif not (type_in_shorthand or type_defined_explicitly):
|
|
if isinstance(context.get('data', None), pd.DataFrame):
|
|
raise ValueError("{} encoding field is specified without a type; "
|
|
"the type cannot be inferred because it does not "
|
|
"match any column in the data.".format(shorthand))
|
|
else:
|
|
raise ValueError("{} encoding field is specified without a type; "
|
|
"the type cannot be automatically inferred because "
|
|
"the data is not specified as a pandas.DataFrame."
|
|
"".format(shorthand))
|
|
else:
|
|
# Shorthand is not a string; we pass the definition to field,
|
|
# and do not do any parsing.
|
|
parsed = {'field': shorthand}
|
|
|
|
# Set shorthand to Undefined, because it's not part of the base schema.
|
|
self.shorthand = Undefined
|
|
self._kwds.update({k: v for k, v in parsed.items()
|
|
if self._get(k) is Undefined})
|
|
return super(FieldChannelMixin, self).to_dict(
|
|
validate=validate,
|
|
ignore=ignore,
|
|
context=context
|
|
)
|
|
|
|
|
|
class ValueChannelMixin(object):
|
|
def to_dict(self, validate=True, ignore=(), context=None):
|
|
context = context or {}
|
|
condition = getattr(self, 'condition', Undefined)
|
|
copy = self # don't copy unless we need to
|
|
if condition is not Undefined:
|
|
if isinstance(condition, core.SchemaBase):
|
|
pass
|
|
elif 'field' in condition and 'type' not in condition:
|
|
kwds = parse_shorthand(condition['field'], context.get('data', None))
|
|
copy = self.copy(deep=['condition'])
|
|
copy.condition.update(kwds)
|
|
return super(ValueChannelMixin, copy).to_dict(validate=validate,
|
|
ignore=ignore,
|
|
context=context)
|
|
|
|
|
|
class DatumChannelMixin(object):
|
|
def to_dict(self, validate=True, ignore=(), context=None):
|
|
context = context or {}
|
|
datum = getattr(self, 'datum', Undefined)
|
|
copy = self # don't copy unless we need to
|
|
if datum is not Undefined:
|
|
if isinstance(datum, core.SchemaBase):
|
|
pass
|
|
return super(DatumChannelMixin, copy).to_dict(validate=validate,
|
|
ignore=ignore,
|
|
context=context)
|
|
|
|
|
|
class Color(FieldChannelMixin, core.StringFieldDefWithCondition):
|
|
"""Color schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "color"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Color, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class ColorValue(ValueChannelMixin, core.StringValueDefWithCondition):
|
|
"""ColorValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : anyOf(string, None)
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "color"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(ColorValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Column(FieldChannelMixin, core.FacetFieldDef):
|
|
"""Column schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
header : :class:`Header`
|
|
An object defining properties of a facet's header.
|
|
sort : anyOf(:class:`SortArray`, :class:`SortOrder`, :class:`EncodingSortField`, None)
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "column"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined,
|
|
**kwds):
|
|
super(Column, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
header=header, sort=sort, timeUnit=timeUnit, title=title,
|
|
type=type, **kwds)
|
|
|
|
|
|
class Detail(FieldChannelMixin, core.FieldDefWithoutScale):
|
|
"""Detail schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
Definition object for a data field, its type and transformation of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "detail"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Detail, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class Facet(FieldChannelMixin, core.FacetFieldDef):
|
|
"""Facet schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
header : :class:`Header`
|
|
An object defining properties of a facet's header.
|
|
sort : anyOf(:class:`SortArray`, :class:`SortOrder`, :class:`EncodingSortField`, None)
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "facet"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined,
|
|
**kwds):
|
|
super(Facet, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
header=header, sort=sort, timeUnit=timeUnit, title=title, type=type,
|
|
**kwds)
|
|
|
|
|
|
class Fill(FieldChannelMixin, core.StringFieldDefWithCondition):
|
|
"""Fill schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "fill"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Fill, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class FillValue(ValueChannelMixin, core.StringValueDefWithCondition):
|
|
"""FillValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : anyOf(string, None)
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "fill"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(FillValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class FillOpacity(FieldChannelMixin, core.NumericFieldDefWithCondition):
|
|
"""FillOpacity schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "fillOpacity"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(FillOpacity, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class FillOpacityValue(ValueChannelMixin, core.NumericValueDefWithCondition):
|
|
"""FillOpacityValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "fillOpacity"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(FillOpacityValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Href(FieldChannelMixin, core.TextFieldDefWithCondition):
|
|
"""Href schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalValueDef`, List(:class:`ConditionalValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
format : string
|
|
The text formatting pattern for labels of guides (axes, legends, headers) and text
|
|
marks.
|
|
|
|
|
|
* If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's
|
|
`number format pattern <https://github.com/d3/d3-format#locale_format>`__.
|
|
* If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time
|
|
format pattern <https://github.com/d3/d3-time-format#locale_format>`__.
|
|
|
|
See the `format documentation <https://vega.github.io/vega-lite/docs/format.html>`__
|
|
for more examples.
|
|
|
|
**Default value:** Derived from `numberFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for number
|
|
format and from `timeFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for time
|
|
format.
|
|
formatType : enum('number', 'time')
|
|
The format type for labels ( ``"number"`` or ``"time"`` ).
|
|
|
|
**Default value:**
|
|
|
|
|
|
* ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``.
|
|
* ``"number"`` for quantitative fields as well as ordinal and nomimal fields without
|
|
``timeUnit``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "href"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, format=Undefined, formatType=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Href, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, format=format,
|
|
formatType=formatType, timeUnit=timeUnit, title=title, type=type,
|
|
**kwds)
|
|
|
|
|
|
class HrefValue(ValueChannelMixin, core.TextValueDefWithCondition):
|
|
"""HrefValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalTextFieldDef`, :class:`ConditionalValueDef`,
|
|
List(:class:`ConditionalValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : :class:`Value`
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "href"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(HrefValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Key(FieldChannelMixin, core.FieldDefWithoutScale):
|
|
"""Key schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
Definition object for a data field, its type and transformation of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "key"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Key, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class Latitude(FieldChannelMixin, core.LatLongFieldDef):
|
|
"""Latitude schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : enum('quantitative')
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "latitude"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Latitude, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class LatitudeValue(ValueChannelMixin, core.NumberValueDef):
|
|
"""LatitudeValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "latitude"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(LatitudeValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Latitude2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""Latitude2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "latitude2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(Latitude2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class Latitude2Value(ValueChannelMixin, core.NumberValueDef):
|
|
"""Latitude2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "latitude2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(Latitude2Value, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Longitude(FieldChannelMixin, core.LatLongFieldDef):
|
|
"""Longitude schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : enum('quantitative')
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "longitude"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Longitude, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class LongitudeValue(ValueChannelMixin, core.NumberValueDef):
|
|
"""LongitudeValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "longitude"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(LongitudeValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Longitude2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""Longitude2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "longitude2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(Longitude2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class Longitude2Value(ValueChannelMixin, core.NumberValueDef):
|
|
"""Longitude2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "longitude2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(Longitude2Value, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Opacity(FieldChannelMixin, core.NumericFieldDefWithCondition):
|
|
"""Opacity schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "opacity"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Opacity, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class OpacityValue(ValueChannelMixin, core.NumericValueDefWithCondition):
|
|
"""OpacityValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "opacity"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(OpacityValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Order(FieldChannelMixin, core.OrderFieldDef):
|
|
"""Order schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
sort : :class:`SortOrder`
|
|
The sort order. One of ``"ascending"`` (default) or ``"descending"``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "order"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Order, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class OrderValue(ValueChannelMixin, core.NumberValueDef):
|
|
"""OrderValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "order"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(OrderValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Row(FieldChannelMixin, core.FacetFieldDef):
|
|
"""Row schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
header : :class:`Header`
|
|
An object defining properties of a facet's header.
|
|
sort : anyOf(:class:`SortArray`, :class:`SortOrder`, :class:`EncodingSortField`, None)
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "row"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
header=Undefined, sort=Undefined, timeUnit=Undefined, title=Undefined, type=Undefined,
|
|
**kwds):
|
|
super(Row, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
header=header, sort=sort, timeUnit=timeUnit, title=title, type=type,
|
|
**kwds)
|
|
|
|
|
|
class Shape(FieldChannelMixin, core.ShapeFieldDefWithCondition):
|
|
"""Shape schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`TypeForShape`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "shape"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Shape, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class ShapeValue(ValueChannelMixin, core.ShapeValueDefWithCondition):
|
|
"""ShapeValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDefTypeForShape`,
|
|
:class:`ConditionalStringValueDef`, List(:class:`ConditionalStringValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : anyOf(string, None)
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "shape"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(ShapeValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Size(FieldChannelMixin, core.NumericFieldDefWithCondition):
|
|
"""Size schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "size"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Size, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class SizeValue(ValueChannelMixin, core.NumericValueDefWithCondition):
|
|
"""SizeValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "size"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(SizeValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Stroke(FieldChannelMixin, core.StringFieldDefWithCondition):
|
|
"""Stroke schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "stroke"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Stroke, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class StrokeValue(ValueChannelMixin, core.StringValueDefWithCondition):
|
|
"""StrokeValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalStringValueDef`,
|
|
List(:class:`ConditionalStringValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : anyOf(string, None)
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "stroke"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(StrokeValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class StrokeOpacity(FieldChannelMixin, core.NumericFieldDefWithCondition):
|
|
"""StrokeOpacity schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "strokeOpacity"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(StrokeOpacity, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend,
|
|
scale=scale, sort=sort, timeUnit=timeUnit, title=title,
|
|
type=type, **kwds)
|
|
|
|
|
|
class StrokeOpacityValue(ValueChannelMixin, core.NumericValueDefWithCondition):
|
|
"""StrokeOpacityValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "strokeOpacity"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(StrokeOpacityValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class StrokeWidth(FieldChannelMixin, core.NumericFieldDefWithCondition):
|
|
"""StrokeWidth schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
legend : anyOf(:class:`Legend`, None)
|
|
An object defining properties of the legend.
|
|
If ``null``, the legend for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `legend properties
|
|
<https://vega.github.io/vega-lite/docs/legend.html>`__ are applied.
|
|
|
|
**See also:** `legend <https://vega.github.io/vega-lite/docs/legend.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "strokeWidth"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, legend=Undefined, scale=Undefined, sort=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(StrokeWidth, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, legend=legend, scale=scale,
|
|
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class StrokeWidthValue(ValueChannelMixin, core.NumericValueDefWithCondition):
|
|
"""StrokeWidthValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalMarkPropFieldDef`, :class:`ConditionalNumberValueDef`,
|
|
List(:class:`ConditionalNumberValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "strokeWidth"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(StrokeWidthValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Text(FieldChannelMixin, core.TextFieldDefWithCondition):
|
|
"""Text schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalValueDef`, List(:class:`ConditionalValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
format : string
|
|
The text formatting pattern for labels of guides (axes, legends, headers) and text
|
|
marks.
|
|
|
|
|
|
* If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's
|
|
`number format pattern <https://github.com/d3/d3-format#locale_format>`__.
|
|
* If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time
|
|
format pattern <https://github.com/d3/d3-time-format#locale_format>`__.
|
|
|
|
See the `format documentation <https://vega.github.io/vega-lite/docs/format.html>`__
|
|
for more examples.
|
|
|
|
**Default value:** Derived from `numberFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for number
|
|
format and from `timeFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for time
|
|
format.
|
|
formatType : enum('number', 'time')
|
|
The format type for labels ( ``"number"`` or ``"time"`` ).
|
|
|
|
**Default value:**
|
|
|
|
|
|
* ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``.
|
|
* ``"number"`` for quantitative fields as well as ordinal and nomimal fields without
|
|
``timeUnit``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "text"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, format=Undefined, formatType=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Text, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, format=format,
|
|
formatType=formatType, timeUnit=timeUnit, title=title, type=type,
|
|
**kwds)
|
|
|
|
|
|
class TextValue(ValueChannelMixin, core.TextValueDefWithCondition):
|
|
"""TextValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalTextFieldDef`, :class:`ConditionalValueDef`,
|
|
List(:class:`ConditionalValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : :class:`Value`
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "text"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(TextValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class Tooltip(FieldChannelMixin, core.TextFieldDefWithCondition):
|
|
"""Tooltip schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A FieldDef with Condition :raw-html:`<ValueDef>`
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
condition : anyOf(:class:`ConditionalValueDef`, List(:class:`ConditionalValueDef`))
|
|
One or more value definition(s) with `a selection or a test predicate
|
|
<https://vega.github.io/vega-lite/docs/condition.html>`__.
|
|
|
|
**Note:** A field definition's ``condition`` property can only contain `conditional
|
|
value definitions <https://vega.github.io/vega-lite/docs/condition.html#value>`__
|
|
since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
format : string
|
|
The text formatting pattern for labels of guides (axes, legends, headers) and text
|
|
marks.
|
|
|
|
|
|
* If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's
|
|
`number format pattern <https://github.com/d3/d3-format#locale_format>`__.
|
|
* If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time
|
|
format pattern <https://github.com/d3/d3-time-format#locale_format>`__.
|
|
|
|
See the `format documentation <https://vega.github.io/vega-lite/docs/format.html>`__
|
|
for more examples.
|
|
|
|
**Default value:** Derived from `numberFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for number
|
|
format and from `timeFormat
|
|
<https://vega.github.io/vega-lite/docs/config.html#format>`__ config for time
|
|
format.
|
|
formatType : enum('number', 'time')
|
|
The format type for labels ( ``"number"`` or ``"time"`` ).
|
|
|
|
**Default value:**
|
|
|
|
|
|
* ``"time"`` for temporal fields and ordinal and nomimal fields with ``timeUnit``.
|
|
* ``"number"`` for quantitative fields as well as ordinal and nomimal fields without
|
|
``timeUnit``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "tooltip"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, condition=Undefined,
|
|
field=Undefined, format=Undefined, formatType=Undefined, timeUnit=Undefined,
|
|
title=Undefined, type=Undefined, **kwds):
|
|
super(Tooltip, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin,
|
|
condition=condition, field=field, format=format,
|
|
formatType=formatType, timeUnit=timeUnit, title=title, type=type,
|
|
**kwds)
|
|
|
|
|
|
class TooltipValue(ValueChannelMixin, core.TextValueDefWithCondition):
|
|
"""TooltipValue schema wrapper
|
|
|
|
Mapping(required=[])
|
|
A ValueDef with Condition<ValueDef | FieldDef> where either the condition or the value are
|
|
optional.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
condition : anyOf(:class:`ConditionalTextFieldDef`, :class:`ConditionalValueDef`,
|
|
List(:class:`ConditionalValueDef`))
|
|
A field definition or one or more value definition(s) with a selection predicate.
|
|
value : :class:`Value`
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "tooltip"
|
|
|
|
def __init__(self, value, condition=Undefined, **kwds):
|
|
super(TooltipValue, self).__init__(value=value, condition=condition, **kwds)
|
|
|
|
|
|
class X(FieldChannelMixin, core.PositionFieldDef):
|
|
"""X schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
axis : anyOf(:class:`Axis`, None)
|
|
An object defining properties of axis's gridlines, ticks and labels.
|
|
If ``null``, the axis for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `axis properties
|
|
<https://vega.github.io/vega-lite/docs/axis.html>`__ are applied.
|
|
|
|
**See also:** `axis <https://vega.github.io/vega-lite/docs/axis.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
impute : :class:`ImputeParams`
|
|
An object defining the properties of the Impute Operation to be applied.
|
|
The field value of the other positional channel is taken as ``key`` of the
|
|
``Impute`` Operation.
|
|
The field of the ``color`` channel if specified is used as ``groupby`` of the
|
|
``Impute`` Operation.
|
|
|
|
**See also:** `impute <https://vega.github.io/vega-lite/docs/impute.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
stack : anyOf(:class:`StackOffset`, None, boolean)
|
|
Type of stacking offset if the field should be stacked.
|
|
``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains.
|
|
For example, ``stack`` of ``y`` can be used to customize stacking for a vertical bar
|
|
chart.
|
|
|
|
``stack`` can be one of the following values:
|
|
|
|
|
|
* ``"zero"`` or `true`: stacking with baseline offset at zero value of the scale
|
|
(for creating typical stacked
|
|
[bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and `area
|
|
<https://vega.github.io/vega-lite/docs/stack.html#area>`__ chart).
|
|
* ``"normalize"`` - stacking with normalized domain (for creating `normalized
|
|
stacked bar and area charts
|
|
<https://vega.github.io/vega-lite/docs/stack.html#normalized>`__.
|
|
:raw-html:`<br/>`
|
|
- ``"center"`` - stacking with center baseline (for `streamgraph
|
|
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`__ ).
|
|
* ``null`` or ``false`` - No-stacking. This will produce layered `bar
|
|
<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`__ and area
|
|
chart.
|
|
|
|
**Default value:** ``zero`` for plots with all of the following conditions are true:
|
|
(1) the mark is ``bar`` or ``area`` ;
|
|
(2) the stacked measure channel (x or y) has a linear scale;
|
|
(3) At least one of non-position channels mapped to an unaggregated field that is
|
|
different from x and y. Otherwise, ``null`` by default.
|
|
|
|
**See also:** `stack <https://vega.github.io/vega-lite/docs/stack.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "x"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined,
|
|
field=Undefined, impute=Undefined, scale=Undefined, sort=Undefined, stack=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(X, self).__init__(shorthand=shorthand, aggregate=aggregate, axis=axis, bin=bin,
|
|
field=field, impute=impute, scale=scale, sort=sort, stack=stack,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class XValue(ValueChannelMixin, core.XValueDef):
|
|
"""XValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : anyOf(float, enum('width'))
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "x"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(XValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class X2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""X2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "x2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(X2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class X2Value(ValueChannelMixin, core.XValueDef):
|
|
"""X2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : anyOf(float, enum('width'))
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "x2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(X2Value, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class XError(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""XError schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "xError"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(XError, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class XErrorValue(ValueChannelMixin, core.NumberValueDef):
|
|
"""XErrorValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "xError"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(XErrorValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class XError2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""XError2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "xError2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(XError2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class XError2Value(ValueChannelMixin, core.NumberValueDef):
|
|
"""XError2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "xError2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(XError2Value, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Y(FieldChannelMixin, core.PositionFieldDef):
|
|
"""Y schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
axis : anyOf(:class:`Axis`, None)
|
|
An object defining properties of axis's gridlines, ticks and labels.
|
|
If ``null``, the axis for the encoding channel will be removed.
|
|
|
|
**Default value:** If undefined, default `axis properties
|
|
<https://vega.github.io/vega-lite/docs/axis.html>`__ are applied.
|
|
|
|
**See also:** `axis <https://vega.github.io/vega-lite/docs/axis.html>`__
|
|
documentation.
|
|
bin : anyOf(boolean, :class:`BinParams`, enum('binned'), None)
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
impute : :class:`ImputeParams`
|
|
An object defining the properties of the Impute Operation to be applied.
|
|
The field value of the other positional channel is taken as ``key`` of the
|
|
``Impute`` Operation.
|
|
The field of the ``color`` channel if specified is used as ``groupby`` of the
|
|
``Impute`` Operation.
|
|
|
|
**See also:** `impute <https://vega.github.io/vega-lite/docs/impute.html>`__
|
|
documentation.
|
|
scale : anyOf(:class:`Scale`, None)
|
|
An object defining properties of the channel's scale, which is the function that
|
|
transforms values in the data domain (numbers, dates, strings, etc) to visual values
|
|
(pixels, colors, sizes) of the encoding channels.
|
|
|
|
If ``null``, the scale will be `disabled and the data value will be directly encoded
|
|
<https://vega.github.io/vega-lite/docs/scale.html#disable>`__.
|
|
|
|
**Default value:** If undefined, default `scale properties
|
|
<https://vega.github.io/vega-lite/docs/scale.html>`__ are applied.
|
|
|
|
**See also:** `scale <https://vega.github.io/vega-lite/docs/scale.html>`__
|
|
documentation.
|
|
sort : :class:`Sort`
|
|
Sort order for the encoded field.
|
|
|
|
For continuous fields (quantitative or temporal), ``sort`` can be either
|
|
``"ascending"`` or ``"descending"``.
|
|
|
|
For discrete fields, ``sort`` can be one of the following:
|
|
|
|
|
|
* ``"ascending"`` or ``"descending"`` -- for sorting by the values' natural order in
|
|
Javascript.
|
|
* `A sort-by-encoding definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding>`__ for sorting
|
|
by another encoding channel. (This type of sort definition is not available for
|
|
``row`` and ``column`` channels.)
|
|
* `A sort field definition
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-field>`__ for sorting by
|
|
another field.
|
|
* `An array specifying the field values in preferred order
|
|
<https://vega.github.io/vega-lite/docs/sort.html#sort-array>`__. In this case, the
|
|
sort order will obey the values in the array, followed by any unspecified values
|
|
in their original order. For discrete time field, values in the sort array can be
|
|
`date-time definition objects <types#datetime>`__. In addition, for time units
|
|
``"month"`` and ``"day"``, the values can be the month or day names (case
|
|
insensitive) or their 3-letter initials (e.g., ``"Mon"``, ``"Tue"`` ).
|
|
* ``null`` indicating no sort.
|
|
|
|
**Default value:** ``"ascending"``
|
|
|
|
**Note:** ``null`` is not supported for ``row`` and ``column``.
|
|
|
|
**See also:** `sort <https://vega.github.io/vega-lite/docs/sort.html>`__
|
|
documentation.
|
|
stack : anyOf(:class:`StackOffset`, None, boolean)
|
|
Type of stacking offset if the field should be stacked.
|
|
``stack`` is only applicable for ``x`` and ``y`` channels with continuous domains.
|
|
For example, ``stack`` of ``y`` can be used to customize stacking for a vertical bar
|
|
chart.
|
|
|
|
``stack`` can be one of the following values:
|
|
|
|
|
|
* ``"zero"`` or `true`: stacking with baseline offset at zero value of the scale
|
|
(for creating typical stacked
|
|
[bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and `area
|
|
<https://vega.github.io/vega-lite/docs/stack.html#area>`__ chart).
|
|
* ``"normalize"`` - stacking with normalized domain (for creating `normalized
|
|
stacked bar and area charts
|
|
<https://vega.github.io/vega-lite/docs/stack.html#normalized>`__.
|
|
:raw-html:`<br/>`
|
|
- ``"center"`` - stacking with center baseline (for `streamgraph
|
|
<https://vega.github.io/vega-lite/docs/stack.html#streamgraph>`__ ).
|
|
* ``null`` or ``false`` - No-stacking. This will produce layered `bar
|
|
<https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart>`__ and area
|
|
chart.
|
|
|
|
**Default value:** ``zero`` for plots with all of the following conditions are true:
|
|
(1) the mark is ``bar`` or ``area`` ;
|
|
(2) the stacked measure channel (x or y) has a linear scale;
|
|
(3) At least one of non-position channels mapped to an unaggregated field that is
|
|
different from x and y. Otherwise, ``null`` by default.
|
|
|
|
**See also:** `stack <https://vega.github.io/vega-lite/docs/stack.html>`__
|
|
documentation.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
type : :class:`StandardType`
|
|
The encoded field's type of measurement ( ``"quantitative"``, ``"temporal"``,
|
|
``"ordinal"``, or ``"nominal"`` ).
|
|
It can also be a ``"geojson"`` type for encoding `'geoshape'
|
|
<https://vega.github.io/vega-lite/docs/geoshape.html>`__.
|
|
|
|
**Note:**
|
|
|
|
|
|
* Data values for a temporal field can be either a date-time string (e.g.,
|
|
``"2015-03-07 12:32:17"``, ``"17:01"``, ``"2015-03-16"``. ``"2015"`` ) or a
|
|
timestamp number (e.g., ``1552199579097`` ).
|
|
* Data ``type`` describes the semantics of the data rather than the primitive data
|
|
types ( ``number``, ``string``, etc.). The same primitive data type can have
|
|
different types of measurement. For example, numeric data can represent
|
|
quantitative, ordinal, or nominal data.
|
|
* When using with `bin <https://vega.github.io/vega-lite/docs/bin.html>`__, the
|
|
``type`` property can be either ``"quantitative"`` (for using a linear bin scale)
|
|
or `"ordinal" (for using an ordinal bin scale)
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `timeUnit
|
|
<https://vega.github.io/vega-lite/docs/timeunit.html>`__, the ``type`` property
|
|
can be either ``"temporal"`` (for using a temporal scale) or `"ordinal" (for using
|
|
an ordinal scale) <https://vega.github.io/vega-lite/docs/type.html#cast-bin>`__.
|
|
* When using with `aggregate
|
|
<https://vega.github.io/vega-lite/docs/aggregate.html>`__, the ``type`` property
|
|
refers to the post-aggregation data type. For example, we can calculate count
|
|
``distinct`` of a categorical field ``"cat"`` using ``{"aggregate": "distinct",
|
|
"field": "cat", "type": "quantitative"}``. The ``"type"`` of the aggregate output
|
|
is ``"quantitative"``.
|
|
* Secondary channels (e.g., ``x2``, ``y2``, ``xError``, ``yError`` ) do not have
|
|
``type`` as they have exactly the same type as their primary channels (e.g.,
|
|
``x``, ``y`` ).
|
|
|
|
**See also:** `type <https://vega.github.io/vega-lite/docs/type.html>`__
|
|
documentation.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "y"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, axis=Undefined, bin=Undefined,
|
|
field=Undefined, impute=Undefined, scale=Undefined, sort=Undefined, stack=Undefined,
|
|
timeUnit=Undefined, title=Undefined, type=Undefined, **kwds):
|
|
super(Y, self).__init__(shorthand=shorthand, aggregate=aggregate, axis=axis, bin=bin,
|
|
field=field, impute=impute, scale=scale, sort=sort, stack=stack,
|
|
timeUnit=timeUnit, title=title, type=type, **kwds)
|
|
|
|
|
|
class YValue(ValueChannelMixin, core.YValueDef):
|
|
"""YValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : anyOf(float, enum('height'))
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "y"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(YValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class Y2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""Y2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "y2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(Y2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class Y2Value(ValueChannelMixin, core.YValueDef):
|
|
"""Y2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : anyOf(float, enum('height'))
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "y2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(Y2Value, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class YError(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""YError schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "yError"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(YError, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class YErrorValue(ValueChannelMixin, core.NumberValueDef):
|
|
"""YErrorValue schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "yError"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(YErrorValue, self).__init__(value=value, **kwds)
|
|
|
|
|
|
class YError2(FieldChannelMixin, core.SecondaryFieldDef):
|
|
"""YError2 schema wrapper
|
|
|
|
Mapping(required=[shorthand])
|
|
A field definition of a secondary channel that shares a scale with another primary channel.
|
|
For example, ``x2``, ``xError`` and ``xError2`` share the same scale with ``x``.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
shorthand : string
|
|
shorthand for field, aggregate, and type
|
|
aggregate : :class:`Aggregate`
|
|
Aggregation function for the field
|
|
(e.g., ``mean``, ``sum``, ``median``, ``min``, ``max``, ``count`` ).
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `aggregate <https://vega.github.io/vega-lite/docs/aggregate.html>`__
|
|
documentation.
|
|
bin : None
|
|
A flag for binning a ``quantitative`` field, `an object defining binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html#params>`__, or indicating that the
|
|
data for ``x`` or ``y`` channel are binned before they are imported into Vega-Lite (
|
|
``"binned"`` ).
|
|
|
|
|
|
If ``true``, default `binning parameters
|
|
<https://vega.github.io/vega-lite/docs/bin.html>`__ will be applied.
|
|
|
|
If ``"binned"``, this indicates that the data for the ``x`` (or ``y`` ) channel are
|
|
already binned. You can map the bin-start field to ``x`` (or ``y`` ) and the bin-end
|
|
field to ``x2`` (or ``y2`` ). The scale and axis will be formatted similar to
|
|
binning in Vega-lite. To adjust the axis ticks based on the bin step, you can also
|
|
set the axis's `tickMinStep
|
|
<https://vega.github.io/vega-lite/docs/axis.html#ticks>`__ property.
|
|
|
|
**Default value:** ``false``
|
|
|
|
**See also:** `bin <https://vega.github.io/vega-lite/docs/bin.html>`__
|
|
documentation.
|
|
field : :class:`Field`
|
|
**Required.** A string defining the name of the field from which to pull a data
|
|
value
|
|
or an object defining iterated values from the `repeat
|
|
<https://vega.github.io/vega-lite/docs/repeat.html>`__ operator.
|
|
|
|
**See also:** `field <https://vega.github.io/vega-lite/docs/field.html>`__
|
|
documentation.
|
|
|
|
**Notes:**
|
|
1) Dots ( ``.`` ) and brackets ( ``[`` and ``]`` ) can be used to access nested
|
|
objects (e.g., ``"field": "foo.bar"`` and ``"field": "foo['bar']"`` ).
|
|
If field names contain dots or brackets but are not nested, you can use ``\\`` to
|
|
escape dots and brackets (e.g., ``"a\\.b"`` and ``"a\\[0\\]"`` ).
|
|
See more details about escaping in the `field documentation
|
|
<https://vega.github.io/vega-lite/docs/field.html>`__.
|
|
2) ``field`` is not required if ``aggregate`` is ``count``.
|
|
timeUnit : :class:`TimeUnit`
|
|
Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours`` ) for a temporal
|
|
field.
|
|
or `a temporal field that gets casted as ordinal
|
|
<https://vega.github.io/vega-lite/docs/type.html#cast>`__.
|
|
|
|
**Default value:** ``undefined`` (None)
|
|
|
|
**See also:** `timeUnit <https://vega.github.io/vega-lite/docs/timeunit.html>`__
|
|
documentation.
|
|
title : anyOf(string, None)
|
|
A title for the field. If ``null``, the title will be removed.
|
|
|
|
**Default value:** derived from the field's name and transformation function (
|
|
``aggregate``, ``bin`` and ``timeUnit`` ). If the field has an aggregate function,
|
|
the function is displayed as part of the title (e.g., ``"Sum of Profit"`` ). If the
|
|
field is binned or has a time unit applied, the applied function is shown in
|
|
parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"`` ).
|
|
Otherwise, the title is simply the field name.
|
|
|
|
**Notes** :
|
|
|
|
1) You can customize the default field title format by providing the `fieldTitle
|
|
<https://vega.github.io/vega-lite/docs/config.html#top-level-config>`__ property in
|
|
the `config <https://vega.github.io/vega-lite/docs/config.html>`__ or `fieldTitle
|
|
function via the compile function's options
|
|
<https://vega.github.io/vega-lite/docs/compile.html#field-title>`__.
|
|
|
|
2) If both field definition's ``title`` and axis, header, or legend ``title`` are
|
|
defined, axis/header/legend title will be used.
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "yError2"
|
|
|
|
def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, field=Undefined,
|
|
timeUnit=Undefined, title=Undefined, **kwds):
|
|
super(YError2, self).__init__(shorthand=shorthand, aggregate=aggregate, bin=bin, field=field,
|
|
timeUnit=timeUnit, title=title, **kwds)
|
|
|
|
|
|
class YError2Value(ValueChannelMixin, core.NumberValueDef):
|
|
"""YError2Value schema wrapper
|
|
|
|
Mapping(required=[value])
|
|
Definition object for a constant value of an encoding channel.
|
|
|
|
Attributes
|
|
----------
|
|
|
|
value : float
|
|
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
|
|
between ``0`` to ``1`` for opacity).
|
|
"""
|
|
_class_is_valid_at_instantiation = False
|
|
_encoding_name = "yError2"
|
|
|
|
def __init__(self, value, **kwds):
|
|
super(YError2Value, self).__init__(value=value, **kwds)
|