Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove sort values on stacked totals #31333

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Dec 7, 2024

SUMMARY

When a y axis sort is selected with a stacked bar chart with totals shown, the y axis column value was being added to the total. This pr checks that only the metrics are being used in calculating totals by passing in the list of metrics labels to the total calculation function, and only totaling the columns that are metrics, not the ones used in sorting.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
image

After:
Screenshot 2024-12-06 at 4 54 10 PM

TESTING INSTRUCTIONS

Create a chart with one metric, and a sort value. Turn on stacked and show values. The sort value column should not be added to the total of the metric.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added the viz:charts:bar Related to the Bar chart label Dec 7, 2024
@eschutho eschutho force-pushed the elizabeth/fix-stacked-totals branch 2 times, most recently from 215661b to e685c5d Compare December 7, 2024 01:08
@@ -568,7 +568,7 @@ if (isDevMode) {
warnings: false,
runtimeErrors: error => !/ResizeObserver/.test(error.message),
},
logging: 'error',
logging: 'verbose',
Copy link
Member

Choose a reason for hiding this comment

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

Is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for catching.. no that was just for testing.

@eschutho eschutho force-pushed the elizabeth/fix-stacked-totals branch 3 times, most recently from 33390fb to a3084fc Compare January 8, 2025 22:05
@eschutho eschutho force-pushed the elizabeth/fix-stacked-totals branch 2 times, most recently from c860ef7 to e0efdfc Compare January 14, 2025 00:56
@eschutho
Copy link
Member Author

/testenv up

Copy link
Contributor

@eschutho Processing your ephemeral environment request here.

@eschutho eschutho force-pushed the elizabeth/fix-stacked-totals branch 3 times, most recently from 2e38e59 to 5e87689 Compare January 18, 2025 02:01
@eschutho eschutho force-pushed the elizabeth/fix-stacked-totals branch from 5e87689 to 9fd7f26 Compare January 18, 2025 02:02

const metricMapFunc = (metric: string | AdhocMetric) => {
if (metric.hasOwnProperty('label')) {
return (metric as AdhocMetric).label;
Copy link
Member

Choose a reason for hiding this comment

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

I think we already have a util getMetricLabel for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants