How to use d3-request - 10 common examples

To help you get started, we’ve selected a few d3-request 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 openstreetmap / iD / modules / services / mapillary.js View on Github external
loadSigns: function(context, projection) {
        // if we are looking at signs, we'll actually need to fetch images too
        loadTiles('images', apibase + 'images?', projection);
        loadTiles('objects', apibase + 'objects?', projection);

        // load traffic sign defs
        if (!_mlySignDefs) {
            _mlySignSprite = context.asset('img/traffic-signs/traffic-signs.png');
            _mlySignDefs = {};
            d3_json(context.asset('img/traffic-signs/traffic-signs.json'), function(err, data) {
                if (err) return;
                _mlySignDefs = data;
            });
        }
    },
github uber / react-vis / docs / docs-app / actions / index.js View on Github external
return (dispatch, getState) => {
    const filename = content.markdown;
    if (!filename) {
      return;
    }
    const contents = getState();
    if (contents.markdownPages.get(filename)) {
      // already loaded
      return;
    }
    dispatch(loadContentStart(filename));
    text(filename, (error, response) => {
      dispatch(loadContentSuccess(filename, error ? error.target.response : response));
    });
  };
}
github uber / luma.gl / website / src / actions / app-actions.js View on Github external
return (dispatch, getState) => {
    const {contents} = getState();
    if (filename in contents) {
      // already loaded
      return;
    }

    dispatch(loadContentStart(filename));
    text(filename, (error, response) => {
      dispatch(loadContentSuccess(filename, error ? error.target.response : response));
    });

  };
};
github zakandrewking / escher / src / utils.js View on Github external
function load_the_file (t, file, callback, value) {
  if (value) {
    if (file) console.warn('File ' + file + ' overridden by value.')
    callback.call(t, null, value)
    return
  }
  if (!file) {
    callback.call(t, 'No filename', null)
    return
  }
  if (_ends_with(file, 'json')) {
    d3_json(file, function(e, d) { callback.call(t, e, d) })
  } else if (_ends_with(file, 'css')) {
    d3_text(file, function(e, d) { callback.call(t, e, d) })
  } else {
    callback.call(t, 'Unrecognized file type', null)
  }
  return
}
github zakandrewking / escher / src / utils.js View on Github external
function load_css(css_path, callback) {
  var css = ""
  if (css_path) {
    d3_text(css_path, function(error, text) {
      if (error) {
        console.warn(error)
      }
      css = text
      callback(css)
    })
  }
  return false
}
github NghiaTranUIT / data-visualization-deck-gl / example / main.js View on Github external
_loadCsvFile(path, onDataLoaded) {
    request.csv(path, function loadJson(error, data) {
      if (error) {
        console.error(error);
      }
      onDataLoaded(data);
    });
  },
github babsey / nest-desktop / src / deprecated / src / multi_neuron_mm.js View on Github external
var update_params = function(node, model) {
    var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
    d3Request.csv(url, row, function(params) {
        params.forEach(function(p) {
            $('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
            var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
            param_slider.on("slideStop", function() {
                simulate(1000.)
            })
            if (p.level &gt; $('#levelInput').attr('value')) {
                $('.' + p.id).addClass('hidden')
            }
        })
    })
}
github babsey / nest-desktop / src / deprecated / src / single_neuron_vm.js View on Github external
var update_params = function(node, model) {
    var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
    d3Request.csv(url, row, function(params) {
        params.forEach(function(p) {
            $('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
            var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
            param_slider.on("slideStop", function() {
                simulate(1000.)
            })
            if (p.level &gt; $('#levelInput').attr('value')) {
                $('.' + p.id).addClass('hidden')
            }
        })
    })
}
github babsey / nest-desktop / src / deprecated / src / basal-ganglia-activity.js View on Github external
var update_params = function(node, model) {
    var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
    d3Request.csv(url, row, function(params) {
        params.forEach(function(p) {
            $('#' + node).find('.params').append('<dt class="'+ p.id +'" id="id_' + p.id + '">' + p.label + '</dt>')
            var param_slider = s.dataSlider(nodes, node, p.id, p.slider);
            param_slider.on("slideStop", function() {
                simulate()
            })
            if (p.level &gt; $('#levelInput').attr('value')) {
                $('.'+ p.id).addClass('hidden')
            }
        })
    })
}
github babsey / nest-desktop / src / deprecated / src / single_neuron_mm.js View on Github external
var update_params = function(node, model) {
    var url = 'file://' + curpath + '/settings/sliderDefaults/' + model + '.csv';
    d3Request.csv(url, row, function(params) {
        params.forEach(function(p) {
            $('#' + node).find('.params').append('<dt class="' + p.id + '" id="id_' + p.id + '">' + p.label + '</dt>')
            var param_slider = s.paramSlider(nodes, node, p.id, p.slider);
            param_slider.on("slideStop", function() {
                simulate(1000.)
            })
            if (p.level &gt; $('#levelInput').attr('value')) {
                $('.' + p.id).addClass('hidden')
            }
        })
    })
}

d3-request

A convenient alternative to XMLHttpRequest.

BSD-3-Clause
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis