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

Function getConverter

src/components/shapes/helpers.js:203–227  ·  view source on GitHub ↗
(axis, refType, shapeType, isVertical)

Source from the content-addressed store, hash-verified

201 var x0, x1, y0, y1;
202
203 function getConverter(axis, refType, shapeType, isVertical) {
204 var converter;
205 if(axis) {
206 if(refType === 'domain') {
207 if(isVertical) {
208 converter = function(v) { return axis._offset + axis._length * (1 - v); };
209 } else {
210 converter = function(v) { return axis._offset + axis._length * v; };
211 }
212 } else {
213 const d2r = exports.shapePositionToRange(axis);
214 converter = function(v) { return axis._offset + axis.r2p(d2r(v, true)); };
215
216 if(shapeType === 'path' && axis.type === 'date') converter = exports.decodeDate(converter);
217 }
218 } else {
219 if(isVertical) {
220 converter = function(v) { return gs.t + gs.h * (1 - v); };
221 } else {
222 converter = function(v) { return gs.l + gs.w * v; };
223 }
224 }
225
226 return converter;
227 }
228
229 // Build function(s) to convert data to pixel
230 if(xRefType === 'array') {

Callers 1

helpers.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…