How to use vega-loader - 10 common examples

To help you get started, we’ve selected a few vega-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github girder / girder / plugins / table_view / girder_table_view / web_client / views / TableWidget.js View on Github external
updateData: function () {
        // If we already have the data, just render.
        if (this.data) {
            this.state = this.states.DATA_READY;
            this.render();
            return;
        }

        const parser = this.tableParser(this.file);
        if (!parser) {
            this.$('.g-item-table-view').remove();
            return this;
        }
        loader.loader().load(this.file.downloadUrl()).then((data) => {
            data = loader.read(data, {type: parser, parse: 'auto'});
            this.data = data;
            this.columns = _.keys(data[0]);
            this.state = this.states.DATA_READY;
            this.render();
            return data;
        }, (error) => {
            console.error(error);
            this.state = this.states.DATA_ERROR;
            this.render();
            return null;
        });
    },
github shd101wyy / mume / src / vega.ts View on Github external
async function helper(): Promise {
    const view = new vega.View(vega.parse(spec), {
      loader: loader({ baseURL }),
      // logLevel: vega.Warn, // <= this will cause Atom unsafe eval error.
      renderer: "none",
    }).initialize();
    return svgHeader + (await view.toSVG());
  }
github vega / vega-dataflow / src / dataflow / Dataflow.js View on Github external
export default function Dataflow() {
  this._log = logger();
  this.logLevel(Error);

  this._clock = 0;
  this._rank = 0;
  try {
    this._loader = loader();
  } catch (e) {
    // do nothing if loader module is unavailable
  }

  this._touched = UniqueList(id);
  this._pulses = {};
  this._pulse = null;

  this._heap = new Heap(function(a, b) { return a.qrank - b.qrank; });
  this._postrun = [];
}
github vega / vega / packages / vega-dataflow / src / dataflow / Dataflow.js View on Github external
export default function Dataflow() {
  this.logger(logger());
  this.logLevel(Error);

  this._clock = 0;
  this._rank = 0;
  try {
    this._loader = loader();
  } catch (e) {
    // do nothing if loader module is unavailable
  }

  this._touched = UniqueList(id);
  this._input = {};
  this._pulse = null;

  this._heap = Heap((a, b) => a.qrank - b.qrank);
  this._postrun = [];
}
github Kitware / candela / python / girder_plugin / girder_candela / web_client / views / CandelaWidget.js View on Github external
this.loader.load(this.item.downloadUrl()).then((data) => {
            data = read(data, options);
            let columns = Object.keys(data[0]);
            const types = inferTypes(data, columns);
            data.__types__ = types;

            // Vega has issues with empty-string fields and fields with dots, so rename those.
            let rename = [];
            _.each(data.__types__, (value, key) => {
                if (key === '') {
                    rename.push({from: '', to: 'id'});
                } else if (key.indexOf('.') >= 0) {
                    rename.push({from: key, to: key.replace(/\./g, '_')});
                }
            });

            _.each(rename, (d) => {
                data.__types__[d.to] = data.__types__[d.from];
github Kitware / candela / python / girder_plugin / girder_candela / web_client / views / CandelaWidget.js View on Github external
this.loader.load(this.item.downloadUrl()).then((data) => {
            data = read(data, options);
            let columns = Object.keys(data[0]);
            const types = inferTypes(data, columns);
            data.__types__ = types;

            // Vega has issues with empty-string fields and fields with dots, so rename those.
            let rename = [];
            _.each(data.__types__, (value, key) => {
                if (key === '') {
                    rename.push({from: '', to: 'id'});
                } else if (key.indexOf('.') >= 0) {
                    rename.push({from: key, to: key.replace(/\./g, '_')});
                }
            });

            _.each(rename, (d) => {
                data.__types__[d.to] = data.__types__[d.from];
                delete data.__types__[d.from];
                _.each(data, (row) => {
github girder / girder / plugins / table_view / girder_table_view / web_client / views / TableWidget.js View on Github external
loader.loader().load(this.file.downloadUrl()).then((data) => {
            data = loader.read(data, {type: parser, parse: 'auto'});
            this.data = data;
            this.columns = _.keys(data[0]);
            this.state = this.states.DATA_READY;
            this.render();
            return data;
        }, (error) => {
            console.error(error);
github Kitware / candela / python / girder_plugin / girder_candela / web_client / views / CandelaWidget.js View on Github external
initialize: function (settings) {
        this.item = settings.item;
        this.accessLevel = settings.accessLevel;
        this._components = _.keys(_.pick(components, (comp) => comp.options));

        this.listenTo(this.item, 'change', function () {
            this.render();
        }, this);

        this.parametersView = new CandelaParametersView({
            component: components[this.$('.g-item-candela-component').val()],
            parentView: this
        });

        this.loader = loader();
        this.render();
    },
github vega / vega / packages / vega-scenegraph / src / ResourceLoader.js View on Github external
export default function ResourceLoader(customLoader) {
  this._pending = 0;
  this._loader = customLoader || loader();
}
github vega / vega / packages / vega-scenegraph / src / Handler.js View on Github external
export default function Handler(customLoader, customTooltip) {
  this._active = null;
  this._handlers = {};
  this._loader = customLoader || loader();
  this._tooltip = customTooltip || defaultTooltip;
}

vega-loader

Network request and file loading utilities.

BSD-3-Clause
Latest version published 30 days ago

Package Health Score

98 / 100
Full package analysis