]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Use ticks.steSize instead of time.stepSize on time and timeseries scales (#10653)
authorstockiNail <stocki.nail@gmail.com>
Sat, 10 Sep 2022 15:46:26 +0000 (17:46 +0200)
committerGitHub <noreply@github.com>
Sat, 10 Sep 2022 15:46:26 +0000 (18:46 +0300)
docs/axes/cartesian/time.md
docs/migration/v4-migration.md
src/scales/scale.time.js
test/fixtures/scale.time/ticks-stepsize.js
types/index.d.ts

index 534b7caaebe11191a5be6665ba4189ba41d28cb7..a05aa37ecd5ecaf313adc2c0c284c8c20f79ec87 100644 (file)
@@ -38,7 +38,6 @@ Namespace: `options.scales[scaleId]`
 | `time.round` | `string` | `false` | If defined, dates will be rounded to the start of this unit. See [Time Units](#time-units) below for the allowed units.
 | `time.tooltipFormat` | `string` | | The format string to use for the tooltip.
 | `time.unit` | `string` | `false` | If defined, will force the unit to be a certain type. See [Time Units](#time-units) section below for details.
-| `time.stepSize` | `number` | `1` | The number of units between grid lines.
 | `time.minUnit` | `string` | `'millisecond'` | The minimum display format to be used for a time unit.
 
 !!!include(axes/cartesian/_common.md)!!!
index e34483ac2a9121de7a7227649eb2b5d724dbf801..d065fee04f77122fa151e7a8364ac36217615d32 100644 (file)
@@ -27,6 +27,7 @@ A number of changes were made to the configuration options passed to the `Chart`
 * Linear scales now add and subtracts `5%` of the max value to the range if the min and max are the same instead of `1`.
 * If the tooltip callback returns `undefined`, then the default callback will be used.
 * `maintainAspectRatio` respects container height.
+* Time and timeseries scales use `ticks.stepSize` instead of `time.stepSize`, which has been removed.
 
 #### Type changes
 * The order of the `ChartMeta` parameters have been changed from `<Element, DatasetElement, Type>` to `<Type, Element, DatasetElement>`.
index e888de6c7b9906e139acb3358eeca2e1469584e8..8a575a49b4a037959b342376aade47ff8d480fc1 100644 (file)
@@ -455,7 +455,7 @@ export default class TimeScale extends Scale {
     const timeOpts = options.time;
     // @ts-ignore
     const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, this._getLabelCapacity(min));
-    const stepSize = valueOrDefault(timeOpts.stepSize, 1);
+    const stepSize = valueOrDefault(options.ticks.stepSize, 1);
     const weekday = minor === 'week' ? timeOpts.isoWeekday : false;
     const hasWeekday = isNumber(weekday) || weekday === true;
     const ticks = {};
index dd5f2e3a3793ecc964f031d1f0e81fea6b3f55ac..f32d24e551a5a117a97892f85d3fcff316a9c7d1 100644 (file)
@@ -12,6 +12,8 @@ module.exports = {
           bounds: 'ticks',
           time: {
             unit: 'hour',
+          },
+          ticks: {
             stepSize: 2
           }
         },
index eb8f7dd1487faf27a2e3046b1cde4904c790386b..7a49a3e296d99cf4fd986a9d9187291dfa0eb5a6 100644 (file)
@@ -3238,12 +3238,6 @@ export type TimeScaleOptions = Omit<CartesianScaleOptions, 'min' | 'max'> & {
      * @default false
      */
     unit: false | TimeUnit;
-
-    /**
-     * The number of units between grid lines.
-     * @default 1
-     */
-    stepSize: number;
     /**
      * The minimum display format to be used for a time unit.
      * @default 'millisecond'