Skip to content

[ENHANCEMENT] - Added auto/custom legend sizing on multi-series stat panels - #778

Open
christophrichtersap wants to merge 2 commits into
perses:mainfrom
christophrichtersap:main
Open

[ENHANCEMENT] - Added auto/custom legend sizing on multi-series stat panels#778
christophrichtersap wants to merge 2 commits into
perses:mainfrom
christophrichtersap:main

Conversation

@christophrichtersap

@christophrichtersap christophrichtersap commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes perses/perses#3519

In multi-series stat panels, values rendered with different font sizes and legends appeared at inconsistent heights.

This PR picks the widest value (measured via Canvas) as the sizing reference for all cells same approach Grafana uses. Also unifies legend font sizing across cells and enforces a 12px minimum so labels stay readable

Allows default size or selecting custom px.

Single-series panels are unaffected.

Screenshots

image image image

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@christophrichtersap
christophrichtersap requested a review from a team as a code owner August 24, 2026 11:43
@christophrichtersap
christophrichtersap requested review from jgbernalp and removed request for a team August 24, 2026 11:43
@christophrichtersap
christophrichtersap marked this pull request as draft August 24, 2026 12:14
@christophrichtersap
christophrichtersap marked this pull request as ready for review August 24, 2026 12:33
@jgbernalp

Copy link
Copy Markdown
Contributor

@christophrichtersap can you please sign your commits?

…panels

- Cells auto-size to fit full series names (no truncation)
- Thin scrollbar appears on hover when content overflows
- Consistent font sizing across multi-series panels
- Add measureTextWidth utility for pixel-accurate layout
- Add "Font Size" control under Legend settings with auto default
- Fix formatValue import to use @perses-dev/core
- Use || instead of ?? after Number() to satisfy oxlint
- Fix oxfmt formatting (trailing commas, import order)
- Revert imports to match upstream packages

Signed-off-by: christophrichtersap <christoph.richter@sap.com>
@christophrichtersap

Copy link
Copy Markdown
Contributor Author

@christophrichtersap can you please sign your commits?

Ty for checking..done.

sparkline?: LineSeriesOption;
showSeriesName?: boolean;
valueFontSize?: FontSizeOption;
legendFontSize?: FontSizeOption;

@jgbernalp jgbernalp Aug 26, 2026

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.

In order to persist this information, we need to add these fields to the cue schema. Otherwise they wont be stored in the plugin spec.

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.

StatChart: Multiple enhancements in multiseries

2 participants