Skip to content

Commit 3093562

Browse files
benmccannetimberg
authored andcommitted
Rename calculateTickRotation to calculateLabelRotation (#6809)
1 parent 2be634a commit 3093562

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

docs/developers/axes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ Optionally, the following methods may also be overwritten, but an implementation
9696

9797
```javascript
9898
{
99-
// Transform the ticks array of the scale instance into strings. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks);
100-
convertTicksToLabels: function() {},
99+
// Adds labels to objects in the ticks array. The default implementation simply calls this.options.ticks.callback(numericalTick, index, ticks);
100+
generateTickLabels: function() {},
101101

102102
// Determine how much the labels will rotate by. The default implementation will only rotate labels if the scale is horizontal.
103-
calculateTickRotation: function() {},
103+
calculateLabelRotation: function() {},
104104

105105
// Fits the scale into the canvas.
106106
// 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.

docs/getting-started/v3-migration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
108108
* `Chart.Animation.animationObject` was renamed to `Chart.Animation`
109109
* `Chart.Animation.chartInstance` was renamed to `Chart.Animation.chart`
110110
* `DatasetController.updateElement` was renamed to `DatasetController.updateElements`
111+
* `Scale.calculateTickRotation` was renamed to `Scale.calculateLabelRotation`
111112
* `TimeScale.getLabelCapacity` was renamed to `TimeScale._getLabelCapacity`
112113
* `TimeScale.tickFormatFunction` was renamed to `TimeScale._tickFormatFunction`
113114
* `TimeScale.getPixelForOffset` was renamed to `TimeScale._getPixelForOffset`

src/core/core.scale.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,17 +477,17 @@ class Scale extends Element {
477477

478478
// _configure is called twice, once here, once from core.controller.updateLayout.
479479
// Here we haven't been positioned yet, but dimensions are correct.
480-
// Variables set in _configure are needed for calculateTickRotation, and
480+
// Variables set in _configure are needed for calculateLabelRotation, and
481481
// it's ok that coordinates are not correct there, only dimensions matter.
482482
me._configure();
483483

484484
// Tick Rotation
485-
me.beforeCalculateTickRotation();
486-
me.calculateTickRotation();
487-
me.afterCalculateTickRotation();
485+
me.beforeCalculateLabelRotation();
486+
me.calculateLabelRotation(); // Preconditions: number of ticks and sizes of largest labels must be calculated beforehand
487+
me.afterCalculateLabelRotation();
488488

489489
me.beforeFit();
490-
me.fit();
490+
me.fit(); // Preconditions: label rotation and label sizes must be calculated beforehand
491491
me.afterFit();
492492

493493
// Auto-skip
@@ -604,10 +604,10 @@ class Scale extends Element {
604604

605605
//
606606

607-
beforeCalculateTickRotation() {
608-
helpers.callback(this.options.beforeCalculateTickRotation, [this]);
607+
beforeCalculateLabelRotation() {
608+
helpers.callback(this.options.beforeCalculateLabelRotation, [this]);
609609
}
610-
calculateTickRotation() {
610+
calculateLabelRotation() {
611611
var me = this;
612612
var options = me.options;
613613
var tickOpts = options.ticks;
@@ -646,8 +646,8 @@ class Scale extends Element {
646646

647647
me.labelRotation = labelRotation;
648648
}
649-
afterCalculateTickRotation() {
650-
helpers.callback(this.options.afterCalculateTickRotation, [this]);
649+
afterCalculateLabelRotation() {
650+
helpers.callback(this.options.afterCalculateLabelRotation, [this]);
651651
}
652652

653653
//

0 commit comments

Comments
 (0)