Skip to content

Conversation

@Light2Dark
Copy link
Contributor

@Light2Dark Light2Dark commented Nov 3, 2025

📝 Summary

CleanShot 2025-11-03 at 14 25 26

  • add min-width to all bars by re-proportioning the bar widths
  • count=1 is included as "others"
  • add categories: number as subtext for string charts

if show_column_summaries="stats"
CleanShot 2025-11-03 at 14 26 39

🔍 Description of Changes

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@Light2Dark Light2Dark requested a review from manzt as a code owner November 3, 2025 06:27
@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Nov 3, 2025 6:27am


return (
<div className="flex flex-col whitespace-pre -mt-1.5">
<span>categories: {prettyNumber(stats.unique, locale)}</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe unique over categories? i don't always think of each item as a category

case "string": {
const lessThan5Categories =
typeof stats.unique === "number" && stats.unique <= 5;
// Number of categories will be easily visible from the chart, so don't show it here.
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think its that easy to parse number of unique values, i would have to count each bar chart

@mscolnick mscolnick requested a review from Copilot November 3, 2025 14:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the table column summary feature by adding an others_threshold parameter to filter out low-count values and improve UI presentation of categorical data.

Key changes:

  • Added others_threshold parameter to _get_value_counts() method to filter values with counts below a threshold
  • Improved frontend display logic to hide redundant category counts when there are 5 or fewer categories with charts
  • Enhanced bar chart visualization with minimum bar width enforcement to improve visibility of small-count categories

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
marimo/_plugins/ui/_impl/table.py Added others_threshold parameter to _get_value_counts() method to enable filtering values by count threshold
tests/_plugins/ui/_impl/test_table.py Added test coverage for the new others_threshold parameter functionality
frontend/src/components/data-table/column-summary/column-summary.tsx Conditionally hide category count text when ≤5 categories and chart is shown, plus added negative margin styling
frontend/src/components/data-table/column-summary/chart-spec-model.tsx Implemented proportional bar width adjustment algorithm to ensure minimum 2% width for visibility of small bars

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1063 to +1064
others_threshold (int | None): The threshold for values to be considered 'others'.
If a value has a count less than or equal to this threshold, it will be considered 'others'.
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

[nitpick] The documentation states values with counts 'less than or equal to' the threshold are filtered, but the implementation at line 1089 only checks count <= others_threshold. This is correct, but the documentation could be clearer. Consider rephrasing to: 'The threshold for filtering values into others. Values with counts at or below this threshold will be excluded from the individual value list and grouped into others.'

Suggested change
others_threshold (int | None): The threshold for values to be considered 'others'.
If a value has a count less than or equal to this threshold, it will be considered 'others'.
others_threshold (int | None): The threshold for filtering values into others.
Values with counts at or below this threshold will be excluded from the individual value list and grouped into others.

Copilot uses AI. Check for mistakes.

// Calculate xStart and xEnd for each value count
// Adjust bar widths to ensure minimum width
const MIN_BAR_WIDTH_PERCENT = 0.02; // 2% minimum width
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

[nitpick] The magic number 0.02 should be defined as a named constant at the module or class level for better maintainability and reusability. Consider defining it as const MIN_BAR_WIDTH_PERCENT = 0.02 outside the function scope.

Copilot uses AI. Check for mistakes.
@Light2Dark Light2Dark marked this pull request as draft November 3, 2025 15:05
@Light2Dark Light2Dark changed the title add categories subtext and add min-width subtext add categories subtext and add min-width for each bar Nov 3, 2025
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.

3 participants