fix: same-looking tooltips on charts (#10548)

* fix: same-looking tooltips on multiseries charts

* fix: same-looknig tooltips on all chart types

* chore: restore tooltip plugin

* docs: additions to migration guide

* docs: remove labels from scatter and bubble examples

* docs: review fix
This commit is contained in:
Dan Onoshko
2022-08-18 15:34:35 +04:00
committed by GitHub
parent d09e424a0a
commit e7372ade24
16 changed files with 561 additions and 382 deletions

View File

@@ -1,5 +1,5 @@
import DatasetController from '../core/core.datasetController';
import {isArray, isObject, resolveObjectKey, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core';
import {isObject, resolveObjectKey, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core';
import {formatNumber} from '../helpers/helpers.intl';
import {toRadians, PI, TAU, HALF_PI, _angleBetween} from '../helpers/helpers.math';
@@ -119,28 +119,6 @@ export default class DoughnutController extends DatasetController {
legend.chart.toggleDataVisibility(legendItem.index);
legend.chart.update();
}
},
tooltip: {
callbacks: {
title() {
return '';
},
label(tooltipItem) {
let dataLabel = tooltipItem.label;
const value = ': ' + tooltipItem.formattedValue;
if (isArray(dataLabel)) {
// show value on first line of multiline label
// need to clone because we are changing the value
dataLabel = dataLabel.slice();
dataLabel[0] += value;
} else {
dataLabel += value;
}
return dataLabel;
}
}
}
}
};