]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Rename scaleLabel to title in scale options (#8576)
authorEvert Timberg <evert.timberg+github@gmail.com>
Sat, 6 Mar 2021 04:22:55 +0000 (23:22 -0500)
committerGitHub <noreply@github.com>
Sat, 6 Mar 2021 04:22:55 +0000 (23:22 -0500)
32 files changed:
docs/docs/axes/cartesian/_common.md
docs/docs/axes/labelling.md
docs/docs/getting-started/v3-migration.md
samples/advanced/line-gradient.html
samples/animations/drop.html
samples/animations/loop.html
samples/charts/area/line-stacked.html
samples/charts/line/basic.html
samples/charts/line/interpolation-modes.html
samples/charts/line/line-styles.html
samples/charts/line/point-sizes.html
samples/charts/line/skip-points.html
samples/legend/callbacks.html
samples/legend/point-style.html
samples/legend/positioning.html
samples/legend/title.html
samples/scales/axes-labels.html
samples/scales/financial.html
samples/scales/linear/step-size.html
samples/scales/logarithmic/scatter.html
samples/scales/non-numeric-y.html
samples/scales/time/line-max-span.html
samples/scales/time/line-point-data.html
samples/scales/time/line.html
samples/title/alignment.html
samples/tooltips/callbacks.html
samples/tooltips/point-style.html
src/core/core.scale.js
test/specs/core.controller.tests.js
test/specs/core.scale.tests.js
test/specs/scale.linear.tests.js
types/index.esm.d.ts

index 7d47d945178d463b217273546087a4533826ba39..1eade79a7fa933e3a3c6c2a393dc13ce9f23c90d 100644 (file)
@@ -8,4 +8,4 @@ Namespace: `options.scales[scaleId]`
 | `position` | `string` | | Position of the axis. [more...](./index.mdx#axis-position)
 | `axis` | `string` | | Which type of axis this is. Possible values are: `'x'`, `'y'`. If not set, this is inferred from the first character of the ID which should be `'x'` or `'y'`.
 | `offset` | `boolean` | `false` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to `true` for a bar chart by default.
-| `scaleLabel` | `object` | | Scale title configuration. [more...](../labelling.md#scale-title-configuration)
+| `title` | `object` | | Scale title configuration. [more...](../labelling.md#scale-title-configuration)
index 1c8efdeaa3edd3d344ab831e5d61cea1ad4dffb2..23e59535d74a2d17e14b99323596759c0ea6e667 100644 (file)
@@ -6,13 +6,13 @@ When creating a chart, you want to tell the viewer what data they are viewing. T
 
 ## Scale Title Configuration
 
-Namespace: `options.scales[scaleId].scaleLabel`, it defines options for the scale title. Note that this only applies to cartesian axes.
+Namespace: `options.scales[scaleId].title`, it defines options for the scale title. Note that this only applies to cartesian axes.
 
 | Name | Type | Default | Description
 | ---- | ---- | ------- | -----------
 | `display` | `boolean` | `false` | If true, display the axis title.
 | `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'`
-| `labelString` | `string` | `''` | The text for the title. (i.e. "# of People" or "Response Choices").
+| `text` | `string` | `''` | The text for the title. (i.e. "# of People" or "Response Choices").
 | `color` | [`Color`](../general/colors.md) | `Chart.defaults.color` | Color of label.
 | `font` | `Font` | `Chart.defaults.font` | See [Fonts](../general/fonts.md)
 | `padding` | `number`\|`object` | `4` | Padding to apply around scale labels. Only `top` and `bottom` are implemented.
index 57ca63405e16b98bb292517693217b446d31abb7..fc03f38645f5c45cd12b383461cd122c3f24ab21 100644 (file)
@@ -85,6 +85,8 @@ A number of changes were made to the configuration options passed to the `Chart`
 * `scales.[x/y]Axes.categoryPercentage` was moved to dataset option `categoryPercentage`
 * `scales.[x/y]Axes.maxBarThickness` was moved to dataset option `maxBarThickness`
 * `scales.[x/y]Axes.minBarLength` was moved to dataset option `minBarLength`
+* `scales.[x/y]Axes.scaleLabel` was renamed to `scales[id].title`
+* `scales.[x/y]Axes.scaleLabel.labelString` was renamed to `scales[id].title.text`
 * `scales.[x/y]Axes.ticks.beginAtZero` was renamed to `scales[id].beginAtZero`
 * `scales.[x/y]Axes.ticks.max` was renamed to `scales[id].max`
 * `scales.[x/y]Axes.ticks.min` was renamed to `scales[id].min`
@@ -134,9 +136,9 @@ options: {
       id: 'x',
       type: 'time',
       display: true,
-      scaleLabel: {
+      title: {
         display: true,
-        labelString: 'Date'
+        text: 'Date'
       },
       ticks: {
         major: {
@@ -155,9 +157,9 @@ options: {
     yAxes: [{
       id: 'y',
       display: true,
-      scaleLabel: {
+      title: {
         display: true,
-        labelString: 'value'
+        text: 'value'
       }
     }]
   }
@@ -172,9 +174,9 @@ options: {
     x: {
       type: 'time',
       display: true,
-      scaleLabel: {
+      title: {
         display: true,
-        labelString: 'Date'
+        text: 'Date'
       },
       ticks: {
         major: {
@@ -192,9 +194,9 @@ options: {
     },
     y: {
       display: true,
-      scaleLabel: {
+      title: {
         display: true,
-        labelString: 'value'
+        text: 'value'
       }
     }
   }
index 40dc65b4b4723f98686df0abd4cd8abaf2056098..6cbcb368307a0f05dc87ef860d5b5a558c51b203 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index b89b978a6038c627bdf66c3942c123387111e495..5fe656d97a9d70644fa9b0b9264be370f1551f61 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index d75e47f1b6f5361aa4578b22c22e0077b6846aed..8568f0c5a1eacd99344b663901d7967631a7a7fb 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index ed98af0c793fac74c59e56c413c88357e187d846..d74db48763158eaf0b0241fb89cb07baadf760df 100644 (file)
                                },
                                scales: {
                                        x: {
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                stacked: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index fdf877f0cc059ad58401bc4a802ecc7518e18a2a..e832bf43e1cf24792b0b308ab760da573caac2df 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 191211e14750898c8f0164dceaf93ca1b9c1078c..a305983be53bd8277f9804460b595e3a2e9d8e90 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                },
                                                suggestedMin: -10,
                                                suggestedMax: 200
index de3876d1bb03e471abdd57baa46ca6dc1c96d701..5ce58e94fa3ef0f4e4807f27992debce8c4a80c0 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 3a57eda7e11f9d5ba852c2a0c1a3c2e8dd09f6d5..2290c6b105e5260d9b87d7224f039b9fe9f30466 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 9c4dc996bfe6d07462cc6df3a48e78f07563a0b2..4ccaec546d41c01ca185e817d54dbea15409847a 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                },
                                        }
                                }
index 918c90ad6917ec881f7510a436fedf920284f95f..0573ea3eb51b8666216b93147b27126a515b8a7e 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 2d3e0a4258abd118a5bd53042bae6556692c0397..eac849a1cdf94a0243abb2cf91b45882f0de7f2d 100644 (file)
                                        scales: {
                                                x: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Month'
+                                                               text: 'Month'
                                                        }
                                                },
                                                y: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Value'
+                                                               text: 'Value'
                                                        }
                                                }
                                        }
index 3805aa657e8a1e86403425b4d509b93a4a7582f5..c55e57c0a1ec15dd6bb44c9c57cd89aa72e23c45 100644 (file)
                                        scales: {
                                                x: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Month'
+                                                               text: 'Month'
                                                        }
                                                },
                                                y: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Value'
+                                                               text: 'Value'
                                                        }
                                                }
                                        }
index 8fb9a207d0afeab90138619009c391a56357189b..540e8350600047e89051d2f4570e63a9fadfbb25 100644 (file)
                                        scales: {
                                                x: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Month'
+                                                               text: 'Month'
                                                        }
                                                },
                                                y: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Value'
+                                                               text: 'Value'
                                                        }
                                                }
                                        }
index d83934d3acd577da9c1c766604f980fa84d72bb3..4f97f6ec414421efa8469b4d99755657a5bad6fb 100644 (file)
@@ -80,9 +80,9 @@
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month',
+                                                       text: 'Month',
                                                        font: {
                                                                color: '#911',
                                                                family: 'Comic Sans MS',
@@ -95,9 +95,9 @@
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value',
+                                                       text: 'Value',
                                                        font: {
                                                                color: '#191',
                                                                family: 'Times',
index 7afc97ae8c5709ea6c432222a67f32d4dd94491b..8847539017092ff62e83906e451f4ae879b4706b 100644 (file)
                                                gridLines: {
                                                        drawBorder: false
                                                },
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Closing price ($)'
+                                                       text: 'Closing price ($)'
                                                }
                                        }
                                },
index de7907ef35928f81dfbd814e792b760619d6e9a7..67cc3c13e9d270191c7e03997a8c8f7c62bdefeb 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                },
                                                min: 0,
                                                max: 100,
index 1dec9916406b55f11b0e22761193a905e729a442..1f6769a85126c07eaa0e717e05e90b9847c66a24 100644 (file)
                                                                return '';
                                                        },
                                                },
-                                               scaleLabel: {
-                                                       labelString: 'Frequency',
+                                               title: {
+                                                       text: 'Frequency',
                                                        display: true,
                                                }
                                        },
                                                                return tick.toString() + 'dB';
                                                        }
                                                },
-                                               scaleLabel: {
-                                                       labelString: 'Voltage',
+                                               title: {
+                                                       text: 'Voltage',
                                                        display: true
                                                }
                                        }
index adab57b5f41ca9f5e54fc1c61bff3e654b0d1dc0..e9c5024d81817f67b8df0f844d6daa05f12a155c 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                type: 'category',
                                                position: 'left',
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Request State'
+                                                       text: 'Request State'
                                                },
                                                reverse: true
                                        }
index 06921f2c54dd7db847c32e0f4a067461089fe24c..a20e2fcdb3376ee6ff4b69202b4cfdbf43e53213 100644 (file)
@@ -89,9 +89,9 @@
                                        x: {
                                                type: 'time',
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Date'
+                                                       text: 'Date'
                                                },
                                                ticks: {
                                                        autoSkip: false,
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'value'
+                                                       text: 'value'
                                                }
                                        }
                                }
index f3a86920e376114cc3b784d9093a8b8f903beeb7..7bb1b568b3ccc75f084b7ec0873b9ddcc5bdc1b1 100644 (file)
@@ -88,9 +88,9 @@
                                        x: {
                                                type: 'time',
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Date'
+                                                       text: 'Date'
                                                },
                                                ticks: {
                                                        major: {
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'value'
+                                                       text: 'value'
                                                }
                                        }
                                }
index 3e6b8170a3b551f7f2cf5d16f317bc6bdd755208..79b071d1d3ed865a248d16e072b8a33998012c58 100644 (file)
                                                        // round: 'day'
                                                        tooltipFormat: 'll HH:mm'
                                                },
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Date'
+                                                       text: 'Date'
                                                }
                                        },
                                        y: {
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'value'
+                                                       text: 'value'
                                                }
                                        }
                                },
index d2cff45605ff0c17651068ced14727d9a39171a7..6b5b56fb1022e2b45acd1c0f6ff82918df556638 100644 (file)
                                        scales: {
                                                x: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Month'
+                                                               text: 'Month'
                                                        }
                                                },
                                                y: {
                                                        display: true,
-                                                       scaleLabel: {
+                                                       title: {
                                                                display: true,
-                                                               labelString: 'Value'
+                                                               text: 'Value'
                                                        }
                                                }
                                        }
index 406d06d3d43088423cd90d72d5c3cfe220413836..33b14441678a877ef83d9cc62a7c0e15bf2df311 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        show: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        show: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 1ab437b4084fab042d7922c89856a2ca66efaa5c..957449426cd81ed48a50bfc936bd1c35490c0686 100644 (file)
                                scales: {
                                        x: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Month'
+                                                       text: 'Month'
                                                }
                                        },
                                        y: {
                                                display: true,
-                                               scaleLabel: {
+                                               title: {
                                                        display: true,
-                                                       labelString: 'Value'
+                                                       text: 'Value'
                                                }
                                        }
                                }
