Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Render correct tooltip label.

Mike Cao154b5593150e
diff --git a/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx b/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx
index 5144adcc7..d36cdad69 100644
--- a/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx
+++ b/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx
@@ -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,
+ })),
};
}
diff --git a/src/components/charts/BarChartTooltip.tsx b/src/components/charts/BarChartTooltip.tsx
index b81d55fe1..fed5af924 100644
--- a/src/components/charts/BarChartTooltip.tsx
+++ b/src/components/charts/BarChartTooltip.tsx
@@ -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}