Skip to content

style(analytics): filled/hollow legend circles + 30% area fills#73

Merged
WebTigers merged 6 commits into
mainfrom
fix/analytics-chart-style
Jul 26, 2026
Merged

style(analytics): filled/hollow legend circles + 30% area fills#73
WebTigers merged 6 commits into
mainfrom
fix/analytics-chart-style

Conversation

@WebTigers

Copy link
Copy Markdown
Owner

Two dashboard-chart tweaks requested after the chart started rendering:

  • Legend: the default Chart.js behavior struck a line through hidden series' labels. Replaced with a custom legend that draws a filled circle when shown and a hollow circle when hidden (via generateLabels off each dataset's visibility, hidden:false so the label is never struck through). A custom onClick keeps the click-to-toggle.
  • Fills: both lines now have a 30% translucent area fill (rgba(color, 0.3)) beneath them — Users in --bs-primary, Page views in --bs-secondary-color — via a small hex/rgb→rgba helper so the fill tracks the active theme/skin.

Deployed + verified on tiger-dev (asset serves 200).

🤖 Generated with Claude Code

WebTigers and others added 6 commits July 26, 2026 12:16
The default Chart.js legend struck through hidden series (confusing). Replace it with a
custom legend: a filled circle when the series is shown, a hollow circle when hidden
(click still toggles). Give both lines a translucent rgba(color, 0.3) area fill beneath
them (theme-color-derived via a small hex/rgb→rgba helper).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Order datasets [Page views, Users] so the blue Users line + fill render above the gray
Page views (later-drawn = on top); reverse the legend so Users still lists first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Chart.js draws datasets in reverse sorted order (lowest order/index drawn LAST = on
top), so the earlier array reorder pushed Users to the bottom. Use the explicit `order`
property (Users:0 over Page views:1) and drop the legend reverse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- dashboard: drop the Page views (gray) area fill to 15% (Users stays 30%)
- widget: its inline script sits in the page content, which parses BEFORE the admin
  layout's Chart.js — so 'typeof Chart === undefined' was true and it returned before
  even fetching (no numbers, no sparkline). Defer the work to DOMContentLoaded (Chart.js
  loaded by then) and populate the numbers regardless of the chart lib.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…both lines + legend

- both numbers now fs-2 (equal, prominent) instead of a huge Users + tiny Page views
- taller chart (56 -> 120px)
- plot BOTH Users + Page views (fills + z-order, Users on top) and show the same
  filled/hollow toggle legend as the full dashboard chart

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the Users/Page-views toggle into the numbers row as a custom HTML legend (filled/
hollow circles, click toggles), float the numbers over the chart (negative-margin
overlap), and enable the y-grid + x/y axis labels like the full dashboard chart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@WebTigers
WebTigers merged commit 2d55808 into main Jul 26, 2026
11 checks passed
@WebTigers WebTigers mentioned this pull request Jul 26, 2026
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.

1 participant