* Applies CSS translate to shift label position according * to vertical/horizontal offsets * @param d - Data point * @param offsetHorizontal - Horizontal offset, in pixels, of the label * @param offsetVertical - Vertical offset, in pixels, of the label * @param bandWidth - Bandwidth p
(
d: BarGroupValue,
offsetHorizontal: number,
offsetVertical: number,
bandWidth: number
)
| 618 | * @param bandWidth - Bandwidth parameter for the bar dimantions |
| 619 | */ |
| 620 | private transformBarLabel( |
| 621 | d: BarGroupValue, |
| 622 | offsetHorizontal: number, |
| 623 | offsetVertical: number, |
| 624 | bandWidth: number |
| 625 | ): string { |
| 626 | if (this.orientation === 'horizontal') { |
| 627 | return d.y <= this.baseLine |
| 628 | ? `translate(${ |
| 629 | d.y0 <= this.baseLine ? 0 - offsetVertical : 0 + offsetVertical |
| 630 | }, ${bandWidth / 2 + offsetHorizontal})` |
| 631 | : `translate(${ |
| 632 | d.y1 <= this.baseLine ? 0 - offsetVertical : 0 + offsetVertical |
| 633 | }, ${bandWidth / 2 + offsetHorizontal})`; |
| 634 | } else { |
| 635 | return d.y <= this.baseLine |
| 636 | ? `translate(${bandWidth / 2 + offsetHorizontal}, |
| 637 | ${ |
| 638 | d.y0 <= this.baseLine |
| 639 | ? 0 - offsetVertical |
| 640 | : 0 + offsetVertical |
| 641 | })` |
| 642 | : `translate(${bandWidth / 2 + offsetHorizontal}, |
| 643 | ${ |
| 644 | d.y1 <= this.baseLine |
| 645 | ? 0 - offsetVertical |
| 646 | : 0 + offsetVertical |
| 647 | })`; |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /** |
| 652 | * Determines the value of the text-anchor CSS attribute |
no outgoing calls
no test coverage detected