Render correct tooltip label.
This commit is contained in:
@@ -25,8 +25,16 @@ export function WebsiteChart({
|
||||
|
||||
if (compare) {
|
||||
result['compare'] = {
|
||||
pageviews: result.pageviews.map(({ x }, i) => ({ x, y: compare.pageviews[i].y })),
|
||||
sessions: result.sessions.map(({ x }, i) => ({ x, y: compare.sessions[i].y })),
|
||||
pageviews: result.pageviews.map(({ x }, i) => ({
|
||||
x,
|
||||
y: compare.pageviews[i].y,
|
||||
d: compare.pageviews[i].x,
|
||||
})),
|
||||
sessions: result.sessions.map(({ x }, i) => ({
|
||||
x,
|
||||
y: compare.sessions[i].y,
|
||||
d: compare.pageviews[i].x,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ export default function BarChartTooltip({ tooltip, unit }) {
|
||||
|
||||
return (
|
||||
<Flexbox direction="column" gap={10}>
|
||||
<div>{formatDate(new Date(dataPoints[0].raw.x), formats[unit], locale)}</div>
|
||||
<div>
|
||||
{formatDate(new Date(dataPoints[0].raw.d || dataPoints[0].raw.x), formats[unit], locale)}
|
||||
</div>
|
||||
<div>
|
||||
<StatusLight color={labelColors?.[0]?.backgroundColor}>
|
||||
{formatLongNumber(dataPoints[0].raw.y)} {dataPoints[0].dataset.label}
|
||||
|
||||
Reference in New Issue
Block a user