@mui/x-charts
Version:
The community edition of MUI X Charts components.
37 lines (36 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _getLabel = require("../../internals/getLabel");
const descriptionGetter = params => {
const {
identifier,
series,
rotationAxis,
localeText
} = params;
const label = (0, _getLabel.getLabel)(series.label, 'tooltip');
const dataIndex = identifier.dataIndex;
if (dataIndex === undefined) {
return '';
}
const value = series.data[dataIndex] ?? null;
const categoryValue = rotationAxis.data?.[dataIndex] ?? null;
const formattedValue = series.valueFormatter(value, {
dataIndex
});
const formattedCategory = rotationAxis.valueFormatter?.(categoryValue, {
location: 'tooltip',
scale: rotationAxis.scale
});
return localeText.radarDescription({
value,
formattedValue: formattedValue ?? '',
categoryValue,
formattedCategoryValue: formattedCategory ?? '',
seriesLabel: label
});
};
var _default = exports.default = descriptionGetter;