@mui/x-charts
Version:
The community edition of MUI X Charts components.
20 lines • 586 B
JavaScript
import { getLabel } from "../../internals/getLabel.mjs";
const descriptionGetter = params => {
const {
identifier,
series,
localeText
} = params;
const item = series.data[identifier.dataIndex];
const label = 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
});
};
export default descriptionGetter;