@mui/x-charts
Version:
The community edition of MUI X Charts components.
26 lines (25 loc) • 721 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _getLabel = require("../../internals/getLabel");
const descriptionGetter = params => {
const {
identifier,
series,
localeText
} = params;
const item = series.data[identifier.dataIndex];
const label = (0, _getLabel.getLabel)(item?.label, 'tooltip');
const value = item?.value ?? null;
const formattedValue = item?.formattedValue ?? '';
const totalValue = series.data.reduce((acc, curr) => acc + (curr?.value ?? 0), 0);
return localeText.pieDescription({
value,
totalValue,
formattedValue,
seriesLabel: label
});
};
var _default = exports.default = descriptionGetter;