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/Feat: Maintain consistency of assigned comparison colors #4198

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

briangregoryholmes
Copy link
Contributor

@briangregoryholmes briangregoryholmes commented Feb 28, 2024

This PR changes the logic by which comparison colors are assigned. Previously, if you had three values selected, they would be assigned blue, orange and green in order. If you then toggled the blue value, the other colors would be re-assigned. Orange would turn blue and green would turn orange. With this PR, toggling the blue value simply frees blue up to be assigned to the next selected value and does not change any of the other colors.

This is a temporary solution to a problem that will eventually be solved by a state management refactor. There are also some quirks in the way this is implemented that have to do with how the TDDTable component works, which will also be refactored soon.

@briangregoryholmes briangregoryholmes changed the title color assignment tweaks Maintain consistency of assigned comparison colors Feb 28, 2024
@nishantmonu51
Copy link
Collaborator

@briangregoryholmes : Is this still a draft ? wondering if we can get this over the finish line for current release ?

@briangregoryholmes briangregoryholmes changed the title Maintain consistency of assigned comparison colors Fix/Feat: Maintain consistency of assigned comparison colors Mar 13, 2024
@briangregoryholmes
Copy link
Contributor Author

@nishantmonu51 Took care of the last outstanding issue. Ready for review.

@briangregoryholmes briangregoryholmes marked this pull request as ready for review March 13, 2024 16:55
Copy link
Member

@djbarnwal djbarnwal left a comment

Choose a reason for hiding this comment

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

Have added some comments around usage of $page and other changes.

Apart from that seeing some regression. When max colored comparison is reached, toggling off a dimension value doesn't change the colors of inactive dimensions.

Kapture.2024-03-18.at.18.23.36.mp4

Apart from that, for Leaderboard and Dimension Detail table, the max limit is 7 and for TDD it's 11 (since it has a bigger chart surface to accommodate more lines)

web-common/src/features/dashboards/filters/colorGetter.ts Outdated Show resolved Hide resolved
web-common/src/features/dashboards/filters/colorGetter.ts Outdated Show resolved Hide resolved
Comment on lines 213 to 215
$: colors = dimensionData.map((d) => {
return colorGetter.get($page.params.name, d.dimension, d.value ?? "");
});
Copy link
Member

Choose a reason for hiding this comment

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

Since this is only used for MeasureChart, we can move this inside the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's placed here because the colors are not unique to each MeasureChart, but rather to the MetricsTimeSeriesChart view. They only need to be fetched once regardless of the number of charts. Also, because of some upstream issues with TimeSeriesChartContainer and GraphicContext, MeasureChart will re-render dozens of times when you scrub or add new filter pills so placing it there would add a lot of unnecessary calls.

@briangregoryholmes
Copy link
Contributor Author

briangregoryholmes commented Mar 22, 2024

Updated to use metricsViewName throughout.

Your point about the regression is a fair one, though I'll rope in @mindspank @jkhwu for their thoughts since I think there are multiple solutions. In my view, we should never be reassigning a comparison color without explicit user interaction, even inactive ones. If I deselect blue, I expect the chart to no longer be showing a blue line.

As such, I updated the PR to match the "capping" behavior in a way that still maintains that goal. Clicking an eighth comparison assigns it, for instance, slate-500. That check would display as gray-300 since it's over the 7 comparison cap (on the Leaderboard), but if you deselect any of the other active colors, then it will turn to slate-500.

Copy link
Member

@djbarnwal djbarnwal left a comment

Choose a reason for hiding this comment

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

Still seeing this state for TDD. Perhaps that was missed?

image

@nishantmonu51
Copy link
Collaborator

@briangregoryholmes : bumping this up. Its open from a long time. Lets try to get this over the finish line this week. +cc @ericpgreen2

@briangregoryholmes briangregoryholmes marked this pull request as draft May 6, 2024 22:22
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.

None yet

3 participants