Conversation
| disableClearable | ||
| value={ | ||
| STAT_CHART_ORIENTATION_LABELS.find((i) => i.id === value.orientation) ?? | ||
| STAT_CHART_ORIENTATION_LABELS.find((i) => i.id === 'auto')! |
There was a problem hiding this comment.
I agree with the review point. Since STAT_CHART_ORIENTATION_LABELS is a fixed constant containing all valid orientation values, the ! and fallback to auto are unnecessary here. I'll simplify this to use the direct find() result.
|
|
||
| const statTileHeight = useMemo(() => { | ||
| if (isVerticalLayout) { | ||
| return Math.max(60, Math.floor(panelHeight / Math.max(1, statChartData.length))); |
There was a problem hiding this comment.
Could you explain number 60 here? Anyway, looks like a random number. May I ask you to put in a descriptive const
| chartWidth = Math.max(chartWidth, maxTextWidth); | ||
| } | ||
| if (isAutoWrapped) { | ||
| return Math.min(AUTO_TILE_HEIGHT, Math.max(60, Math.floor(panelHeight / autoRowCount))); |
There was a problem hiding this comment.
| alignmentText={alignmentText} | ||
| alignmentText={isAutoWrapped || !isVerticalLayout ? undefined : alignmentText} | ||
| alignmentSeriesName={alignmentSeriesName} | ||
| maxValueFontSize={!isAutoWrapped && !isVerticalLayout ? 96 : undefined} |
There was a problem hiding this comment.
96 is a random number. May I ask you to use a descriptive const instead?
|
@TridipDam Could you rebase with main branch please |
|
@TridipDam Linter is failing, please take a look |
|
@shahrokni Could you give me some time to work through the issues you mentioned? I'm fixing them all and will push the changes once they're done. |
Sure! Take your time |
|
@TridipDam What are our expectations from vertical and horizontal orientation?
|
My understanding is that orientation should affect only the layout, not the values or series order. Horizontal arranges series horizontally(uses default row layout), Vertical arranges them column wise. Please let me know if the expected behavior differs. |
True. But whether I set it to vertical or horizontal, the arrangement is the same. Could you please share the two outputs? (screenshots) |
yeah sure
|
Interesting!, I could not set it to vertical. I will test again. |
Yeah, I’ll submit the PR today. |
Signed-off-by: TridipDam <tridipdam001@gmail.com>
Signed-off-by: TridipDam <tridipdam001@gmail.com>
e81e740 to
a787f85
Compare
|
Done, I've pushed the changes to the PR. |







Description
This PR updates the Stat Chart plugin to support responsive stat tile orientations.
The layout dynamically adapts to the available panel width, allowing stat values to wrap into multiple rows instead of requiring a single horizontal row when many series are displayed.
This addresses the responsive layout requirement described in the main Perses issue:
perses/perses#4382
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes