Add Plotly line charts view to Measurements page

Users can now switch to a Charts view that renders a separate
time-series line chart for each tracked quantity, using Plotly.js
loaded via CDN. Charts are sorted chronologically and styled to
match the app palette. A dedicated toggle button and matching
CSS visibility rules mirror the existing Compact/Wide view pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 22:36:24 +00:00
parent bfd427c9b2
commit 71c22f2280
6 changed files with 85 additions and 3 deletions

View File

@@ -14,6 +14,7 @@
<%= csp_meta_tag %>
<%= stylesheet_link_tag "spreadsheet" %>
<script src="https://cdn.plot.ly/plotly-basic-2.35.2.min.js"></script>
<%= javascript_importmap_tags %>
<%#= turbo_page_requires_reload_tag %>

View File

@@ -11,6 +11,9 @@
<%= image_button_tag '', 'view-columns', name: nil, type: 'button',
class: 'view-toggle', title: t('.view_wide'),
data: {view: 'wide'}, onclick: "setMeasurementsView('wide')" %>
<%= image_button_tag '', 'chart-line', name: nil, type: 'button',
class: 'view-toggle', title: t('.view_charts'),
data: {view: 'charts'}, onclick: "setMeasurementsView('charts')" %>
</div>
<div class="main-area measurements-section">
@@ -34,5 +37,6 @@
</table>
<div id="measurements-wide" class="measurements-wide"></div>
<div id="measurements-charts" class="measurements-charts"></div>
</div>