UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

31 lines 881 B
import _extends from "@babel/runtime/helpers/esm/extends"; import { getLabel } from "./getLabel.mjs"; export function getLineLikeTooltip(params, options = {}) { const { series, getColor, identifier } = params; if (!identifier || identifier.dataIndex === undefined) { return null; } const label = getLabel(series.label, 'tooltip'); const value = series.data[identifier.dataIndex]; if (options.skipNullValues && value == null) { return null; } const formattedValue = series.valueFormatter(value, { dataIndex: identifier.dataIndex }); const result = _extends({ identifier, color: getColor(identifier.dataIndex), label, value, formattedValue, markType: series.labelMarkType }, options.includeMarkShape && 'showMark' in series && { markShape: series.showMark ? series.shape : undefined }); return result; }