From 3093562b338801d1c74bc495abd39b2b3b9055fd Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sat, 14 Dec 2019 10:22:57 -0800 Subject: [PATCH] Rename calculateTickRotation to calculateLabelRotation (#6809) --- docs/developers/axes.md | 6 +++--- docs/getting-started/v3-migration.md | 1 + src/core/core.scale.js | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/developers/axes.md b/docs/developers/axes.md index 86b8dc617..3c22c36ac 100644 --- a/docs/developers/axes.md +++ b/docs/developers/axes.md @@ -96,11 +96,11 @@ Optionally, the following methods may also be overwritten, but an implementation ```javascript { - // Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks); - convertTicksToLabels: function() {}, + // Adds labels to objects in the ticks array. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks); + generateTickLabels: function() {}, // Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal. - calculateTickRotation: function() {}, + calculateLabelRotation: function() {}, // Fits the scale into the canvas. // this.maxWidth and this.maxHeight will tell you the maximum dimensions the scale instance can be. Scales should endeavour to be as efficient as possible with canvas space. diff --git a/docs/getting-started/v3-migration.md b/docs/getting-started/v3-migration.md index dd8d3a222..d76bd487b 100644 --- a/docs/getting-started/v3-migration.md +++ b/docs/getting-started/v3-migration.md @@ -108,6 +108,7 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released * `Chart.Animation.animationObject` was renamed to `Chart.Animation` * `Chart.Animation.chartInstance` was renamed to `Chart.Animation.chart` * `DatasetController.updateElement` was renamed to `DatasetController.updateElements` +* `Scale.calculateTickRotation` was renamed to `Scale.calculateLabelRotation` * `TimeScale.getLabelCapacity` was renamed to `TimeScale._getLabelCapacity` * `TimeScale.tickFormatFunction` was renamed to `TimeScale._tickFormatFunction` * `TimeScale.getPixelForOffset` was renamed to `TimeScale._getPixelForOffset` diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 93460e1ce..dfef9f448 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -477,17 +477,17 @@ class Scale extends Element { // _configure is called twice, once here, once from core.controller.updateLayout. // Here we haven't been positioned yet, but dimensions are correct. - // Variables set in _configure are needed for calculateTickRotation, and + // Variables set in _configure are needed for calculateLabelRotation, and // it's ok that coordinates are not correct there, only dimensions matter. me._configure(); // Tick Rotation - me.beforeCalculateTickRotation(); - me.calculateTickRotation(); - me.afterCalculateTickRotation(); + me.beforeCalculateLabelRotation(); + me.calculateLabelRotation(); // Preconditions: number of ticks and sizes of largest labels must be calculated beforehand + me.afterCalculateLabelRotation(); me.beforeFit(); - me.fit(); + me.fit(); // Preconditions: label rotation and label sizes must be calculated beforehand me.afterFit(); // Auto-skip @@ -604,10 +604,10 @@ class Scale extends Element { // - beforeCalculateTickRotation() { - helpers.callback(this.options.beforeCalculateTickRotation, [this]); + beforeCalculateLabelRotation() { + helpers.callback(this.options.beforeCalculateLabelRotation, [this]); } - calculateTickRotation() { + calculateLabelRotation() { var me = this; var options = me.options; var tickOpts = options.ticks; @@ -646,8 +646,8 @@ class Scale extends Element { me.labelRotation = labelRotation; } - afterCalculateTickRotation() { - helpers.callback(this.options.afterCalculateTickRotation, [this]); + afterCalculateLabelRotation() { + helpers.callback(this.options.afterCalculateLabelRotation, [this]); } // -- 2.47.2