Doughnut controller overrides (#7702)

This commit is contained in:
Evert Timberg
2020-08-11 17:11:57 -04:00
parent 5e194021c7
commit 6f13fd2aef

View File

@@ -185,6 +185,18 @@ export default class DoughnutController extends DatasetController {
return 0;
}
getLabelAndValue(index) {
const me = this;
const meta = me._cachedMeta;
const chart = me.chart;
const labels = chart.data.labels || [];
return {
label: labels[index] || '',
value: meta._parsed[index],
};
}
getMaxBorderWidth(arcs) {
const me = this;
let max = 0;
@@ -334,8 +346,8 @@ DoughnutController.defaults = {
return '';
},
label(tooltipItem) {
let dataLabel = tooltipItem.chart.data.labels[tooltipItem.dataIndex];
const value = ': ' + tooltipItem.dataset.data[tooltipItem.dataIndex];
let dataLabel = tooltipItem.label;
const value = ': ' + tooltipItem.formattedValue;
if (isArray(dataLabel)) {
// show value on first line of multiline label