fix(plugin-chart-echarts): exclude extra metrics from stacked totals - #42855
Open
krishn1301 wants to merge 1 commit into
Open
fix(plugin-chart-echarts): exclude extra metrics from stacked totals#42855krishn1301 wants to merge 1 commit into
krishn1301 wants to merge 1 commit into
Conversation
extractDataTotalValues summed every numeric column in each row, so a timeseries_limit_metric that is not rendered as a series still inflated the Only Total value. With metrics A=32, B=0 and a sort metric of 2, the total showed 34 instead of 32. Threads extraMetricLabels into extractDataTotalValues and excludes those columns from both the total and the derived threshold. Fixes apache#42701 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Code Review Agent Run #05c1ebActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes #42701.
With Stacked Style: Stack and Only Total enabled, the total shown above each bar included the sort metric. In the reported case, metrics
A = 32andB = 0with atimeseries_limit_metricof2displayed a total of 34 instead of 32.extractDataTotalValuessums every numeric column in each row:A sort metric is present in the query result but is never rendered as a series, so it silently inflated the total — and the
thresholdValuesderived from that total, which decides which labels are shown.This threads the extra metric labels into
extractDataTotalValuesand skips those columns when accumulating. The labels were already being computed intransformProps.tsviaextractExtraMetrics(...).map(getMetricLabel); that computation just happened after theextractDataTotalValuescall, so it's moved above and passed in. The new option is optional, so other callers ofextractDataTotalValuesare unaffected.TESTING INSTRUCTIONS
Four tests were added under
extractDataTotalValues, using the exact numbers from the issue:A=32, B=0, Sort=2gives[32](fails without this change)extraMetricLabelsare passed — the same row gives[34]thresholdValuesfrom the total excluding extra metrics (fails without this change)legendStatealongside the exclusionManually: build a Stacked Timeseries Bar chart with two metrics, set a Sort By metric that differs from both, enable Only Total, and confirm the total equals the sum of the visible segments.
ADDITIONAL INFORMATION