From a0d976840b04bee32f4b763e7145b709c5fa3e6a Mon Sep 17 00:00:00 2001 From: Carson Holloway Date: Sat, 25 Sep 2021 14:12:02 +1000 Subject: [PATCH 1/4] Update stale documentation for axis titles (#9682) Updated the documentation for the types on axis labels. In the corresponding `index.esm.d.ts` file, put JSDoc descriptions for the properties to match the now-updated documentation. --- docs/axes/labelling.md | 4 ++-- types/index.esm.d.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/axes/labelling.md b/docs/axes/labelling.md index 527e53fd175..5facdbab6f9 100644 --- a/docs/axes/labelling.md +++ b/docs/axes/labelling.md @@ -12,8 +12,8 @@ Namespace: `options.scales[scaleId].title`, it defines options for the scale tit | `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'` | `text` | `string`\|`string[]` | `''` | The text for the title. (i.e. "# of People" or "Response Choices"). | `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label. -| `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md) -| `padding` | [`Padding`](../general/padding.md) | `4` | Padding to apply around scale labels. Only `top` and `bottom` are implemented. +| `font` | [`FontSpec`](../api/interfaces/FontSpec) | `Chart.defaults.font` | Configuration for the axis title font. See [Fonts](../general/fonts.md) +| `padding` | `number`\|`{ top: number; bottom: number; }` | `4` | Padding to apply around scale labels. See [Padding](../general/padding.md). ## Creating Custom Tick Formats diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 548720c57ca..e81b4e0549f 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -2903,12 +2903,19 @@ export interface CartesianScaleOptions extends CoreScaleOptions { grid: GridLineOptions; + /** Options for the scale title. */ title: { + /** If true, displays the axis title. */ display: boolean; + /** Alignment of the axis title. */ align: 'start' | 'center' | 'end'; + /** The text for the title, e.g. "# of People" or "Response Choices". */ text: string | string[]; + /** Color of the axis label. */ color: Color; + /** Information about the axis title font. */ font: FontSpec; + /** Padding to apply around scale labels. */ padding: number | { top: number; bottom: number; From c9a1502f1e06ef1d2237edae699fae78487d834e Mon Sep 17 00:00:00 2001 From: Carson Holloway Date: Sat, 25 Sep 2021 22:25:58 +1000 Subject: [PATCH 2/4] Clean up axis title labels documentation (#9682) Inserted extra information in the documentation for the type of the padding, inserted missing full stops. In the type file, added JSDoc for undocumented properties. --- docs/axes/labelling.md | 4 ++-- types/index.esm.d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/axes/labelling.md b/docs/axes/labelling.md index 5facdbab6f9..acd5ed774f3 100644 --- a/docs/axes/labelling.md +++ b/docs/axes/labelling.md @@ -12,8 +12,8 @@ Namespace: `options.scales[scaleId].title`, it defines options for the scale tit | `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'` | `text` | `string`\|`string[]` | `''` | The text for the title. (i.e. "# of People" or "Response Choices"). | `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label. -| `font` | [`FontSpec`](../api/interfaces/FontSpec) | `Chart.defaults.font` | Configuration for the axis title font. See [Fonts](../general/fonts.md) -| `padding` | `number`\|`{ top: number; bottom: number; }` | `4` | Padding to apply around scale labels. See [Padding](../general/padding.md). +| `font` | [`FontSpec`](../api/interfaces/FontSpec) | `Chart.defaults.font` | Configuration for the axis title font. See [Fonts](../general/fonts.md). +| `padding` | `number`\|`{ top: number; bottom: number; }` | `4` | Padding to apply around scale labels. `left` and `right` properties are not implemented. See [Padding](../general/padding.md). ## Creating Custom Tick Formats diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index e81b4e0549f..14a9757c06e 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -2917,7 +2917,9 @@ export interface CartesianScaleOptions extends CoreScaleOptions { font: FontSpec; /** Padding to apply around scale labels. */ padding: number | { + /** Padding on the (relative) top side of this axis label. */ top: number; + /** Padding on the (relative) bottom side of this axis label. */ bottom: number; }; }; From 38c97996f84e331d0c8e8f6bbd79c6fe37e21b85 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Mon, 29 Nov 2021 23:12:17 +0200 Subject: [PATCH 3/4] Update docs/axes/labelling.md --- docs/axes/labelling.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/axes/labelling.md b/docs/axes/labelling.md index acd5ed774f3..936ca4c485e 100644 --- a/docs/axes/labelling.md +++ b/docs/axes/labelling.md @@ -12,8 +12,8 @@ Namespace: `options.scales[scaleId].title`, it defines options for the scale tit | `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'` | `text` | `string`\|`string[]` | `''` | The text for the title. (i.e. "# of People" or "Response Choices"). | `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label. -| `font` | [`FontSpec`](../api/interfaces/FontSpec) | `Chart.defaults.font` | Configuration for the axis title font. See [Fonts](../general/fonts.md). -| `padding` | `number`\|`{ top: number; bottom: number; }` | `4` | Padding to apply around scale labels. `left` and `right` properties are not implemented. See [Padding](../general/padding.md). +| `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md) +| `padding` | [`Padding`](../general/padding.md) | `4` | Padding to apply around scale labels. Only `top`, `bottom` and `y` are implemented. ## Creating Custom Tick Formats From f942efd3f4626447dbac9e61798eee0b60b0d7a6 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Mon, 29 Nov 2021 23:12:42 +0200 Subject: [PATCH 4/4] Update types/index.esm.d.ts --- types/index.esm.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 14a9757c06e..036f079cb63 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -2921,6 +2921,8 @@ export interface CartesianScaleOptions extends CoreScaleOptions { top: number; /** Padding on the (relative) bottom side of this axis label. */ bottom: number; + /** This is a shorthand for defining top/bottom to the same values. */ + y: number; }; };