mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-04 07:24:02 +01:00
Doughnut controller overrides (#7702)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user