diff --git a/client/src/components/pages/Stats/Explore/index.tsx b/client/src/components/pages/Stats/Explore/index.tsx
index 0c8060d6..72f3dbde 100644
--- a/client/src/components/pages/Stats/Explore/index.tsx
+++ b/client/src/components/pages/Stats/Explore/index.tsx
@@ -8,6 +8,7 @@ import LocationsForPeriod from "../LocationsForPeriod";
import MeditationImpactForPeriod from "../MeditationImpactForPeriod";
import MoodByHourForPeriod from "../MoodByHourForPeriod";
import MoodByLocationForPeriod from "../MoodByLocationForPeriod";
+import MoodBySleepForPeriod from "../MoodBySleepForPeriod";
import MoodByWeekdayForPeriod from "../MoodByWeekdayForPeriod";
import MoodChartForPeriod from "../MoodChartForPeriod";
import MoodCloudForPeriod from "../MoodCloudForPeriod";
@@ -248,6 +249,7 @@ export default function Explore() {
/>
>
) : null}
+
No mood data for this month.
)}
+
+ meanMoodsKeysSet.has(key),
+ );
+ if (intersectingKeys.length < 2) return;
+
+ const points = intersectingKeys.map((key) => {
+ const y = meanMoodsByDay[key];
+ return {
+ color: moodToColor(y),
+ x: minutesSleptByDateAwoke[key] / 60,
+ y,
+ };
+ });
+
+ const ysByX = defaultDict((): number[] => []);
+ // Round to nearest 12 for a resolution of 5 minutes
+ for (const { x, y } of points) ysByX[Math.round(x * 12) / 12].push(y);
+ const linePoints = Object.keys(ysByX).map((x) => ({
+ x: Number(x),
+ y: computeMean(ysByX[x]),
+ }));
+
+ return (
+
+ Average mood by time slept
+ x)) / 5) * 5]}
+ points={points}
+ range={MOOD_RANGE}
+ xAxisTitle="Hours slept"
+ yAxisLabels={MOOD_INTEGERS.map(String)}
+ yAxisTitle="Mood"
+ >
+ [x, y])
+ .sort(([a], [b]) => a - b)}
+ />
+
+
+ );
+}
diff --git a/client/src/components/pages/Stats/Week.tsx b/client/src/components/pages/Stats/Week.tsx
index c7157d33..00f31fba 100644
--- a/client/src/components/pages/Stats/Week.tsx
+++ b/client/src/components/pages/Stats/Week.tsx
@@ -17,6 +17,7 @@ import LocationsForPeriod from "./LocationsForPeriod";
import MeditationImpactForPeriod from "./MeditationImpactForPeriod";
import MoodByHourForPeriod from "./MoodByHourForPeriod";
import MoodByLocationForPeriod from "./MoodByLocationForPeriod";
+import MoodBySleepForPeriod from "./MoodBySleepForPeriod";
import MoodByWeekdayForPeriod from "./MoodByWeekdayForPeriod";
import MoodChartForPeriod from "./MoodChartForPeriod";
import MoodCloud from "./MoodCloud";
@@ -120,6 +121,7 @@ function Week({ date, nextDate, prevDate, showNext, showPrevious }: Props) {
)}
+
+