(axa, dAx, axLetter, gs, options)
| 72 | // axDomainRef: if true and axa defined, draws relative to axis domain, |
| 73 | // otherwise draws relative to data (if axa defined) or paper (if not). |
| 74 | function shiftPosition(axa, dAx, axLetter, gs, options) { |
| 75 | var optAx = options[axLetter]; |
| 76 | var axRef = options[axLetter + 'ref']; |
| 77 | var vertical = axLetter.indexOf('y') !== -1; |
| 78 | var axDomainRef = Axes.getRefType(axRef) === 'domain'; |
| 79 | var gsDim = vertical ? gs.h : gs.w; |
| 80 | if(axa) { |
| 81 | if(axDomainRef) { |
| 82 | // here optAx normalized to length of axis (e.g., normally in range |
| 83 | // 0 to 1). But dAx is in pixels. So we normalize dAx to length of |
| 84 | // axis before doing the math. |
| 85 | return optAx + (vertical ? -dAx : dAx) / axa._length; |
| 86 | } else { |
| 87 | return axa.p2r(axa.r2p(optAx) + dAx); |
| 88 | } |
| 89 | } else { |
| 90 | return optAx + (vertical ? -dAx : dAx) / gsDim; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * drawRaw: draw a single annotation, potentially with modifications |
no outgoing calls
no test coverage detected
searching dependent graphs…