From 6c9f8999116782bbe289d0481e3d1ec6b49ce808 Mon Sep 17 00:00:00 2001 From: Akihiko Kusanagi Date: Mon, 18 Mar 2019 16:05:27 +0900 Subject: [PATCH] Add the description of the tooltip alignment options (#6139) --- docs/configuration/tooltip.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/configuration/tooltip.md b/docs/configuration/tooltip.md index 35f2e291fa3..2ae32ac91fb 100644 --- a/docs/configuration/tooltip.md +++ b/docs/configuration/tooltip.md @@ -19,17 +19,20 @@ The tooltip configuration is passed into the `options.tooltips` namespace. The g | `titleFontSize` | `number` | `12` | Title font size. | `titleFontStyle` | `string` | `'bold'` | Title font style. | `titleFontColor` | `Color` | `'#fff'` | Title font color. +| `titleAlign` | `string` | `'left'` | Horizontal alignment of the title text lines. [more...](#alignment) | `titleSpacing` | `number` | `2` | Spacing to add to top and bottom of each title line. | `titleMarginBottom` | `number` | `6` | Margin to add on bottom of title section. | `bodyFontFamily` | `string` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Body line font. | `bodyFontSize` | `number` | `12` | Body font size. | `bodyFontStyle` | `string` | `'normal'` | Body font style. | `bodyFontColor` | `Color` | `'#fff'` | Body font color. +| `bodyAlign` | `string` | `'left'` | Horizontal alignment of the body text lines. [more...](#alignment) | `bodySpacing` | `number` | `2` | Spacing to add to top and bottom of each tooltip item. | `footerFontFamily` | `string` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Footer font. | `footerFontSize` | `number` | `12` | Footer font size. | `footerFontStyle` | `string` | `'bold'` | Footer font style. | `footerFontColor` | `Color` | `'#fff'` | Footer font color. +| `footerAlign` | `string` | `'left'` | Horizontal alignment of the footer text lines. [more...](#alignment) | `footerSpacing` | `number` | `2` | Spacing to add to top and bottom of each footer line. | `footerMarginTop` | `number` | `6` | Margin to add before drawing the footer. | `xPadding` | `number` | `6` | Padding to add on left and right of tooltip. @@ -74,6 +77,16 @@ Chart.Tooltip.positioners.custom = function(elements, eventPosition) { }; ``` +### Alignment + +The `titleAlign`, `bodyAlign` and `footerAlign` options define the horizontal position of the text lines with respect to the tooltip box. The following values are supported. + +* `'left'` (default) +* `'right'` +* `'center'` + +These options are only applied to text lines. Color boxes are always aligned to the left edge. + ### Sort Callback Allows sorting of [tooltip items](#tooltip-item-interface). Must implement at minimum a function that can be passed to [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). This function can also accept a third parameter that is the data object passed to the chart.