Skip to content

Conversation

Copy link

Copilot AI commented Jan 13, 2026

Categorical attributes were incorrectly processed as numerical data, computing meaningless statistics (mean, median, quartiles) and offering sort-by-mean functionality in the UI. Additionally, categorical attributes had plot type change options even though they only support one fixed visualization type.

Changes

Core Package

  • getSixNumberSummary: Added columnTypes parameter to filter out categorical attributes before computing statistics
  • Aggregation pipeline: Threaded columnTypes through firstAggregation, secondAggregation, and all helper functions (aggregateByDegree, aggregateBySets, etc.)
  • Sort safety: Added optional chaining in sortByAttribute to handle missing mean values gracefully

UI Package

  • AttributeButton: Check attribute type via attTypesSelector to conditionally render options for categorical attributes:
    • Exclude sort options (Ascending/Descending) since categorical attributes don't have meaningful numerical statistics to sort by
    • Exclude plot type change options (Box Plot, Dot Plot, Strip Plot, Density Plot) since categorical attributes only support one visualization type (stacked bar chart)
    • Disable click-to-sort behavior for categorical attributes

Example

Before:

getSixNumberSummary(items, memberItems, ['Age', 'Generation'])
// Would attempt to compute mean/median on 'Generation' strings

After:

getSixNumberSummary(items, memberItems, ['Age', 'Generation'], columnTypes)
// Internally filters to ['Age'] when 'Generation' is type 'category'

Context Menu Behavior

Categorical attributes (e.g., "Generation"):

  • ❌ No sort options
  • ❌ No plot type change options
  • ✅ Only "Remove [attribute]" option (if attribute removal is enabled)

Numerical attributes (e.g., "Age"):

  • ✅ Sort by Ascending/Descending
  • ✅ Change plot type options
  • ✅ Remove attribute option
Original prompt

This section details on the original issue you should resolve

<issue_title>Sort options should be removed from categorical attributes</issue_title>
<issue_description>It doesn't make sense to be able to sort by categorical atts; while this doesn't cause an error and SOME sorting occurs, this should be removed entirely. Relatedly, it appears that getSixNumberSummary can be called on categorical atts and returns a value ie for the Data Table; this should also be updated as a SixNumberSummary does not make sense for categorical atts.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link

netlify bot commented Jan 13, 2026

👷 Deploy Preview for upset2 processing.

Name Link
🔨 Latest commit 40a80d9
🔍 Latest deploy log https://app.netlify.com/projects/upset2/deploys/696685c7d519eb00086fb250

- Modified getSixNumberSummary to filter out categorical attributes internally
- Updated all call sites to pass columnTypes for proper filtering
- Removed sort options from context menu for categorical attributes
- Disabled click-to-sort for categorical attributes in AttributeButton
- Added optional chaining in sortByAttribute for safer access to mean values
- Added comments explaining the behavior for categorical attributes

Co-authored-by: JakeWags <35744963+JakeWags@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove sort options from categorical attributes Remove sort options and six-number summary from categorical attributes Jan 13, 2026
Copilot AI requested a review from JakeWags January 13, 2026 17:21
@JakeWags
Copy link
Member

@copilot We also need to remove the "change plot" options for categorical attributes since there is only one visualization type, which already exists and cannot be changed.

Categorical attributes only have one visualization type (stacked bar chart)
and cannot be changed to other plot types like Box Plot, Dot Plot, etc.
Updated AttributeButton to exclude plot type options when attribute is categorical.

Co-authored-by: JakeWags <35744963+JakeWags@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 13, 2026

@copilot We also need to remove the "change plot" options for categorical attributes since there is only one visualization type, which already exists and cannot be changed.

Done in commit 40a80d9. The "Change plot type to..." options are now excluded from the context menu for categorical attributes.

What changed:

  • Categorical attributes (like "Generation") only support one visualization type: the stacked bar chart
  • The context menu for categorical attributes now only shows "Remove [attribute]" (if enabled)
  • Numerical attributes continue to show all plot type options (Box Plot, Dot Plot, Strip Plot, Density Plot)

Implementation:
Added && !isCategorical check to the condition that adds plot type menu items, so they're only shown for non-categorical, non-UPSET attributes.

Copilot AI changed the title Remove sort options and six-number summary from categorical attributes Remove sort and plot type options from categorical attributes Jan 13, 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.

Sort options should be removed from categorical attributes

2 participants