Movatterモバイル変換


[0]ホーム

URL:


  • Overview
  • View Specification
  • Data / Datasets
  • Transform
  • Mark
  • Encoding
  • Projection
  • View Composition
  • Parameter
  • Config

  • Property Types
  • Tooltip
  • Invalid Data
  • Encoding

    Edit this page

    An integral part of the data visualization process is encoding data with visual properties of graphical marks. Theencoding property of a single view specification represents the mapping betweenencoding channels (such asx,y, orcolor) anddata fields, constantvisual values, or constantdata values (datum).

    // Specification of a Single View{  "data": ... ,  "mark": ... ,  "encoding": {     // Encoding    // Position Channels    "x": ...,    "y": ...,    "x2": ...,    "y2": ...,    "xError": ...,    "yError": ...,    "xError2": ...,    "yError2": ...,    // Polar Position Channels    "theta": ...,    "radius": ...,    "theta2": ...,    "radius2": ...,    // Geographic Position Channels    "longitude": ...,    "latitude": ...,    "longitude2": ...,    "latitude2": ...,    // Mark Properties Channels    "color": ...,    "opacity": ...,    "fillOpacity": ...,    "strokeOpacity": ...,    "strokeWidth": ...,    "strokeDash": ...,    "size": ...,    "angle": ...,    "shape": ...,    // Text and Tooltip Channels    "text": ...,    "tooltip": ...,    // Hyperlink Channel    "href": ...,    // Description Channel    "description": ...,    // Level of Detail Channel    "detail": ...,    // Key Channel    "key": ...,    // Order Channel    "order": ...,    // Facet Channels    "facet": ...,    "row": ...,    "column": ...  },  ...}

    Encoding Channels

    The keys in theencoding object are encoding channels. Vega-Lite supports the following groups of encoding channels

    Channel Definition

    Each channel definition object must be one of the following:

    Field Definition

    // Specification of a Single View{  ...,  "encoding": {     // Encoding    ...: {      "field": ...,      "type": ...,      ...    },    ...  },  ...}

    To encode a particular field in the data set with an encoding channel, the channel’s field definition must describe thefield name and its datatype. To facilitate data exploration, Vega-Lite also provides inline field transforms (aggregate,bin,sort,stack, andtimeUnit) as a part of a field definition in addition to the top-leveltransform.

    All field definitions support the following properties:

    PropertyTypeDescription
    fieldField

    Required. A string defining the name of the field from which to pull a data value or an object defining iterated values from therepeat operator.

    See also:field 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 thefield documentation. 2)field is not required ifaggregate iscount.

    typeString

    The type of measurement ("quantitative","temporal","ordinal", or"nominal") for the encoded field or constant value (datum). It can also be a"geojson" type for encoding‘geoshape’.

    Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: (1) the field is not nominal and the field encoding has no specifiedaggregate (exceptargmin andargmax),bin, scale type, customsort order, nortimeUnit or (2) if you wish to use an ordinal scale for a field withbin ortimeUnit.

    Default value:

    1) For a datafield,"nominal" is the default data type unless the field encoding hasaggregate,channel,bin, scale type,sort, ortimeUnit that satisfies the following criteria:

    • "quantitative" is the default type if (1) the encoded field containsbin oraggregate except"argmin" and"argmax", (2) the encoding channel islatitude orlongitude channel or (3) if the specified scale type isa quantitative scale.
    • "temporal" is the default type if (1) the encoded field containstimeUnit or (2) the specified scale type is a time or utc scale
    • "ordinal" is the default type if (1) the encoded field contains acustomsort order, (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel isorder.

    2) For a constant value in data domain (datum):

    • "quantitative" if the datum is a number
    • "nominal" if the datum is a string
    • "temporal" if the datum isa date time object

    Note:

    • Datatype 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.
    • 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).
    • When using withbin, thetype property can be either"quantitative" (for using a linear bin scale) or"ordinal" (for using an ordinal bin scale).
    • When using withtimeUnit, thetype property can be either"temporal" (default, for using a temporal scale) or"ordinal" (for using an ordinal scale).
    • When using withaggregate, thetype property refers to the post-aggregation data type. For example, we can calculate countdistinct of a categorical field"cat" using{"aggregate": "distinct", "field": "cat"}. The"type" of the aggregate output is"quantitative".
    • Secondary channels (e.g.,x2,y2,xError,yError) do not havetype as they must have exactly the same type as their primary channels (e.g.,x,y).

    See also:type documentation.

    binBoolean |BinParams | String | Null

    A flag for binning aquantitative field,an object defining binning parameters, or indicating that the data forx ory channel are binned before they are imported into Vega-Lite ("binned").

    • Iftrue, defaultbinning parameters will be applied.

    • If"binned", this indicates that the data for thex (ory) channel are already binned. You can map the bin-start field tox (ory) and the bin-end field tox2 (ory2). 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’stickMinStep property.

    Default value:false

    See also:bin documentation.

    timeUnitTimeUnit | String |TimeUnitParams

    Time unit (e.g.,year,yearmonth,month,hours) for a temporal field. ora temporal field that gets casted as ordinal.

    Default value:undefined (None)

    See also:timeUnit documentation.

    aggregateAggregate

    Aggregation function for the field (e.g.,"mean","sum","median","min","max","count").

    Default value:undefined (None)

    See also:aggregate documentation.

    bandAny
    titleText | Null

    A title for the field. Ifnull, the title will be removed.

    Default value: derived from the field’s name and transformation function (aggregate,bin andtimeUnit). 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 thefieldTitle property in theconfig orfieldTitle function via thecompile function’s options.

    2) If both field definition’stitle and axis, header, or legendtitle are defined, axis/header/legend title will be used.

    In addition, field definitions for different encoding channels may support the following properties:

    To see a list of additional properties for each type of encoding channels, please see the specific sections forposition,mark property,text and tooltip,detail,order, andfacet channels.

    Value Definition

    // Specification of a Single View{  ...,  "encoding": {     // Encoding    ...: {      "value": ...    },    ...  },  ...}

    To map a constant visual value to an encoding channel, the channel’s value definition must describe thevalue property. (See thevalue page for more examples.)

    Datum Definition

    // Specification of a Single View{  ...,  "encoding": {     // Encoding    ...: {      "datum": ...    },    ...  },  ...}

    To map a constant data value (datum) via a scale to an encoding channel, the channel’s value definition must describe thedatum property. (See thedatum page for more examples.)

    PropertyTypeDescription
    datumPrimitiveValue |DateTime |ExprRef |RepeatRef

    A constant value in data domain.

    Similar to a field definition, datum definition of different encoding channels may supportband,scale,axis,legend,format, orcondition properties. However, data transforms (aggregate,bin,timeUnit,sort cannot be applied to a datum definition).

    Position Channels

    x andy position channels determine the position of the marks, or width/height of horizontal/vertical"area" and"bar". In addition,x2 andy2 can specify the span of rangedarea,bar,rect, andrule.

    By default, Vega-Lite automatically generates ascale and anaxis for each field mapped to a position channel. If unspecified, properties of scales and axes are determined based on a set of rules by the compiler.scale andaxis properties of the field definition can be used to customize their properties.

    PropertyTypeDescription
    xPositionDef

    X coordinates of the marks, or width of horizontal"bar" and"area" without specifiedx2 orwidth.

    Thevalue of this channel can be a number or a string"width" for the width of the plot.

    yPositionDef

    Y coordinates of the marks, or height of vertical"bar" and"area" without specifiedy2 orheight.

    Thevalue of this channel can be a number or a string"height" for the height of the plot.

    x2Position2Def

    X2 coordinates for ranged"area","bar","rect", and"rule".

    Thevalue of this channel can be a number or a string"width" for the width of the plot.

    y2Position2Def

    Y2 coordinates for ranged"area","bar","rect", and"rule".

    Thevalue of this channel can be a number or a string"height" for the height of the plot.

    Position Field Definition and Datum Definition

    In addition to the generalfield definition properties, field definitions forx andy channels may include the properties listed below. Similarly,datum definitions forx andy channels also support these properties.

    PropertyTypeDescription
    scaleScale | Null

    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.

    Ifnull, the scale will bedisabled and the data value will be directly encoded.

    Default value: If undefined, defaultscale properties are applied.

    See also:scale documentation.

    axisAxis | Null

    An object defining properties of axis’s gridlines, ticks and labels. Ifnull, the axis for the encoding channel will be removed.

    Default value: If undefined, defaultaxis properties are applied.

    See also:axis documentation.

    sortSort

    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:

    Default value:"ascending"

    Note:null and sorting by another channel is not supported forrow andcolumn.

    See also:sort documentation.

    imputeImputeParams | Null

    An object defining the properties of the Impute Operation to be applied. The field value of the other positional channel is taken askey of theImpute Operation. The field of thecolor channel if specified is used asgroupby of theImpute Operation.

    See also:impute documentation.

    stackString | Null | Boolean

    Type of stacking offset if the field should be stacked.stack is only applicable forx,y,theta, andradius channels with continuous domains. For example,stack ofy can be used to customize stacking for a vertical bar chart.

    stack can be one of the following values:

    Default value:zero for plots with all of the following conditions are true: (1) the mark isbar,area, orarc; (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 documentation.

    Note:x2 andy2 do not have their own definitions forscale,axis,sort, andstack since they share the same scales and axes withx andy respectively.

    Position Offset Channels

    xOffset andyOffset position channels determine additional offset to thex ory position.

    Position Offset Field Definition and Datum Definition

    In addition to the generalfield definition properties, field definitions forxOffset andyOffset channels may include the properties listed below. Similarly,datum definitions forx andy channels also support these properties.

    PropertyTypeDescription
    scaleScale | Null

    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.

    Ifnull, the scale will bedisabled and the data value will be directly encoded.

    Default value: If undefined, defaultscale properties are applied.

    See also:scale documentation.

    sortSort

    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:

    Default value:"ascending"

    Note:null and sorting by another channel is not supported forrow andcolumn.

    See also:sort documentation.

    Example: Grouped Bar Chart

    Note: Readhere for more details about how to set step size for offset scale.

    Example: Jittering

    Polar Position Channels

    theta andradius position channels determine the position or interval on polar coordinates forarc andtext marks.

    PropertyTypeDescription
    thetaPolarDef
    • For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)

    • For text marks, polar coordinate angle in radians.

    radiusPolarDef

    The outer radius in pixels of arc marks.

    theta2Position2Def

    The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.

    radius2Position2Def

    The inner radius in pixels of arc marks.

    Polar Field Definition and Datum Definition

    Polar field and datum definitions may includescale,stack, andsort properties, similar toposition field and datum definitions.

    Geographic Position Channels

    longitude andlatitude channels can be used to encode geographic coordinate data via aprojection. In addition,longitude2 andlatitude2 can specify the span of geographically projected rangedarea,bar,rect, andrule.

    PropertyTypeDescription
    longitudeLatLongDef

    Longitude position of geographically projected marks.

    latitudeLatLongDef

    Latitude position of geographically projected marks.

    longitude2Position2Def

    Longitude-2 position for geographically projected ranged"area","bar","rect", and"rule".

    latitude2Position2Def

    Latitude-2 position for geographically projected ranged"area","bar","rect", and"rule".

    Seean example that useslongitude andlatitude channels in a map oranother example that draws line segments (rules) between points in a map.

    Mark Property Channels

    Mark properties channels map data fields to visual properties of the marks. By default, Vega-Lite automatically generates a scale and a legend for each field mapped to a mark property channel. If unspecified, properties of scales and legends are determined based on a set of rules by the compiler.scale andlegend properties of the field definition can be used to customize their properties. In addition, definitions of mark property channels can include thecondition property to specify conditional logic.

    Here are the list of mark property channels:

    PropertyTypeDescription
    angleMarkPropDef

    Rotation angle of point and text marks.

    colorMarkPropDef

    Color of the marks – either fill or stroke color based on thefilled property of mark definition. By default,color represents fill color for"area","bar","tick","text","trail","circle", and"square" / stroke color for"line" and"point".

    Default value: If undefined, the default color depends onmark config’scolor property.

    Note: 1) For fine-grained control over both fill and stroke colors of the marks, please use thefill andstroke channels. Thefill orstroke encodings have higher precedence thancolor, thus may override thecolor encoding if conflicting encodings are specified. 2) See the scale documentation for more information about customizingcolor scheme.

    fillMarkPropDef

    Fill color of the marks.Default value: If undefined, the default color depends onmark config’scolor property.

    Note: Thefill encoding has higher precedence thancolor, thus may override thecolor encoding if conflicting encodings are specified.

    strokeMarkPropDef

    Stroke color of the marks.Default value: If undefined, the default color depends onmark config’scolor property.

    Note: Thestroke encoding has higher precedence thancolor, thus may override thecolor encoding if conflicting encodings are specified.

    opacityMarkPropDef

    Opacity of the marks.

    Default value: If undefined, the default opacity depends onmark config’sopacity property.

    fillOpacityMarkPropDef

    Fill opacity of the marks.

    Default value: If undefined, the default opacity depends onmark config’sfillOpacity property.

    strokeOpacityMarkPropDef

    Stroke opacity of the marks.

    Default value: If undefined, the default opacity depends onmark config’sstrokeOpacity property.

    shapeMarkPropDef

    Shape of the mark.

    1. Forpoint marks the supported values include: - plotting shapes:"circle","square","cross","diamond","triangle-up","triangle-down","triangle-right", or"triangle-left". - the line symbol"stroke" - centered directional shapes"arrow","wedge", or"triangle" - a customSVG path string (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)

    2. Forgeoshape marks it should be a field definition of the geojson data

    Default value: If undefined, the default shape depends onmark config’sshape property. ("circle" if unset.)

    sizeMarkPropDef

    Size of the mark.

    • For"point","square" and"circle", – the symbol size, or pixel area of the mark.
    • For"bar" and"tick" – the bar and tick’s size.
    • For"text" – the text’s font size.
    • Size is unsupported for"line","area", and"rect". (Use"trail" instead of line with varying size)
    strokeDashNumericArrayMarkPropDef

    Stroke dash of the marks.

    Default value:[1,0] (No dash).

    strokeWidthMarkPropDef

    Stroke width of the marks.

    Default value: If undefined, the default stroke width depends onmark config’sstrokeWidth property.

    Mark Property Field Definition and Datum Definition

    Field definitions for mark property channels may also include the properties list below (in addition tofield,type,bin,timeUnit andaggregate).

    Similarly,datum definitions for mark property channels also support these properties.

    PropertyTypeDescription
    scaleScale | Null

    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.

    Ifnull, the scale will bedisabled and the data value will be directly encoded.

    Default value: If undefined, defaultscale properties are applied.

    See also:scale documentation.

    legendLegend | Null

    An object defining properties of the legend. Ifnull, the legend for the encoding channel will be removed.

    Default value: If undefined, defaultlegend properties are applied.

    See also:legend documentation.

    conditionConditionalValueDef |ConditionalValueDef[]

    One or more value definition(s) witha parameter or a test predicate.

    Note: A field definition’scondition property can only containconditional value definitions since Vega-Lite only allows at most one encoded field per encoding channel.

    Mark Property Value Definition

    In addition to the constantvalue,value definitions of mark properties channels can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionConditionalFieldDef |ConditionalValueDef |ConditionalValueDef[]

    A field definition or one or more value definition(s) with a parameter predicate.

    Seethecondition page for examples how to specify condition logic.

    Text and Tooltip Channels

    Text and tooltip channels directly encode text values of the data fields. By default, Vega-Lite automatically determines appropriate format for quantitative and temporal values. Users can setformat property to customize text and time format. Similar to mark property channels, definitions of text and tooltip channels can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    textTextFieldDef

    Text of thetext mark.

    tooltipStringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | Null

    The tooltip text to show upon mouse hover. Specifyingtooltip encoding overridesthetooltip property in the mark definition.

    See thetooltip documentation for a detailed discussion about tooltip in Vega-Lite.

    Text and Tooltip Field Definition

    In addition to the generalfield definition properties, field definitions fortext andtooltip channels may also include these properties:

    PropertyTypeDescription
    formatFormat

    The text format specifier for formatting number and date/time in labels of guides (axes, legends, headers) and text marks.

    If the format type is"number" (e.g., for quantitative fields), this is a D3’snumber format pattern string.

    If the format type is"time" (e.g., for temporal fields), this is either: a) D3’stime format pattern if you desire to set a static time format.

    b)dynamic time format specifier object if you desire to set a dynamic time format that uses different formats depending on the granularity of the input date (e.g., if the date lies on a year, month, date, hour, etc. boundary).

    When used with acustomformatType, this value will be passed asformat alongsidedatum.value to the registered function.

    Default value: Derived fromnumberFormat config for number format and fromtimeFormat config for time format.

    formatTypeString

    The format type for labels. One of"number","time", or aregistered custom format type.

    Default value:

    • "time" for temporal fields and ordinal and nominal fields withtimeUnit.
    • "number" for quantitative fields as well as ordinal and nominal fields withouttimeUnit.
    conditionConditionalValueDef |ConditionalValueDef[]

    One or more value definition(s) witha parameter or a test predicate.

    Note: A field definition’scondition property can only containconditional value definitions since Vega-Lite only allows at most one encoded field per encoding channel.

    Text and Tooltip Value Definition

    In addition to the constantvalue,value definitions oftext andtooltip channels can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionConditionalStringFieldDef |ConditionalValueDef |ConditionalValueDef[]

    A field definition or one or more value definition(s) with a parameter predicate.

    Multiple Field Definitions for Tooltips

    Similar todetail, you can use an array of field definitions. Vega-Lite will display a tooltip with multiple fields.Vega tooltip will display a table that shows the name of the field and its value. See thetooltip page for details.

    Hyperlink Channel

    By setting thehref channel, a mark becomes a hyperlink. The specified URL is loaded upon a mouse click. When thehref channel is specified, thecursor mark property is set to"pointer" by default to serve as affordance for hyperlinks.

    PropertyTypeDescription
    hrefStringFieldDefWithCondition | StringValueDefWithCondition

    A URL to load upon mouse click.

    Hyperlink Field Definition

    In addition to the generalfield definition properties, field definitions for thehref channel can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionAny

    The example below shows how the href channel can be used to provide links to external resources with more details.

    Hyperlink Value Definition

    In addition to the constantvalue,value definitions of thehref channel can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionConditionalStringFieldDef |ConditionalValueDef |ConditionalValueDef[]

    A field definition or one or more value definition(s) with a parameter predicate.

    Description Channel

    By setting thedescription channel, you can add a text description to the mark for ARIA accessibility (SVG output only). The"aria-label" attribute in the generated SVG will be set to this description.

    By default, Vega-Lite generates a description based on the encoding similar todefault tooltips. To disable automatic descriptions, setconfig.aria to false. No description will be generated ifmark.aria is set to false.

    PropertyTypeDescription
    descriptionStringFieldDefWithCondition | StringValueDefWithCondition

    A text description of this mark for ARIA accessibility (SVG output only). For SVG output the"aria-label" attribute will be set to this description.

    Description Field Definition

    In addition to the generalfield definition properties, field definitions for thedescription channel can include these properties:

    PropertyTypeDescription
    formatFormat

    The text format specifier for formatting number and date/time in labels of guides (axes, legends, headers) and text marks.

    If the format type is"number" (e.g., for quantitative fields), this is a D3’snumber format pattern string.

    If the format type is"time" (e.g., for temporal fields), this is either: a) D3’stime format pattern if you desire to set a static time format.

    b)dynamic time format specifier object if you desire to set a dynamic time format that uses different formats depending on the granularity of the input date (e.g., if the date lies on a year, month, date, hour, etc. boundary).

    When used with acustomformatType, this value will be passed asformat alongsidedatum.value to the registered function.

    Default value: Derived fromnumberFormat config for number format and fromtimeFormat config for time format.

    formatTypeString

    The format type for labels. One of"number","time", or aregistered custom format type.

    Default value:

    • "time" for temporal fields and ordinal and nominal fields withtimeUnit.
    • "number" for quantitative fields as well as ordinal and nominal fields withouttimeUnit.
    conditionConditionalValueDef |ConditionalValueDef[]

    One or more value definition(s) witha parameter or a test predicate.

    Note: A field definition’scondition property can only containconditional value definitions since Vega-Lite only allows at most one encoded field per encoding channel.

    Description Value Definition

    In addition to the constantvalue,value definitions of thedescription channel can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionConditionalStringFieldDef |ConditionalValueDef |ConditionalValueDef[]

    A field definition or one or more value definition(s) with a parameter predicate.

    Level of Detail Channel

    Grouping data is another important operation in data visualization. For line and area marks, mapping a unaggregated data field (field withoutaggregate function) to any non-position channel will group the lines and stacked areas by the field. Foraggregated plots, all unaggregated fields encoded are used as grouping fields in the aggregation (similar to fields inGROUP BY in SQL).

    detail channel specify an additional grouping field (or fields) for grouping data without mapping the field(s) to any visual properties.

    PropertyTypeDescription
    detailFieldDef |FieldDef[]

    Additional levels of detail for grouping data in aggregate views and in line, trail, and area marks without mapping data to a specific visual channel.

    Examples

    Here is a scatterplot showing average horsepower and displacement for cars from different origins. We mapOrigin todetail channel to use the field as a group-by field without mapping it to visual properties of the marks.

    Here is a line chart showing stock prices of 5 tech companies over time. We mapsymbol variable (stock market ticker symbol) todetail to use them to group lines.

    Here is a ranged dot plot showing life expectancy change in the five largest countries between 1955 and 2000. We usedetail here to group the lines such that they range only from one year to another within a country (as opposed to jumping between countries as well).

    Key Channel

    The key channel can enable object constancy for transitions over dynamic data. When a visualization’s data is updated (viaVega’s View API), the key value will be used to match data elements to existing mark instances.

    PropertyTypeDescription
    keyFieldDef

    A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.

    Order Channel

    order channel can define a data field (or a ordered list of data fields) that are used to sorts stacking order for stacked charts (seean example in thestack page), the order of data points in line marks for connected scatterplots (seean example in theline page), and which data points are plotted on top in a chart (the “zorder”, seean example in the gallery).

    PropertyTypeDescription
    orderOrderFieldDef |OrderFieldDef[] | OrderValueDef | OrderOnlyDef

    Order of the marks.

    • For stacked marks, thisorder channel encodesstack order.
    • For line and trail marks, thisorder channel encodes order of data points in the lines. This can be useful for creatinga connected scatterplot. Settingorder to{"value": null} makes the line marks use the original order in the data sources.
    • Otherwise, thisorder channel encodes layer order of the marks.

    Note: In aggregate plots,order field should beaggregated to avoid creating additional aggregation grouping.

    Order Field Definition

    In addition to the generalfield definition properties, field definitions for theorder channel can includesort.

    PropertyTypeDescription
    sortString

    The sort order. One of"ascending" (default) or"descending".

    Order Value Definition

    In addition to the constantvalue,value definitions of theorder channel can include thecondition property to specify conditional logic.

    PropertyTypeDescription
    conditionConditionalValueDef |ConditionalValueDef[]

    One or more value definition(s) witha parameter or a test predicate.

    Note: A field definition’scondition property can only containconditional value definitions since Vega-Lite only allows at most one encoded field per encoding channel.

    Facet Channels

    facet,row andcolumn are special encoding channels that facets single plots intotrellis plots (or small multiples).

    PropertyTypeDescription
    facetFacetFieldDef

    A field definition for the (flexible) facet of trellis plots.

    If eitherrow orcolumn is specified, this channel will be ignored.

    rowFacetFieldDef

    A field definition for the vertical facet of trellis plots.

    columnFacetFieldDef

    A field definition for the horizontal facet of trellis plots.

    For more information, read thefacet documentation.


[8]ページ先頭

©2009-2025 Movatter.jp