MCPcopy
hub / github.com/microsoft/SandDance / points

Function points

docs/app/js/sanddance-app.js:119634–119659  ·  view source on GitHub ↗
(data, x, y, sort)

Source from the content-addressed store, hash-verified

119632 ];
119633}
119634function points(data, x, y, sort) {
119635 data = data.filter((d)=>{
119636 let u = x(d), v = y(d);
119637 return u != null && (u = +u) >= u && v != null && (v = +v) >= v;
119638 });
119639 if (sort) data.sort((a, b)=>x(a) - x(b));
119640 const n = data.length, X = new Float64Array(n), Y = new Float64Array(n); // extract values, calculate means
119641 let i = 0, ux = 0, uy = 0, xv, yv, d1;
119642 for (d1 of data){
119643 X[i] = xv = +x(d1);
119644 Y[i] = yv = +y(d1);
119645 ++i;
119646 ux += (xv - ux) / i;
119647 uy += (yv - uy) / i;
119648 } // mean center the data
119649 for(i = 0; i < n; ++i){
119650 X[i] -= ux;
119651 Y[i] -= uy;
119652 }
119653 return [
119654 X,
119655 Y,
119656 ux,
119657 uy
119658 ];
119659}
119660function visitPoints(data, x, y, callback) {
119661 let i = -1, u, v;
119662 for (const d of data){

Callers 4

expFunction · 0.70
quadFunction · 0.70
polyFunction · 0.70
loessFunction · 0.70

Calls 3

xFunction · 0.70
yFunction · 0.70
filterMethod · 0.45

Tested by

no test coverage detected