Skip to content

Move the chart legends below the charts on phones (#814) - #824

Merged
mxd1760 merged 2 commits into
mainfrom
fix/814/responsive-chart-legends
Nov 25, 2026
Merged

mxd1760 merged 2 commits into
mainfrom
fix/814/responsive-chart-legends

Conversation

@seanjonesmc

@seanjonesmc seanjonesmc commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Part 7 of 8 splitting up #814. Based on #823.

Summary

Each chart's legend is a box that floats over the chart. On a phone the box covers most of the plot.

On a phone the legend now sits in a box below its chart, so the whole chart is visible. On a tablet and laptop the legends float in the corner exactly as before. To make room, the chart area no longer has a fixed height on a phone. The chart itself keeps its own height.

Test Plan

  1. Run the app and open the edit page of a case that has results.
  2. On a phone, each chart's legend sits in a box below the chart, and the whole chart is visible.
  3. On a tablet and laptop, the legends stay in the corner of the charts, as before.

Lint, typecheck and format checks pass. Unit tests fail the same way they did before this change.

Screenshots

Before After
Heating System Demand chart (phone)
Whole-home Heat Loss chart (phone)
Heating System Demand chart (laptop, legend stays in the corner)
Whole-home Heat Loss chart (laptop)

Next: #825


return (
<div className="absolute right-6 top-6 rounded border border-gray-200 bg-white p-4 shadow-sm">
<div className="mx-4 mb-4 mt-2 rounded border border-gray-200 bg-white p-4 shadow-sm md:absolute md:right-6 md:top-6 md:m-0">

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusts the legend position so it sits below the graphs on smaller formats, as the legend on normal format sits on top of the graph content and when the graph shrinks, the legend covers the data. In larger formats, we still render with standard positioning. md:m-0 cancels out the smaller-format margins so there's no shift


{/* Responsive container to ensure chart resizes */}
<div className="relative h-[400px] w-full">
<div className="relative w-full md:h-[400px]">

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same wrapper changes as previous


return (
<div className="absolute bottom-20 right-6 z-10 rounded border border-gray-200 bg-white p-4 shadow-sm">
<div className="mx-4 mb-4 mt-2 rounded border border-gray-200 bg-white p-4 shadow-sm md:absolute md:bottom-20 md:right-6 md:z-10 md:m-0">

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same legend change as above

@seanjonesmc
seanjonesmc added this pull request to stack #826 November 18, 2026 00:29
@mxd1760 mxd1760 self-assigned this Nov 18, 2026

@mxd1760 mxd1760 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does what it says and makes the smaller graphs readable.

@mxd1760 mxd1760 removed their assignment Nov 18, 2026
@mxd1760
mxd1760 force-pushed the fix/814/responsive-chart-legends branch 5 times, most recently from 8e8101b to 17321a9 Compare November 25, 2026 00:44
Base automatically changed from fix/814/responsive-charts to main November 25, 2026 00:45
seanjonesmc and others added 2 commits November 24, 2026 19:45
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mxd1760
mxd1760 force-pushed the fix/814/responsive-chart-legends branch from 17321a9 to 0c0ffee Compare November 25, 2026 00:45
@mxd1760
mxd1760 merged commit 9c2b185 into main Nov 25, 2026
10 checks passed
@mxd1760
mxd1760 deleted the fix/814/responsive-chart-legends branch November 25, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants