From 9a34c0d08389d16fec6908c78d2f065c19f38676 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Fri, 7 Jan 2022 16:35:40 +0100 Subject: [PATCH 1/2] add typing and docs for maxTicksLimit time scale --- docs/axes/cartesian/time.md | 1 + types/index.esm.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/axes/cartesian/time.md b/docs/axes/cartesian/time.md index 389de1d55f9..7faa3deaa43 100644 --- a/docs/axes/cartesian/time.md +++ b/docs/axes/cartesian/time.md @@ -31,6 +31,7 @@ Namespace: `options.scales[scaleId]` | `adapters.date` | `object` | `{}` | Options for adapter for external date library if that adapter needs or supports options | `bounds` | `string` | `'data'` | Determines the scale bounds. [more...](./index.md#scale-bounds) | `ticks.source` | `string` | `'auto'` | How ticks are generated. [more...](#ticks-source) +| `ticks.maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show. | `time.displayFormats` | `object` | | Sets how different time units are displayed. [more...](#display-formats) | `time.isoWeekday` | `boolean`\|`number` | `false` | If `boolean` and true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday. If `number`, the index of the first day of the week (0 - Sunday, 6 - Saturday) | `time.parser` | `string`\|`function` | | Custom parser for dates. [more...](#parser) diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 96ad30bf8cd..1f229e290e4 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -3249,6 +3249,12 @@ export type TimeScaleOptions = CartesianScaleOptions & { * @default 'auto' */ source: 'labels' | 'auto' | 'data'; + + /** + * Maximum number of ticks and gridlines to show. + * @default 11 + */ + maxTicksLimit: number; }; }; From 9cdb6403fb8f5148ef7b26db67b8d85fd1a9e602 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Sat, 8 Jan 2022 16:54:02 +0100 Subject: [PATCH 2/2] change maxTicksLimit to base instead of each scale seperatly since its done in the core.scale --- docs/axes/cartesian/_common_ticks.md | 1 + docs/axes/cartesian/linear.md | 1 - docs/axes/cartesian/time.md | 1 - types/index.esm.d.ts | 16 +++++----------- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/axes/cartesian/_common_ticks.md b/docs/axes/cartesian/_common_ticks.md index 9f2575477cb..aeb3992a0e1 100644 --- a/docs/axes/cartesian/_common_ticks.md +++ b/docs/axes/cartesian/_common_ticks.md @@ -15,3 +15,4 @@ Namespace: `options.scales[scaleId].ticks` | `minRotation` | `number` | `0` | Minimum rotation for tick labels. *Note: Only applicable to horizontal scales.* | `mirror` | `boolean` | `false` | Flips tick labels around axis, displaying the labels inside the chart instead of outside. *Note: Only applicable to vertical scales.* | `padding` | `number` | `0` | Padding between the tick label and the axis. When set on a vertical axis, this applies in the horizontal (X) direction. When set on a horizontal axis, this applies in the vertical (Y) direction. +| `maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show. diff --git a/docs/axes/cartesian/linear.md b/docs/axes/cartesian/linear.md index 2aaf9c53205..695e9b69f85 100644 --- a/docs/axes/cartesian/linear.md +++ b/docs/axes/cartesian/linear.md @@ -27,7 +27,6 @@ Namespace: `options.scales[scaleId].ticks` | ---- | ---- | ------- | ------- | ----------- | `count` | `number` | Yes | `undefined` | The number of ticks to generate. If specified, this overrides the automatic generation. | `format` | `object` | Yes | | The [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) options used by the default label formatter -| `maxTicksLimit` | `number` | Yes | `11` | Maximum number of ticks and gridlines to show. | `precision` | `number` | Yes | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places. | `stepSize` | `number` | Yes | | User-defined fixed step size for the scale. [more...](#step-size) diff --git a/docs/axes/cartesian/time.md b/docs/axes/cartesian/time.md index 7faa3deaa43..389de1d55f9 100644 --- a/docs/axes/cartesian/time.md +++ b/docs/axes/cartesian/time.md @@ -31,7 +31,6 @@ Namespace: `options.scales[scaleId]` | `adapters.date` | `object` | `{}` | Options for adapter for external date library if that adapter needs or supports options | `bounds` | `string` | `'data'` | Determines the scale bounds. [more...](./index.md#scale-bounds) | `ticks.source` | `string` | `'auto'` | How ticks are generated. [more...](#ticks-source) -| `ticks.maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show. | `time.displayFormats` | `object` | | Sets how different time units are displayed. [more...](#display-formats) | `time.isoWeekday` | `boolean`\|`number` | `false` | If `boolean` and true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday. If `number`, the index of the first day of the week (0 - Sunday, 6 - Saturday) | `time.parser` | `string`\|`function` | | Custom parser for dates. [more...](#parser) diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index 1f229e290e4..0b049117cef 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -3078,6 +3078,11 @@ export interface CartesianScaleOptions extends CoreScaleOptions { * @default 0 */ padding: number; + /** + * Maximum number of ticks and gridlines to show. + * @default 11 + */ + maxTicksLimit: number; }; } @@ -3120,11 +3125,6 @@ export type LinearScaleOptions = CartesianScaleOptions & { */ format: Intl.NumberFormatOptions; - /** - * Maximum number of ticks and gridlines to show. - * @default 11 - */ - maxTicksLimit: number; /** * if defined and stepSize is not specified, the step size will be rounded to this many decimal places. */ @@ -3249,12 +3249,6 @@ export type TimeScaleOptions = CartesianScaleOptions & { * @default 'auto' */ source: 'labels' | 'auto' | 'data'; - - /** - * Maximum number of ticks and gridlines to show. - * @default 11 - */ - maxTicksLimit: number; }; };