Skip to content

fix(colors): discover chart colors after getColorPalette update #93792

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

Merged
merged 6 commits into from
Jun 18, 2025

Conversation

shellmayr
Copy link
Member

@shellmayr shellmayr commented Jun 18, 2025

  • fix: getColorPalette indexing #93699 changed the returned number of colors for getColorPalette. Other code depended on this - as indicated by comments, which broke some charts (missing colors, same colors).
Product Area Before After
Discover Screenshot 2025-06-18 at 11 12 35 Screenshot 2025-06-18 at 11 12 40
Dashboards Screenshot 2025-06-18 at 11 17 48 Screenshot 2025-06-18 at 11 17 43

and some more in tables, etc.

@shellmayr shellmayr marked this pull request as ready for review June 18, 2025 09:14
@shellmayr shellmayr requested review from a team as code owners June 18, 2025 09:14
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 18, 2025
@shellmayr shellmayr requested a review from a team June 18, 2025 09:14
@@ -106,7 +106,7 @@ function AggregatesTable({

const numberOfRowsNeedingColor = Math.min(result.data?.length ?? 0, TOP_EVENTS_LIMIT);

const palette = theme.chart.getColorPalette(numberOfRowsNeedingColor - 2); // -2 because getColorPalette artificially adds 1, I'm not sure why
const palette = theme.chart.getColorPalette(numberOfRowsNeedingColor);
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn’t this still be -1 then?

Copy link
Contributor

Choose a reason for hiding this comment

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

did that here: 6ea7821

the whole logic is a bit weird though because looking at numberOfRowsNeedingColor, we could get 0 back from that calculation:

const numberOfRowsNeedingColor = Math.min(result.data?.length ?? 0, TOP_EVENTS_LIMIT);

which means we’d go into the negative here, so palette would be undefined then :/

@shellmayr shellmayr merged commit f756223 into master Jun 18, 2025
46 checks passed
@shellmayr shellmayr deleted the shellmayr/fix/chart-colors-discover branch June 18, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants