Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define with let to avoid "assignment to constant" errors #9803

Merged
merged 3 commits into from Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/configuration/tooltip.md
Expand Up @@ -5,7 +5,7 @@
Namespace: `options.plugins.tooltip`, the global options for the chart tooltips is defined in `Chart.defaults.plugins.tooltip`.

:::warning
The bubble, doughnut, pie, polar area, and scatter charts override the tooltip defaults. To change the overrides for those chart types, the options are defined in `Chart.overrides[type].plugins.tooltip`.
The bubble, doughnut, pie, polar area, and scatter charts override the tooltip defaults. To change the overrides for those chart types, the options are defined in `Chart.overrides[type].plugins.tooltip`.
:::

| Name | Type | Default | Description
Expand Down Expand Up @@ -157,7 +157,7 @@ const chart = new Chart(ctx, {
tooltip: {
callbacks: {
label: function(context) {
const label = context.dataset.label || '';
let label = context.dataset.label || '';

if (label) {
label += ': ';
Expand Down Expand Up @@ -282,7 +282,7 @@ const myPieChart = new Chart(ctx, {

external: function(context) {
// Tooltip Element
const tooltipEl = document.getElementById('chartjs-tooltip');
let tooltipEl = document.getElementById('chartjs-tooltip');

// Create element on first render
if (!tooltipEl) {
Expand Down Expand Up @@ -316,7 +316,7 @@ const myPieChart = new Chart(ctx, {
const titleLines = tooltipModel.title || [];
const bodyLines = tooltipModel.body.map(getBody);

const innerHtml = '<thead>';
let innerHtml = '<thead>';

titleLines.forEach(function(title) {
innerHtml += '<tr><th>' + title + '</th></tr>';
Expand All @@ -325,15 +325,15 @@ const myPieChart = new Chart(ctx, {

bodyLines.forEach(function(body, i) {
const colors = tooltipModel.labelColors[i];
const style = 'background:' + colors.backgroundColor;
let style = 'background:' + colors.backgroundColor;
style += '; border-color:' + colors.borderColor;
style += '; border-width: 2px';
const span = '<span style="' + style + '"></span>';
innerHtml += '<tr><td>' + span + body + '</td></tr>';
});
innerHtml += '</tbody>';

const tableRoot = tooltipEl.querySelector('table');
let tableRoot = tooltipEl.querySelector('table');
tableRoot.innerHTML = innerHtml;
}

Expand Down
4 changes: 2 additions & 2 deletions docs/developers/updates.md
Expand Up @@ -66,8 +66,8 @@ Variables referencing any one from `chart.scales` would be lost after updating s

```javascript
function updateScales(chart) {
const xScale = chart.scales.x;
const yScale = chart.scales.y;
let xScale = chart.scales.x;
let yScale = chart.scales.y;
chart.options.scales = {
newId: {
display: true
Expand Down