How to use the vega-statistics.sampleCurve function in vega-statistics

To help you get started, we’ve selected a few vega-statistics 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-regression / src / Regression.js View on Github external
add = p => {
              const t = {};
              for (let i=0; i add([x, model.predict(x)]));
      } else {
        // otherwise return trend line sample points
        sampleCurve(model.predict, dom, 25, 200).forEach(add);
      }
    });
github vega / vega / packages / vega-transforms / src / KDE.js View on Github external
groups.forEach(g => {
      const density = randomKDE(g, bandwidth)[method],
            scale = _.counts ? g.length : 1,
            local = domain || extent(g);

      sampleCurve(density, local, minsteps, maxsteps).forEach(v => {
        const t = {};
        for (let i=0; i
github vega / vega / packages / vega-transforms / src / Density.js View on Github external
var dist = parseDist(_.distribution, source(pulse)),
        minsteps = _.steps || _.minsteps || 25,
        maxsteps = _.steps || _.maxsteps || 200,
        method = _.method || 'pdf';

    if (method !== 'pdf' && method !== 'cdf') {
      error('Invalid density method: ' + method);
    }
    if (!_.extent && !dist.data) {
      error('Missing density extent parameter.');
    }
    method = dist[method];

    var as = _.as || ['value', 'density'],
        domain = _.extent || extent(dist.data()),
        values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {
          var tuple = {};
          tuple[as[0]] = v[0];
          tuple[as[1]] = v[1];
          return ingest(tuple);
        });

    if (this.value) out.rem = this.value;
    this.value = out.add = out.source = values;
  }

  return out;
};