MCPcopy
hub / github.com/plotly/plotly.js / mapAROCoordToPixel

Function mapAROCoordToPixel

test/jasmine/assets/domain_ref_components.js:358–375  ·  view source on GitHub ↗
(layout, axref, aro, c, offset, nolog)

Source from the content-addressed store, hash-verified

356// You can tell I first wrote this function for shapes only and then learned
357// later this was the case for images and annotations :').
358function mapAROCoordToPixel(layout, axref, aro, c, offset, nolog) {
359 var reftype = Axes.getRefType(aro[axref]);
360 var ret;
361 offset = (offset === undefined) ? 0 : offset;
362 var val = aro[c] + offset;
363 var axis;
364 if(reftype === 'range') {
365 axis = axisIds.id2name(aro[axref]);
366 ret = pixelCalc.mapRangeToPixel(layout, axis, val, nolog);
367 } else if(reftype === 'domain') {
368 axis = axisIds.id2name(aro[axref]);
369 ret = pixelCalc.mapDomainToPixel(layout, axis, val);
370 } else if(reftype === 'paper') {
371 axis = axref[0];
372 ret = pixelCalc.mapPaperToPixel(layout, axis, val);
373 }
374 return ret;
375}
376
377// compute the bounding box of the shape so that it can be compared with the SVG
378// bounding box

Callers 3

annotationTestFunction · 0.85
shapeToBBoxFunction · 0.85
imageToBBoxFunction · 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…