How to use the vega-canvas.image function in vega-canvas

To help you get started, we’ve selected a few vega-canvas 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 vega / vega / packages / vega-scenegraph / src / ResourceLoader.js View on Github external
prototype.loadImage = function(uri) {
  var loader = this,
      Image = image();
  increment(loader);

  return loader._loader
    .sanitize(uri, {context: 'image'})
    .then(function(opt) {
      var url = opt.href;
      if (!url || !Image) throw {url: url};

      var img = new Image();

      img.onload = function() {
        decrement(loader);
      };

      img.onerror = function() {
        decrement(loader);

vega-canvas

Canvas and Image utilities.

BSD-3-Clause
Latest version published 1 year ago

Package Health Score

80 / 100
Full package analysis

Popular vega-canvas functions