Movatterモバイル変換


[0]ホーム

URL:


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

  • Property Types
  • Tooltip
  • Invalid Data
  • Scale

    Edit this page

    Scales are functions that transform a domain of data values (numbers, dates, strings, etc.) to a range of visual values (pixels, colors, sizes). Internally, Vega-Lite usesVega scales, which are derived from thed3-scale library. For more background about scales, please see“Introducing d3-scale” by Mike Bostock.

    Vega-Lite automatically creates scales for fields that are mapped toposition andmark property channels. To customize the scale of a field, users can provide ascale object as a part of thefield definition to customize scale properties (e.g.,type,domain, andrange).

    // A Single View or a Layer Specification{  ...,  "mark/layer": ...,  "encoding": {    "x": {      "field": ...,      "type": ...,      "scale": {                // scale        "type": ...,        ...      },      ...    },    "y": ...,    ...  },  ...}

    Besides thescale property of each encoding channel, the top-level configuration object (config) also providesscale config (config: {scale: {...}}) for setting default scale properties for all scales.

    For more information about guides that visualize the scales, please see theaxes andlegends pages.

    Documentation Overview

    Scale Types

    Thetype property can be specified to customize the scale type.

    PropertyTypeDescription
    typeString

    The type of scale. Vega-Lite supports the following categories of scale types:

    1)Continuous Scales – mapping continuous domains to continuous output ranges ("linear","pow","sqrt","symlog","log","time","utc".

    2)Discrete Scales – mapping discrete domains to discrete ("ordinal") or continuous ("band" and"point") output ranges.

    3)Discretizing Scales – mapping continuous domains to discrete output ranges"bin-ordinal","quantile","quantize" and"threshold".

    Default value: please see thescale type table.

    By default, Vega-Lite use the following scale types for the followingdata types andencoding channels:

     Nominal / OrdinalQuantitativeBin-Quantitative1Temporal
    X, YBand /Point2LinearLinearTime
    Size, OpacityPointLinearLinearTime
    ColorOrdinalLinearBin-OrdinalLinear
    ShapeOrdinalN/AN/AN/A

    1 Quantitative fields with thebin transform.2 For positional (x and y) nominal and ordinal fields,"band" scale is the default scale type forbar, image, rect, and rule marks while"point" is the default scales for all other marks.

    Scale Domains

    By default, a scale in Vega-Lite draws domain values directly from a channel’s encoded field. Users can specify thedomain property of a scale to customize its domain values. To sort the order of the domain of the encoded, thesort property of afield definition can be specified.

    PropertyTypeDescription
    domainNull[] | String[] | Number[] | Boolean[] |DateTime[] |ExprRef[] | String | ParameterExtent | DomainUnionWith |ExprRef

    Customized domain values in the form of constant values or dynamic values driven by a parameter.

    1) Constantdomain forquantitative fields can take one of the following forms:

    • A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with thedomainMid property.
    • An array with more than two entries, forPiecewise quantitative scales.
    • A string value"unaggregated", if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.

    2) Constantdomain fortemporal fields can be a two-element array with minimum and maximum values, in the form of either timestamps or theDateTime definition objects.

    3) Constantdomain forordinal andnominal fields can be an array that lists valid input values.

    4) To combine (union) specified constant domain with the field’s values,domain can be an object with aunionWith property that specify constant domain to be combined. For example,domain: {unionWith: [0, 100]} for a quantitative scale means that the scale domain always includes[0, 100], but will include other values in the fields beyond[0, 100].

    5) Domain can also takes an object defining a field or encoding of a parameter thatinteractively determines the scale domain.

    domainMaxNumber |DateTime |ExprRef

    Sets the maximum value in the scale domain, overriding thedomain property. This property is only intended for use with scales having continuous domains.

    domainMinNumber |DateTime |ExprRef

    Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.

    domainMidNumber |ExprRef

    Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint fordiverging color scales. The domainMid property is only intended for use with scales supporting continuous, piecewise domains.

    domainRawExprRef

    An expression for an array of raw values that, if non-null, directly overrides thedomain property. This is useful for supporting interactions such as panning or zooming a scale. The scale may be initially determined using a data-driven domain, then modified in response to user input by setting the rawDomain value.

    A common use case for thedomain property is to limit, for example, thex range of values to include in a plot. However, setting the domain property alone is insufficient to achieve the desired effect.

    Example: Customizing Domain for a Time Scale

    For a time scale, we can set scale domain to an arraydatetime objects, as shown below.

    Example: Clipping or Removing Unwanted Data Points

    For example, consider the line plot specification below in which thex domain is restricted to the range[300, 450].

    There are two approaches to keep the mark from being plotted outside the desiredx range of values.

    • The first one is to setclip: true in mark definition.

    • The second approach is to usetransform. Note that these two approaches have slightly different behaviors. Usingtransform removes unwanted data points, yet settingclip totrue clips the mark to be the enclosing group’s width and height.

    Example: UsingdomainRaw to bind domain interactively

    Scale Ranges

    The range of the scale represents the set of output visual values. Vega-Lite automatically determines the default range for eachencoding channel using the following rules:

    ChannelsDefault Range
    xThe range isby default[0, width].
    yThe range isby default[0, height].
    opacityDerived from thescale config’smin/maxOpacity.
    colorDerived from the followingnamed ranges based on the field’stype:
    "category" fornominal fields.
    "ordinal" forordinal fields.
    "heatmap" forquantitative andtemporal fields with"rect" marks and"ramp' for other marks.

    See thecolor scheme section for examples.
    sizeDerived from the followingnamed ranges based on themark type:
    min/maxBandSize for bar and tick.
    min/maxStrokeWidth for line and rule.
    min/maxSize for point, square, and circle
    min/maxFontSize for text
    shapeDerived from thepre-defined named range"symbol".

    To customize range values, users can directly specifyrange or specify the specialscheme property forordinal andcontinuous color scales.

    PropertyTypeDescription
    rangeString | Number[] | String[] | Number[] |ExprRef[] | FieldRange

    The range of the scale. One of:

    • A string indicating apre-defined named scale range (e.g., example,"symbol", or"diverging").

    • Forcontinuous scales, two-element array indicating minimum and maximum values, or an array with more than two entries for specifying apiecewise scale.

    • Fordiscrete anddiscretizing scales, an array of desired output values or an object with afield property representing the range values. For example, if a fieldcolor contains CSS color names, we can setrange to{field: "color"}.

    Notes:

    1) For color scales you can also specify a colorscheme instead ofrange.

    2) Any directly specifiedrange forx andy channels will be ignored. Range can be customized via the view’s correspondingsize (width andheight).

    rangeMinNumber | String |ExprRef

    Sets the minimum value in the scale range, overriding therange property or the default range. This property is only intended for use with scales having continuous ranges.

    rangeMaxNumber | String |ExprRef

    Sets the maximum value in the scale range, overriding therange property or the default range. This property is only intended for use with scales having continuous ranges.

    Example: Setting Color Range based on a Field

    In this example, we create a scale that maps the field"l" to colors specified in the field"c":

    Note: This only works if there is a 1:1 mapping between the color domain field (l) and the range field (c).

    Example: Setting Range Min/Max

    We may userangeMin if we want to override just the minimum value of the range, while keeping the default maximum value of the range.

    Similarly, we may userangeMax if we want to override just the maximum value of the range, while keeping the default minimum value of the range.

    Color Schemes

    Color schemes provide a set of named color palettes as a scale range for thecolor channel. Vega-Lite (via Vega) provides a collection of perceptually-motivated color schemes, many of which are drawn from thed3-scale,d3-scale-chromatic, andColorBrewer projects.

    By default, Vega-Lite assigns differentdefault color schemes based on the types of the encoded fields:

    There are multiple ways to customize the scale range for the color encoding channel:

    1. Set a customscheme.

    PropertyTypeDescription
    schemeColorScheme |SchemeParams |ExprRef

    A string indicating a colorscheme name (e.g.,"category10" or"blues") or ascheme parameter object.

    Discrete color schemes may be used withdiscrete ordiscretizing scales. Continuous color schemes are intended for use with color scales.

    To set a custom scheme, instead set the list of valuesas the scale range.

    For the full list of supported schemes, please refer to theVega Scheme reference.

    You can customize the scheme by referencing anexisting color scheme. For example, the following plot uses the"category20b" scheme.

    Thescheme property can also be ascheme parameter object, which contain the following properties:

    PropertyTypeDescription
    nameColorScheme

    Required. A color scheme name for ordinal scales (e.g.,"category10" or"blues").

    For the full list of supported schemes, please refer to theVega Scheme reference.

    extentNumber[]

    The extent of the color range to use. For example[0.2, 1] will rescale the color scheme such that color values in the range[0, 0.2) are excluded from the scheme.

    countNumber

    The number of colors to use in the scheme. This can be useful for scale types such as"quantize", which use the length of the scale range to determine the number of discrete bins for the scale domain.

    2. Setting therange property to an array of valid CSS color strings.

    3. Change the default color schemes using the range config.

    See therange config documentation for details.

    Common Scale Properties

    In addition totype,domain, andrange, all scales share the following properties:

    PropertyTypeDescription
    reverseBoolean |ExprRef

    If true, reverses the order of the scale range.Default value:false.

    roundBoolean |ExprRef

    Iftrue, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.

    Default value:false.

    Continuous Scales

    Continuous scales map a continuous domain (numbers or dates) to a continuous output range (pixel locations, sizes, colors). Supported continuous scale types forquantitative fields are"linear","log","pow","sqrt", and"symlog". Meanwhile, supported continuous scale types fortemporal fields are"time","utc", and"symlog".

    By default, Vega-Lite uses"linear" scales for quantitative fields and uses"time" scales for temporal fields for allencoding channels.

    In addition totype,domain, andrange, continuous scales support the following properties:

    PropertyTypeDescription
    clampBoolean |ExprRef

    Iftrue, values that exceed the data domain are clamped to either the minimum or maximum range value

    Default value: derived from thescale config’sclamp (true by default).

    interpolateString |ExprRef | ScaleInterpolateParams

    The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values includergb,hsl,hsl-long,lab,hcl,hcl-long,cubehelix andcubehelix-long (‘-long’ variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valuedtype property and an optional numericgamma property applicable to rgb and cubehelix interpolators. For more, see thed3-interpolate documentation.

    • Default value:hcl
    niceBoolean | Number | String | Object |ExprRef

    Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of[0.201479…, 0.996679…], a nice domain might be[0.2, 1.0].

    For quantitative scales such as linear,nice can be either a boolean flag or a number. Ifnice is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.

    For temporal fields with time and utc scales, thenice value can be a string indicating the desired time interval. Legal values are"millisecond","second","minute","hour","day","week","month", and"year". Alternatively,time andutc scales can accept an object-valued interval specifier of the form{"interval": "month", "step": 3}, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.

    Default value:true for unbinnedquantitative fields without explicit domain bounds;false otherwise.

    paddingNumber |ExprRef

    Forcontinuous scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the zeronicedomainMin, and domainMax properties.

    Forband scales, shortcut for settingpaddingInner andpaddingOuter to the same value.

    Forpoint scales, alias forpaddingOuter.

    Default value: Forcontinuous scales, derived from thescale config’scontinuousPadding. Forband and point scales, seepaddingInner andpaddingOuter. By default, Vega-Lite sets padding such thatwidth/height = number of unique values * step.

    zeroBoolean |ExprRef

    Iftrue, ensures that a zero baseline value is included in the scale domain.

    Default value:true for x and y channels if the quantitative field is not binned and no customdomain is provided;false otherwise.

    Note: Log, time, and utc scales do not supportzero.

    Linear Scales

    Linear scales ("linear") are quantitative scales scales that preserve proportional differences. Each range value y can be expressed as a linear function of the domain valuex:y = mx + b.

    Power Scales

    Power scales ("pow") are quantitative scales scales that apply an exponential transform to the input domain value before the output range value is computed. Each range value y can be expressed as a polynomial function of the domain valuex:y = mx^k + b, wherek is theexponent value. Power scales also support negative domain values, in which case the input value and the resulting output value are multiplied by -1.

    PropertyTypeDescription
    exponentNumber |ExprRef

    The exponent of thepow scale.

    Square Root Scales

    Square root ("sqrt") scales are a convenient shorthand for power scales with anexponent of0.5, indicating a square root transform.

    Logarithmic Scales

    Log scales ("log") are quantitative scales in which a logarithmic transform is applied to the input domain value before the output range value is computed. Log scales are particularly useful for plotting data that varies over multiple orders of magnitude. The mapping to the range value y can be expressed as a logarithmic function of the domain valuex:y = m loga(x) + b, wherea is the logarithmicbase.

    Aslog(0) = -∞, a log scale domain must be strictly-positive or strictly-negative; the domain must not include or cross zero. A log scale with a positive domain has a well-defined behavior for positive values, and a log scale with a negative domain has a well-defined behavior for negative values. (For a negative domain, input and output values are implicitly multiplied by -1.) The behavior of the scale is undefined if you run a negative value through a log scale with a positive domain or vice versa.

    PropertyTypeDescription
    baseNumber |ExprRef

    The logarithm base of thelog scale (default10).

    Example: The following plot has a logarithmic y-scale.

    Symlog Scales

    Symmetric log scales (symlog) are quantitative scales scales that provide scaling similar to log scales, but supports non-positive numbers. Symlog scales are particularly useful for plotting data that varies over multiple orders of magnitude but includes negative- or zero-valued data. For more, see“A bi-symmetric log transformation for wide-range data” by Webber for more.

    PropertyTypeDescription
    constantNumber |ExprRef

    A constant determining the slope of the symlog function around zero. Only used forsymlog scales.

    Default value:1

    Time and UTC Scales

    Time and UTC scales ("time" and"utc") arecontinuous scales with a temporal domain: values in the input domain are assumed to beDate objects or timestamps. Time scales use the current local timezone setting. UTC scales instead useCoordinated Universal Time.

    Piecewise and Diverging Scales

    We can use any types of continuous scales ("linear","pow","sqrt","log","symlog","time","utc" to create a diverging color graph by specifying a customdomain with multiple elements.

    Ifrange is specified, the number of elements inrange should match with the number of elements indomain.Diverging colorschemes are also useful as a range for a piecewise scale.

    Example

    Discrete Scales

    Discrete scales map values from a discrete domain to a discrete or continuous range.

    Ordinal Scales

    Ordinal scales ("ordinal") have a discrete domain and range. These scales function as a “lookup table” from a domain value to a range value.

    By default, Vega-Lite automatically creates ordinal scales forcolor andshape channels. For example, the following plot implicitly has two ordinal scales, which map the values of the field"Origin" to a set ofcolors and a set ofshapes.

    Therange of an ordinal scale can be an array of desired output values, which are directly mapped to elements in thedomain. Bothdomain andrange array can be re-ordered to specify the order and mapping between the domain and the output range. For ordinal color scales, a customscheme can be set as well.

    Band and Point Scales

    Band and point scales accept a discrete domain similar toordinal scales, but map this domain to a continuous, numeric output range such as pixels.

    Band scales ("band") compute the discrete output values by dividing the continuous range into uniformbands. Band scales are typically used for bar charts with an ordinal or categorical dimension.

    In addition to a standard numericalrange value (such as[0, 500]), band scales can be given a fixedstep size for each band. The actual range is then determined by both the step size and the cardinality (element count) of the input domain.

    This image from thed3-scale documentation illustrates how a band scale works:

    Point scales ("point") are a variant ofband scales where the internal band width is fixed to zero. Point scales are typically used for scatterplots with an ordinal or categorical dimension. Similar to band scales, point scalerange values may be specified using either a numerical extent ([0, 500]) or a step size ({"step": 20}).

    This image from thed3-scale documentation illustrates how a point scale works:

    By default, Vega-Lite uses band scales for nominal and ordinal fields onposition channels (x andy) ofbar orrect marks. Forx andy of other marks andsize andopacity, Vega-Lite uses point scales by default.

    For example, the following bar chart has uses a band scale for its x-position.

    To customize the step size of band scales for x/y-fields, we can set the step property of the view’swidth/height.

    For example, we can either make a bar chart have a fixed width:

    or set the width per discrete step:

    To customize the range of band and point scales, users can provide the following properties:

    PropertyTypeDescription
    alignNumber |ExprRef

    The alignment of the steps within the scale range.

    This value must lie in the range[0,1]. A value of0.5 indicates that the steps should be centered within the range. A value of0 or1 may be used to shift the bands to one side, say to position them adjacent to an axis.

    Default value:0.5

    paddingNumber |ExprRef

    Forcontinuous scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the zeronicedomainMin, and domainMax properties.

    Forband scales, shortcut for settingpaddingInner andpaddingOuter to the same value.

    Forpoint scales, alias forpaddingOuter.

    Default value: Forcontinuous scales, derived from thescale config’scontinuousPadding. Forband and point scales, seepaddingInner andpaddingOuter. By default, Vega-Lite sets padding such thatwidth/height = number of unique values * step.

    paddingInnerNumber |ExprRef

    The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].

    For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).

    Default value: derived from thescale config’sbandPaddingInner.

    paddingOuterNumber |ExprRef

    The outer padding (spacing) at the ends of the range of band and point scales, as a fraction of the step size. This value must lie in the range [0,1].

    Default value: derived from thescale config’sbandPaddingOuter for band scales andpointPadding for point scales. By default, Vega-Lite sets outer padding such thatwidth/height = number of unique values * step.

    Discretizing Scales

    Discretizing scales break up a continuous domain into discrete segments, and then map values in each segment to a range value.

    Bin-Linear Scales

    Binned linear scales ("bin-linear") are a special type of linear scale for use withbinned fields to correctly create legend labels. Vega-Litealways uses binned linear scales with binned quantitative fields on size and opacity channels.

    For example, the following plot has a binned field on thesize channel.

    Bin-Ordinal Scales

    Binned ordinal scales ("bin-ordinal") are a special type of ordinal scale for use withbinned fields to correctly create legend labels. Vega-Litealways uses binned ordinal scales with binned quantitative fields on the color channel.

    For example, the following plot has a binned field on thecolor channel.

    Similar toordinal color scales, a customrange orscheme can be specified for binned ordinal scales.

    In addition,bins property can be used to specify bin boundaries over the scale domain.

    PropertyTypeDescription
    binsScaleBins

    Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:

    • Anarray literal of bin boundary values. For example,[0, 5, 10, 15, 20]. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.
    • Abin specification object that indicates the binstep size, and optionally thestart andstop boundaries.
    • An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.

    Bins Parameter

    The bin specification object for the scalebins properties support the following properties:

    PropertyTypeDescription
    binsAny

    Quantile Scales

    Quantile scales ("quantile") map a sample of input domain values to a discrete range based on computedquantile boundaries. The domain is considered continuous and thus the scale will accept any reasonable input value; however, the domain is specified as a discrete set of sample values. The number of values in (i.e., the cardinality of) the output range determines the number of quantiles that will be computed from the domain. To compute the quantiles, the domain is sorted, and treated as a population of discrete values. The resulting quantile boundaries segment the domain into groups with roughly equals numbers of sample points per group. If therange is not specified, the domain will be segmented into 4 quantiles (quartiles) by default.

    Quantile scales are particularly useful for creating color or size encodings with a fixed number of output values. Using a discrete set of encoding levels (typically between 5-9 colors or sizes) sometimes supports more accurate perceptual comparison than a continuous range. For related functionality seequantize scales, which partition the domain into uniform domain extents, rather than groups with equal element counts. Quantile scales have the benefit of evenly distributing data points to encoded values. In contrast, quantize scales uniformly segment the input domain and provide no guarantee on how data points will be distributed among the output visual values.

    Quantize Scales

    Quantize scales ("quantize") are similar tolinear scales, except they use a discrete rather than continuous range. Thequantize scale maps continuous value to a discrete range by dividing the domain into uniform segments based on the number of values in (i.e., the cardinality of) the output range. Each range valuey can be expressed as a quantized linear function of the domain valuex:y = m round(x) + b. If therange property is not specified, the domain will be divided into 4 uniform segments by default.

    Quantize scales are particularly useful for creating color or size encodings with a fixed number of output values. Using a discrete set of encoding levels (typically between 5-9 colors or sizes) sometimes supports more accurate perceptual comparison than a continuous range. For related functionality seequantile scales, which partition the domain into groups with equal element counts, rather than uniform domain extents.

    PropertyTypeDescription
    niceBoolean | Number | String | Object |ExprRef

    Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of[0.201479…, 0.996679…], a nice domain might be[0.2, 1.0].

    For quantitative scales such as linear,nice can be either a boolean flag or a number. Ifnice is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.

    For temporal fields with time and utc scales, thenice value can be a string indicating the desired time interval. Legal values are"millisecond","second","minute","hour","day","week","month", and"year". Alternatively,time andutc scales can accept an object-valued interval specifier of the form{"interval": "month", "step": 3}, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.

    Default value:true for unbinnedquantitative fields without explicit domain bounds;false otherwise.

    zeroBoolean |ExprRef

    Iftrue, ensures that a zero baseline value is included in the scale domain.

    Default value:true for x and y channels if the quantitative field is not binned and no customdomain is provided;false otherwise.

    Note: Log, time, and utc scales do not supportzero.

    Threshold Scales

    Threshold scales ("threshold") are similar toquantize scales, except they allow mapping of arbitrary subsets of the domain (not uniform segments) to discrete values in the range. The input domain is still continuous, and divided into slices based on a set of threshold values provided to therequireddomain property. Therange property must have N+1 elements, where N is the number of threshold boundaries provided in the domain.

    Disabling Scale

    To directly encode the data value, thescale property can be set tonull.

    For example, the follow bar chart directly encodes color names in the data.

    Configuration

    // Top-level View Specification{  ...  "config": {    "scale": {      ...                       // Scale Config    },    "range": {      ...                       // Scale Range Config    },    ...  }  ...}

    Scale Config

    To provide themes for all scales, the scale config (config: {scale: {...}}) can contain the following properties:

    Padding

    PropertyTypeDescription
    bandPaddingInnerNumber |ExprRef

    Default inner padding forx andy band scales.

    Default value:

    • nestedOffsetPaddingInner for x/y scales with nested x/y offset scales.
    • barBandPaddingInner for bar marks (0.1 by default)
    • rectBandPaddingInner for rect and other marks (0 by default)
    barBandPaddingInnerNumber |ExprRef

    Default inner padding forx andy band-ordinal scales of"bar" marks.

    Default value:0.1

    rectBandPaddingInnerNumber |ExprRef

    Default inner padding forx andy band-ordinal scales of"rect" marks.

    Default value:0

    bandWithNestedOffsetPaddingInnerNumber |ExprRef

    Default inner padding forx andy band scales with nestedxOffset andyOffset encoding.

    Default value:0.2

    offsetBandPaddingInnerNumber |ExprRef

    Default padding inner for xOffset/yOffset’s band scales.

    Default Value:0

    bandPaddingOuterNumber |ExprRef

    Default outer padding forx andy band scales.

    Default value:paddingInner/2 (which makeswidth/height = number of unique values * step)

    bandWithNestedOffsetPaddingOuterNumber |ExprRef

    Default outer padding forx andy band scales with nestedxOffset andyOffset encoding.

    Default value:0.2

    offsetBandPaddingOuterNumber |ExprRef

    Default padding outer for xOffset/yOffset’s band scales.

    Default Value:0

    continuousPaddingNumber |ExprRef

    Default padding for continuous x/y scales.

    Default: The bar width for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.;0 otherwise.

    pointPaddingNumber |ExprRef

    Default outer padding forx andy point-ordinal scales.

    Default value:0.5 (which makeswidth/height = number of unique values * step)

    Range

    PropertyTypeDescription
    maxBandSizeNumber

    The default max value for mapping quantitative fields to bar’s size/bandSize.

    If undefined (default), we will use the axis’s size (width or height) - 1.

    minBandSizeNumber

    The default min value for mapping quantitative fields to bar and tick’s size/bandSize scale.

    Default value:2

    maxFontSizeNumber

    The default max value for mapping quantitative fields to text’s size/fontSize scale.

    Default value:40

    minFontSizeNumber

    The default min value for mapping quantitative fields to text’s size/fontSize scale.

    Default value:8

    maxOpacityNumber

    Default max opacity for mapping a field to opacity.

    Default value:0.8

    minOpacityNumber

    Default minimum opacity for mapping a field to opacity.

    Default value:0.3

    maxSizeNumber

    Default max value for point size scale.

    minSizeNumber

    Default minimum value for point size scale.

    Default value:9

    maxStrokeWidthNumber

    Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.

    Default value:4

    minStrokeWidthNumber

    Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.

    Default value:1

    Scale Output for Invalid Values

    PropertyTypeDescription
    invalidScaleInvalidDataConfig

    An object that defines scale outputs per channel for invalid values (nulls and NaNs on a continuous scale).

    • The keys in this object are the scale channels.
    • The values is either"zero-or-min" (use zero if the scale includes zero or min value otherwise) or a value definition{value: ...}.

    Example: Setting thisconfig.scale.invalid property to{color: {value: '#aaa'}} will make the visualization color all invalid values with ‘#aaa’.

    Seehttps://vega.github.io/vega-lite/docs/invalid-data.html for more details.

    Other

    PropertyTypeDescription
    clampBoolean |ExprRef

    If true, values that exceed the data domain are clamped to either the minimum or maximum range value

    roundBoolean |ExprRef

    If true, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. (Only available forx,y, andsize scales.)

    xReverseBoolean |ExprRef

    Reverse x-scale by default (useful for right-to-left charts).

    useUnaggregatedDomainBoolean

    Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.

    This is equivalent to settingdomain to"unaggregate" for aggregatedquantitative fields by default.

    This property only works with aggregate functions that produce values within the raw data domain ("mean","average","median","q1","q3","min","max"). For other aggregations that produce values outside of the raw data domain (e.g."count","sum"), this property is ignored.

    Default value:false

    zeroBoolean

    Defaultscale.zero forcontinuous scales except for (1) x/y-scales of non-ranged bar or area charts and (2) size scales.

    Default value:true

    Range Config

    The scale range configuration (config: {range: {...}}) defines key-value mapping for named scale ranges: the keys represent the range names, while the values define validrange or, for named color ranges,Vega scheme definitions.

    By default, Vega-Lite (via Vega) includes the following pre-defined named ranges:

    PropertyTypeDescription
    categoryRangeScheme |Color[]

    Defaultcolor scheme for categorical data.

    divergingRangeScheme |Color[]

    Defaultcolor scheme for diverging quantitative ramps.

    heatmapRangeScheme |Color[]

    Defaultcolor scheme for quantitative heatmaps.

    ordinalRangeScheme |Color[]

    Defaultcolor scheme for rank-ordered data.

    rampRangeScheme |Color[]

    Defaultcolor scheme for sequential quantitative ramps.

    symbolString[]

    Array ofsymbol names or paths for the default shape palette.

    Seethis file for the default values of named ranges.


[8]ページ先頭

©2009-2025 Movatter.jp