Fix: support string value for xAxis apart from date (#18590)

* Fix: show string value for xAxis apart from date

* update key name
This commit is contained in:
Kenil Shah 2024-11-14 15:38:33 +05:30 committed by GitHub
parent 00fbf07387
commit eadd93eb9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,7 +152,11 @@ export const CustomTooltip = (props: DataInsightChartTooltipProps) => {
} = props;
if (active && payload && payload.length) {
const timestamp = dateTimeFormatter(payload[0].payload[timeStampKey] || 0);
// we need to check if the xAxis is a date or not.
const timestamp =
timeStampKey === 'term'
? payload[0].payload[timeStampKey]
: dateTimeFormatter(payload[0].payload[timeStampKey] || 0);
const payloadValue = uniqBy(payload, 'dataKey');
return (