index 4b3dd09790be905a5df4e314ba10de8f32965b22..6c4218b2e9910134a9a1a50d473c633f8c2aab8a 100644 (file)
@@ -43,13 +43,13 @@ defaults.set('scale', {
     borderWidth: (_ctx, options) => options.lineWidth
   },
 
-  // scale label
-  scaleLabel: {
+  // scale title
+  title: {
     // display property
     display: false,
 
     // actual label
-    labelString: '',
+    text: '',
 
     // top/bottom padding
     padding: {
@@ -81,7 +81,7 @@ defaults.set('scale', {
 
 defaults.route('scale.ticks', 'color', '', 'color');
 defaults.route('scale.gridLines', 'color', '', 'borderColor');
-defaults.route('scale.scaleLabel', 'color', '', 'color');
+defaults.route('scale.title', 'color', '', 'color');
 
 defaults.describe('scale', {
   _fallback: false,
@@ -170,7 +170,7 @@ function getTickMarkLength(options) {
 /**
  * @param {object} options
  */
-function getScaleLabelHeight(options, fallback) {
+function getTitleHeight(options, fallback) {
   if (!options.display) {
     return 0;
   }
@@ -741,7 +741,7 @@ export default class Scale extends Element {
     if (maxLabelWidth + 6 > tickWidth) {
       tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));
       maxHeight = me.maxHeight - getTickMarkLength(options.gridLines)
-                               - tickOpts.padding - getScaleLabelHeight(options.scaleLabel, me.chart.options.font);
+                               - tickOpts.padding - getTitleHeight(options.title, me.chart.options.font);
       maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);
       labelRotation = toDegrees(Math.min(
         Math.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)),
@@ -772,25 +772,25 @@ export default class Scale extends Element {
     const chart = me.chart;
     const opts = me.options;
     const tickOpts = opts.ticks;
-    const scaleLabelOpts = opts.scaleLabel;
+    const titleOpts = opts.title;
     const gridLineOpts = opts.gridLines;
     const display = me._isVisible();
     const labelsBelowTicks = opts.position !== 'top' && me.axis === 'x';
     const isHorizontal = me.isHorizontal();
-    const scaleLabelHeight = display && getScaleLabelHeight(scaleLabelOpts, chart.options.font);
+    const titleHeight = display && getTitleHeight(titleOpts, chart.options.font);
 
     // Width
     if (isHorizontal) {
       minSize.width = me.maxWidth;
     } else if (display) {
-      minSize.width = getTickMarkLength(gridLineOpts) + scaleLabelHeight;
+      minSize.width = getTickMarkLength(gridLineOpts) + titleHeight;
     }
 
     // height
     if (!isHorizontal) {
       minSize.height = me.maxHeight; // fill all the height
     } else if (display) {
-      minSize.height = getTickMarkLength(gridLineOpts) + scaleLabelHeight;
+      minSize.height = getTickMarkLength(gridLineOpts) + titleHeight;
     }
 
     // Don't bother fitting the ticks if we are not showing the labels
@@ -1658,67 +1658,67 @@ export default class Scale extends Element {
     const me = this;
     const ctx = me.ctx;
     const options = me.options;
-    const scaleLabel = options.scaleLabel;
+    const title = options.title;
 
-    if (!scaleLabel.display) {
+    if (!title.display) {
       return;
     }
 
-    const scaleLabelFont = toFont(scaleLabel.font);
-    const scaleLabelPadding = toPadding(scaleLabel.padding);
-    const halfLineHeight = scaleLabelFont.lineHeight / 2;
-    const scaleLabelAlign = scaleLabel.align;
+    const titleFont = toFont(title.font);
+    const titlePadding = toPadding(title.padding);
+    const halfLineHeight = titleFont.lineHeight / 2;
+    const titleAlign = title.align;
     const position = options.position;
     const isReverse = me.options.reverse;
     let rotation = 0;
     /** @type CanvasTextAlign */
     let textAlign;
-    let scaleLabelX, scaleLabelY;
+    let titleX, titleY;
 
     if (me.isHorizontal()) {
-      switch (scaleLabelAlign) {
+      switch (titleAlign) {
       case 'start':
-        scaleLabelX = me.left + (isReverse ? me.width : 0);
+        titleX = me.left + (isReverse ? me.width : 0);
         textAlign = isReverse ? 'right' : 'left';
         break;
       case 'end':
-        scaleLabelX = me.left + (isReverse ? 0 : me.width);
+        titleX = me.left + (isReverse ? 0 : me.width);
         textAlign = isReverse ? 'left' : 'right';
         break;
       default:
-        scaleLabelX = me.left + me.width / 2;
+        titleX = me.left + me.width / 2;
         textAlign = 'center';
       }
-      scaleLabelY = position === 'top'
-        ? me.top + halfLineHeight + scaleLabelPadding.top
-        : me.bottom - halfLineHeight - scaleLabelPadding.bottom;
+      titleY = position === 'top'
+        ? me.top + halfLineHeight + titlePadding.top
+        : me.bottom - halfLineHeight - titlePadding.bottom;
     } else {
       const isLeft = position === 'left';
-      scaleLabelX = isLeft
-        ? me.left + halfLineHeight + scaleLabelPadding.top
-        : me.right - halfLineHeight - scaleLabelPadding.top;
-      switch (scaleLabelAlign) {
+      titleX = isLeft
+        ? me.left + halfLineHeight + titlePadding.top
+        : me.right - halfLineHeight - titlePadding.top;
+      switch (titleAlign) {
       case 'start':
-        scaleLabelY = me.top + (isReverse ? 0 : me.height);
+        titleY = me.top + (isReverse ? 0 : me.height);
         textAlign = isReverse === isLeft ? 'right' : 'left';
         break;
       case 'end':
-        scaleLabelY = me.top + (isReverse ? me.height : 0);
+        titleY = me.top + (isReverse ? me.height : 0);
         textAlign = isReverse === isLeft ? 'left' : 'right';
         break;
       default:
-        scaleLabelY = me.top + me.height / 2;
+        titleY = me.top + me.height / 2;
         textAlign = 'center';
       }
       rotation = isLeft ? -HALF_PI : HALF_PI;
     }
 
-    renderText(ctx, scaleLabel.labelString, 0, 0, scaleLabelFont, {
-      color: scaleLabel.color,
+    renderText(ctx, title.text, 0, 0, titleFont, {
+      color: title.color,
       rotation,
       textAlign,
       textBaseline: 'middle',
-      translation: [scaleLabelX, scaleLabelY],
+      translation: [titleX, titleY],
     });
   }
 
index c0f1b2ba8502a34555d86c947ddf85d8843c3459..fc379d9ef520d8479f61841c5eaf12fa9acbaaa8 100644 (file)
@@ -1396,9 +1396,9 @@ describe('Chart', function() {
             },
             y: {
               type: 'linear',
-              scaleLabel: {
+              title: {
                 display: true,
-                labelString: 'Value'
+                text: 'Value'
               }
             }
           }
index 58560745d50913f84075533386ba6d245dc0affa..48d885fb1bf872119e18c1444908e56a3781e18e 100644 (file)
@@ -6,10 +6,10 @@ describe('Core.scale', function() {
   describe('auto', jasmine.fixture.specs('core.scale'));
 
   it('should provide default scale label options', function() {
-    expect(Chart.defaults.scale.scaleLabel).toEqual({
+    expect(Chart.defaults.scale.title).toEqual({
       color: Chart.defaults.color,
       display: false,
-      labelString: '',
+      text: '',
       padding: {
         top: 4,
         bottom: 4
index 36bdf225827629869f4b394d61c8568595d67593..58932da3f5dd3a6f289fc6a0a7a052eb4978d973 100644 (file)
@@ -904,8 +904,8 @@ describe('Linear Scale', function() {
     expect(yScale.height).toBeCloseToPixel(450);
 
     // Extra size when scale label showing
-    xScale.options.scaleLabel.display = true;
-    yScale.options.scaleLabel.display = true;
+    xScale.options.title.display = true;
+    yScale.options.title.display = true;
     chart.update();
 
     expect(xScale.paddingTop).toBeCloseToPixel(0);
@@ -957,7 +957,7 @@ describe('Linear Scale', function() {
               drawTicks: false,
               drawBorder: false
             },
-            scaleLabel: {
+            title: {
               display: false,
               lineHeight: 1.2
             },
index 29f66fb1dea6d01105961532887e776b93ec8de2..4ee77eab4ed08989e8f968fb4f2ca2c92f75e0bd 100644 (file)
@@ -2696,9 +2696,9 @@ export interface CartesianScaleOptions extends CoreScaleOptions {
 
   gridLines: GridLineOptions;
 
-  scaleLabel: {
+  title: {
     display: boolean;
-    labelString: string;
+    text: string;
     color: Color;
     font: FontSpec;
     padding: {