global configuration - abudaan/vega-multi-view GitHub Wiki

---
debug: false
overwrite: false
element: id
renderer: canvas
type: yaml
run: true
hover: false
specs:
    spec1: ../specs/spec1.yaml,
    spec2: [../specs/spec2.vg.json, ../conf/spec2.yaml]
styling:
    url: ../css/view1.css
    css: 'div {
        color: red;
        font-size: 1em;
    }'
    cssAppend: true
    addToHead: false
    class: [view, square]
    classAppend: true
dataPath: ./assets/data
imagePath: ./assets/img

Note that only the specs entry is mandatory. That is, you can leave it out but then nothing will be rendered.

debug: boolean

Print signal and data updates to the browser console. Defaults to false.

overwrite: boolean

Whether or not an existing spec in the store will be overwritten by a spec with the same id that is added afterwards.

element: string | HTMLElement

The element where all Vega views will be rendered to. Inside this element every view creates its own containing HTML element. If the element does not exist a div will be created and added to the body of the document. You can either specify an id (string) or a HTML element. Defaults to document.body.

renderer: "canvas" | "svg"

The renderer that will used for all views, unless overridden by a view specific configuration.

type: "yaml" | "json" | "cson" | "bson" | "json-string" | "object"

File-type of the specs. This setting can be overruled by the view specific setting. vega-multi-view detects file types automatically, however providing a type can make the parsing process a tiny bit faster. In case you serve your specs using a REST API, vega-multi-view uses the content type in header of the response to detect the file-type. If your server is not sending the correct content types you should provide a file type. Content types:

  • json: application/json
  • yaml: text/yaml
  • bson: application/bson
  • cson: text/cson

Specs in the types json-string and object are typically already available in the client-side and don't need to be loaded from a server.

run: boolean

Whether or not to call the run() method of a view after it has been added to the DOM. Defaults to true and will be overridden by a view specific configuration.

hover: boolean

Whether or not to call the hover() method of the view after it has been added to the page. Defaults to false and will be overridden by a view specific configuration.

specs: { [string]: SpecType }

A key-value store object where the keys are the unique ids by which the Vega specs can be identified. The value is a single spec or a tuple, in case you set a tuple the second value is the view specific configuration file (see below). Both the spec and the configuration can be any of the types listed above.

styling: StylingType

Add styling that applies to all views and / or containing elements of the views. Can be overwritten by view specific configuration.

// @flow
type StylingType = {
    url?: string,
    css?: string,
    cssAppend?: boolean,
    addToHead?: boolean,
    classes?: string | Array<string>,
    classesAppend?: boolean,
};
url: string

The url of an external stylesheet. Note that this setting only has effect when the renderer is set to 'svg'.

css: string

SVG renderer only. The css as string, allows you to inline the css in the configuration file which saves a HTTP request. If you set both url and css, the value set for css will prevail.

addToHead: boolean

SVG renderer only. Adds the styling to the head of the HTML page before the Vega view(s) get rendered, defaults to false. Default value is false, keep this setting if you want to bundle styles on the server before sending to the client. Note that this setting only has effect when the renderer is set to 'svg'.

cssAppend: boolean

SVG renderer only. Whether or not the new new styling rules will be be added to the existing rules or replace them. Defaults to true which means that new rules will be added to the existing.

classes: string | Array<string>

The css class or array of css classes that will be added to the view's containing HTML element, unless overridden by a view specific configuration.

classesAppend: boolean

Whether the classes should be appended to the existing classes or replace them. Defaults to true. This setting can be very handy if you call addViews repeatedly and you want to adjust the size of all views based on the number of views that are added to the page.

dataPath: string

Path to data sets that the Vega spec needs to load. The entries dataPath and imagePath are only useful if you generate or customize your Vega specs before rendering. For an example of how you can use dataPath and imagePath see the vega-multi-view-server.

imagePath: string

Path to the images that the Vega spec needs to load, for instance for rendering marks.

⚠️ **GitHub.com Fallback** ⚠️