MCPcopy Index your code
hub / github.com/plotly/plotly.js / getPt

Function getPt

src/traces/scatter/line_points.js:62–87  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

60
61 // turn one calcdata point into pixel coordinates
62 function getPt(index) {
63 var di = d[index];
64 if(!di) return false;
65 var x = opts.linearized ? xa.l2p(di.x) : xa.c2p(di.x);
66 var y = opts.linearized ? ya.l2p(di.y) : ya.c2p(di.y);
67
68 // if non-positive log values, set them VERY far off-screen
69 // so the line looks essentially straight from the previous point.
70 if(x === BADNUM) {
71 if(xLog) x = xa.c2p(di.x, true);
72 if(x === BADNUM) return false;
73 // If BOTH were bad log values, make the line follow a constant
74 // exponent rather than a constant slope
75 if(yLog && y === BADNUM) {
76 x *= Math.abs(xa._m * yLen * (xa._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) /
77 (ya._m * xLen * (ya._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS)));
78 }
79 x *= 1000;
80 }
81 if(y === BADNUM) {
82 if(yLog) y = ya.c2p(di.y, true);
83 if(y === BADNUM) return false;
84 y *= 1000;
85 }
86 return [x, y];
87 }
88
89 function crossesViewport(xFrac0, yFrac0, xFrac1, yFrac1) {
90 var dx = xFrac1 - xFrac0;

Callers 1

line_points.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…