UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

31 lines 829 B
import { getLabel } from "../../internals/getLabel.mjs"; const descriptionGetter = params => { const { identifier, series, xAxis, localeText } = params; const label = 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 }); }; export default descriptionGetter;