Skip to content

ledmatrix-stocks: compact layout — definite chart size + content-sized entries - #225

Open
ChuckBuilds wants to merge 2 commits into
mainfrom
fix/stocks-price-chart-gap
Open

ledmatrix-stocks: compact layout — definite chart size + content-sized entries#225
ChuckBuilds wants to merge 2 commits into
mainfrom
fix/stocks-price-chart-gap

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Problem

The stock ticker layout scaled with the display, so it got massive on large/4x panels and in vegas mode:

  • The mini-chart width was a fraction of the per-entry canvas (display_width × multiplier) and its height a fraction of the display height — so it ballooned on wide chains (e.g. ~204px wide at 256) and on tall 4x panels (e.g. ~85px tall at 128).
  • The chart was anchored to the far-right of a wide canvas while the price sat on the left, leaving a large empty gap between them (~135px at 256×64).
  • The per-entry canvas was a fixed display-scaled guess, leaving dead trailing space between tickers.

Changes

  • Definite chart size. New config display.chart_width_px / display.chart_height_px (default 64×32), a fixed pixel size that does not scale with the display and is clamped to the panel. Replaces chart_width_percent / chart_height_percent.
  • Chart next to the price. Drawn directly to the right of the price text (small fixed gap) instead of anchored far-right.
  • Content-sized entries. Each entry canvas is measured (logo + text + chart) and sized to fit, so there's no dead space between tickers — and no chart/text overlap (an earlier clamp-based approach overlapped on narrow panels with a big logo).

Verification

  • Chart renders a constant 64×32 at 64×128 (tall/4x), 256×64 (wide), and 128×32; no overlap on the tall panel; price→chart gap is a small fixed 6px (was up to 135px).
  • Vegas-style multi-ticker strips are compact with consistent spacing.
  • Plugin safety harness passes at all sizes (64×32 → 256×128).

Manifest bumped 2.4.0 → 2.5.0 (config schema change); README + schema updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ

The inline mini-chart was anchored to the far-right of the per-entry scroll
canvas (~2x display width), while the price text sits just right of the logo.
On larger panels this left a big empty gap between the price and the chart
(e.g. ~135px at 256x64).

Draw the chart immediately to the right of the text column (small fixed gap,
clamped so it stays on-canvas for unusually wide text), then crop the entry
canvas to the content so the leftover space doesn't become dead scroll gap.
_draw_mini_chart gains an optional chart_x (defaults to the old right-anchored
position). Also removes the now-unneeded text/chart overlap clamp.

Verified by rendering mock data: price->chart gap drops from 135px to 6px at
256x64 (already tight at 128x32), no overlap, wide-text case stays on-canvas,
and the safety harness passes at all sizes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Stock chart layout

Layer / File(s) Summary
Inline chart placement and cropping
plugins/ledmatrix-stocks/display_renderer.py
The mini-chart is positioned beside the text column when enabled, with explicit chart coordinates supported and the canvas cropped to the rendered content.
Plugin release metadata
plugins.json, plugins/ledmatrix-stocks/manifest.json
Plugin version metadata and changelog entries are updated from 2.4.0 to 2.4.1, dated 2026-07-28.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: a more compact stock layout with chart placement and content-sized entry cropping.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/stocks-price-chart-gap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ledmatrix-stocks/display_renderer.py`:
- Around line 299-318: The chart placement in the renderer can overlap the text
when the clamped chart position falls inside the text column. Update the
toggle_chart path around _draw_mini_chart to preserve the intended chart_width
by expanding the rendering canvas before drawing, or skip the chart when it
cannot fit beside text; do not move the chart left into the text area. Ensure
rendering remains correct for all supported matrix sizes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1bf0b5f-caae-4364-befa-b46b70d0c1fa

📥 Commits

Reviewing files that changed from the base of the PR and between e1769a0 and 4d78959.

📒 Files selected for processing (3)
  • plugins.json
  • plugins/ledmatrix-stocks/display_renderer.py
  • plugins/ledmatrix-stocks/manifest.json

Comment thread plugins/ledmatrix-stocks/display_renderer.py Outdated
Make the mini-chart a fixed pixel size (chart_width_px / chart_height_px,
default 64x32) instead of a fraction of the display. Previously width was a
fraction of the display-scaled canvas and height a fraction of the display
height, so the chart ballooned on wide chains and tall 4x panels (and looked
"massive" in vegas mode).

Also size each entry's canvas to its actual measured content (logo + text +
chart) instead of a display-scaled guess that was then clamped. This removes
the dead space between tickers and fixes a chart/text overlap that the clamp
caused on narrow panels with a large logo.

Replaces the chart_width_percent / chart_height_percent config keys with
chart_width_px / chart_height_px (README + schema updated).

Verified: chart is a constant 64x32 at 64x128, 256x64, 128x32; no overlap on
the tall panel; vegas-style strips are compact; safety harness passes at all
sizes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@ChuckBuilds ChuckBuilds changed the title fix(ledmatrix-stocks): minimize the gap between the price and the mini-chart ledmatrix-stocks: compact layout — definite chart size + content-sized entries Jul 28, 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.

2 participants