UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

37 lines (36 loc) 964 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _getLabel = require("../../internals/getLabel"); const descriptionGetter = params => { const { identifier, series, xAxis, localeText } = params; const label = (0, _getLabel.getLabel)(series.label, 'tooltip'); const dataIndex = identifier.dataIndex; if (dataIndex === undefined) { return ''; } const xValue = xAxis.data?.[dataIndex] ?? null; const yValue = series.data[dataIndex] ?? null; const formattedXValue = xAxis.valueFormatter?.(xValue, { location: 'tooltip', scale: xAxis.scale }); const formattedYValue = series.valueFormatter(yValue, { dataIndex }); return localeText.lineDescription({ x: xValue, y: yValue, formattedXValue: formattedXValue ?? '', formattedYValue: formattedYValue ?? '', seriesLabel: label }); }; var _default = exports.default = descriptionGetter;