vega-lite

  • Version 6.1.0
  • Published
  • 5.76 MB
  • 6 dependencies
  • BSD-3-Clause license

Install

npm i vega-lite
yarn add vega-lite
pnpm add vega-lite

Overview

Vega-Lite is a concise high-level language for interactive visualization.

Index

Variables

variable duplicate

const duplicate: (value: any, options?: StructuredSerializeOptions) => any;

    variable entries

    const entries: <T>(obj: T) => [keyof T, T[keyof T]][];

      variable keys

      const keys: <T>(o: T) => Extract<keyof T, string>[];

        variable vals

        const vals: <T>(obj: T) => T[keyof T][];

          variable version

          const version: any;

            Functions

            function accessPathDepth

            accessPathDepth: (path: string) => any;
            • Count the depth of the path. Returns 1 for fields that are not nested.

            function accessPathWithDatum

            accessPathWithDatum: (path: string, datum?: string) => string;
            • Converts a path to an access path with datum.

              Parameter path

              The field name.

              Parameter datum

              The string to use for datum.

            function accessWithDatumToUnescapedPath

            accessWithDatumToUnescapedPath: (unescapedPath: string) => string;
            • Return access with datum to **an unescaped path**.

              console.log(accessWithDatumToUnescapedPath("vega's favorite"))
              // "datum['vega\\'s favorite']"

              Parameter path

              The unescaped path name. E.g., "a.b", "vega's favorite". (Note that the field defs take escaped strings like "a\\.b", "vega\\'s favorite", but this function is for the unescaped field/path)

            function compile

            compile: (
            inputSpec: TopLevelSpec,
            opt?: CompileOptions
            ) => { spec: VgSpec; normalized: TopLevel<NormalizedSpec> & LayoutSizeMixins };
            • Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.

              At a high-level, we make the following transformations in different phases:

              Input spec | | (Normalization) v Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) | | (Build Model) v A model tree of the spec | | (Parse) v A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) | | (Optimize) v A model tree with parsed components with the data component optimized | | (Assemble) v Vega spec

              Parameter inputSpec

              The Vega-Lite specification.

              Parameter opt

              Optional arguments passed to the Vega-Lite compiler.

              Returns

              An object containing the compiled Vega spec and normalized Vega-Lite spec.

            function contains

            contains: <T>(array: readonly T[], item: T) => boolean;

              function deepEqual

              deepEqual: (a: any, b: any) => boolean;
              • Compares two values for equality, including arrays and objects.

                Adapted from https://github.com/epoberezkin/fast-deep-equal.

              function deleteNestedProperty

              deleteNestedProperty: (obj: any, orderedProps: string[]) => boolean;
              • Delete nested property of an object, and delete the ancestors of the property if they become empty.

              function every

              every: <T>(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) => boolean;
              • Returns true if all items return true.

              function fieldIntersection

              fieldIntersection: (a: ReadonlySet<string>, b: ReadonlySet<string>) => boolean;
              • Returns true if a and b have an intersection. Also return true if a or b are undefined since this means we don't know what fields a node produces or depends on.

              function flatAccessWithDatum

              flatAccessWithDatum: (
              path: string,
              datum?: 'datum' | 'parent' | 'datum.datum'
              ) => string;
              • Return access with datum to the flattened field.

                Parameter path

                The field name.

                Parameter datum

                The string to use for datum.

              function getFirstDefined

              getFirstDefined: <T>(...args: readonly T[]) => T | undefined;
              • This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.

              function hash

              hash: (a: any) => string | number;
              • Converts any object to a string of limited size, or a number.

              function hasIntersection

              hasIntersection: <T>(a: ReadonlySet<T>, b: ReadonlySet<T>) => boolean;

                function hasProperty

                hasProperty: <T>(obj: T, key: string | number | symbol) => key is keyof T;
                • Check if the input object has the property and it's not undefined.

                  Parameter object

                  the object

                  Parameter property

                  the property to search

                  Returns

                  if the object has the property and it's not undefined.

                function internalField

                internalField: (name: string) => string;

                  function isBoolean

                  isBoolean: (b: any) => b is boolean;

                    function isEmpty

                    isEmpty: (obj: object) => boolean;

                      function isEqual

                      isEqual: <T>(dict: Dict<T>, other: Dict<T>) => boolean;
                      • Returns true if the two dictionaries agree. Applies only to defined values.

                      function isInternalField

                      isInternalField: (name: string) => boolean;

                        function isNullOrFalse

                        isNullOrFalse: (x: any) => x is false;

                          function isNumeric

                          isNumeric: (value: number | string) => boolean;
                          • Returns whether the passed in value is a valid number.

                          function logicalExpr

                          logicalExpr: <T>(
                          op: LogicalComposition<T>,
                          cb: (...args: readonly any[]) => string
                          ) => string;

                            function mergeDeep

                            mergeDeep: <T>(dest: T, ...src: readonly DeepPartial<T>[]) => T;
                            • recursively merges src into dest

                            function never

                            never: (message: string) => never;

                              function normalize

                              normalize: (
                              spec: TopLevelSpec & LayoutSizeMixins,
                              config?: Config<SignalRef>
                              ) => TopLevel<NormalizedSpec> & LayoutSizeMixins;

                                function normalizeAngle

                                normalizeAngle: (angle: number) => number;
                                • Normalize angle to be within [0,360).

                                function omit

                                omit: <T extends object, K extends keyof T>(
                                obj: T,
                                props: readonly K[]
                                ) => Omit<T, K>;
                                • The opposite of _.pick; this method creates an object composed of the own and inherited enumerable string keyed properties of object that are not omitted.

                                function pick

                                pick: <T extends object, K extends keyof T>(
                                obj: T,
                                props: readonly K[]
                                ) => Pick<T, K>;
                                • Creates an object composed of the picked object properties.

                                  var object = {'a': 1, 'b': '2', 'c': 3}; pick(object, ['a', 'c']); // → {'a': 1, 'c': 3}

                                function prefixGenerator

                                prefixGenerator: (a: ReadonlySet<string>) => ReadonlySet<string>;

                                  function removePathFromField

                                  removePathFromField: (path: string) => string;
                                  • Remove path accesses with access from field. For example, foo["bar"].baz becomes foo.bar.baz.

                                  function replaceAll

                                  replaceAll: (string: string, find: string, replacement: string) => string;
                                  • Replace all occurrences of a string with another string.

                                    Parameter string

                                    the string to replace in

                                    Parameter find

                                    the string to replace

                                    Parameter replacement

                                    the replacement

                                  function replacePathInField

                                  replacePathInField: (path: string) => string;
                                  • Replaces path accesses with access to non-nested field. For example, foo["bar"].baz becomes foo\\.bar\\.baz.

                                  function resetIdCounter

                                  resetIdCounter: () => void;
                                  • Resets the id counter used in uniqueId. This can be useful for testing.

                                  function setEqual

                                  setEqual: <T>(a: Set<T>, b: Set<T>) => boolean;

                                    function some

                                    some: <T>(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) => boolean;
                                    • Returns true if any item returns true.

                                    function stringify

                                    stringify: (data: any) => string;
                                    • Converts any object to a string representation that can be consumed by humans.

                                      Adapted from https://github.com/epoberezkin/fast-json-stable-stringify

                                    function titleCase

                                    titleCase: (s: string) => string;

                                      function unique

                                      unique: <T>(values: readonly T[], f: (item: T) => string | number) => T[];

                                        function uniqueId

                                        uniqueId: (prefix?: string) => string | number;
                                        • Returns a new random id every time it gets called.

                                          Has side effect!

                                        function varName

                                        varName: (s: string) => string;
                                        • Convert a string into a valid variable name

                                        Interfaces

                                        interface Config

                                        interface Config<ES extends ExprRef | SignalRef = ExprRef | SignalRef>
                                        extends TopLevelProperties<ES>,
                                        VLOnlyConfig<ES>,
                                        MarkConfigMixins<ES>,
                                        CompositeMarkConfigMixins,
                                        AxisConfigMixins<ES>,
                                        HeaderConfigMixins<ES>,
                                        CompositionConfigMixins {}

                                          property aria

                                          aria?: boolean;
                                          • A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the "aria-hidden" attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.

                                            __Default value:__ true.

                                          property legend

                                          legend?: LegendConfig<ES>;
                                          • Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config).

                                          property lineBreak

                                          lineBreak?: string | ES;
                                          • A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.

                                          property locale

                                          locale?: Locale;
                                          • Locale definitions for string parsing and formatting of number and date values. The locale object should contain number and/or time properties with [locale definitions](https://vega.github.io/vega/docs/api/locale/). Locale definitions provided in the config block may be overridden by the View constructor locale option.

                                          property projection

                                          projection?: ProjectionConfig;
                                          • Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config).

                                          property range

                                          range?: RangeConfig;
                                          • An object hash that defines default range arrays or schemes for using with scales. For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).

                                          property signals

                                          signals?: (InitSignal | NewSignal)[];

                                          property style

                                          style?: StyleConfigIndex<ES>;
                                          • An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config).

                                          property title

                                          title?: TitleConfig<ES>;
                                          • Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config).

                                          Type Aliases

                                          type DeepPartial

                                          type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
                                          • Like TS Partial but applies recursively to all properties.

                                          type Dict

                                          type Dict<T> = Record<string, T>;

                                            type Flag

                                            type Flag<S extends string> = { [K in S]: 1 };

                                              type TopLevelSpec

                                              type TopLevelSpec =
                                              | TopLevelUnitSpec<Field>
                                              | TopLevelFacetSpec
                                              | TopLevel<LayerSpec<Field>>
                                              | TopLevel<RepeatSpec>
                                              | TopLevel<GenericConcatSpec<NonNormalizedSpec>>
                                              | TopLevel<GenericVConcatSpec<NonNormalizedSpec>>
                                              | TopLevel<GenericHConcatSpec<NonNormalizedSpec>>;
                                              • A Vega-Lite top-level specification. This is the root class for all Vega-Lite specifications. (The json schema is generated from this type.)

                                              Package Files (6)

                                              Dependencies (6)

                                              Dev Dependencies (42)

                                              Peer Dependencies (1)

                                              Badge

                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/vega-lite.

                                              • Markdown
                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/vega-lite)
                                              • HTML
                                                <a href="https://www.jsdocs.io/package/vega-lite"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>