(titleEl, legendObj, bw)
| 57 | |
| 58 | // After legend dimensions are calculated the title can be aligned horizontally left, center, right |
| 59 | function horizontalAlignTitle(titleEl, legendObj, bw) { |
| 60 | if((legendObj.title.side !== 'top center') && (legendObj.title.side !== 'top right')) return; |
| 61 | |
| 62 | var font = legendObj.title.font; |
| 63 | var lineHeight = font.size * LINE_SPACING; |
| 64 | var titleOffset = 0; |
| 65 | var textNode = titleEl.node(); |
| 66 | |
| 67 | var width = Drawing.bBox(textNode).width; // width of the title text |
| 68 | |
| 69 | if(legendObj.title.side === 'top center') { |
| 70 | titleOffset = 0.5 * (legendObj._width - 2 * bw - 2 * constants.titlePad - width); |
| 71 | } else if(legendObj.title.side === 'top right') { |
| 72 | titleOffset = legendObj._width - 2 * bw - 2 * constants.titlePad - width; |
| 73 | } |
| 74 | |
| 75 | svgTextUtils.positionText(titleEl, |
| 76 | bw + constants.titlePad + titleOffset, |
| 77 | bw + lineHeight |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | function drawOne(gd, opts) { |
no outgoing calls
no test coverage detected
searching dependent graphs…