]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Rename calculateTickRotation to calculateLabelRotation (#6809)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Sat, 14 Dec 2019 18:22:57 +0000 (10:22 -0800)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 14 Dec 2019 18:22:57 +0000 (13:22 -0500)
docs/developers/axes.md
docs/getting-started/v3-migration.md
src/core/core.scale.js

index 86b8dc617f108964de6f0fe65156f952b5894716..3c22c36ac8d2ef6d00174cab17bd2896a521ec21 100644 (file)
@@ -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.
index dd8d3a222bdd3dd87c38e90f6750f9e7396a6ac7..d76bd487bb7dd4347d810078d483e1a47e8b25dd 100644 (file)
@@ -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`
index 93460e1ce6fc7445fe4552c4712711cb5d07fa5b..dfef9f448a0301f33114e2c45cc091d7d91e1bd9 100644 (file)
@@ -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]);
        }
 
        //