mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-25 09:36:53 +01:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user