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(analytics-chart): better legend label truncation [MA-2048] #789

Merged

Conversation

filipgutica
Copy link
Contributor

@filipgutica filipgutica commented Sep 14, 2023

https://konghq.atlassian.net/browse/MA-2048

Summary

Only truncate the label when the legend grows such that it begins to wrap to multiple rows.

calculate the number of row in the grid layout, representing
the legend by comparing the "top" position of each item
incrementing the numberOfRows each time there is a difference.

Use the number of rows to determine if a label should be
truncated or not.

Truncate when list grows and wraps to a new row.

https://www.loom.com/share/c338d6643f9d4f46baf49de6245e468a

Truncate on window resize if legend is forced into a new row.

https://www.loom.com/share/bf2b6c0d7a03428ea290f3059fe6d01d

PR Checklist

  • Naming & Structure: the files and package structure use the conventions outlined in the Creating a Package docs.
  • Tests pass: check the output of all package unit and/or component tests.
    • If this PR is the result of a bug, test coverage was added accordingly.
  • Functional: all changes do not break existing APIs, but if so, a BREAKING CHANGE commit is in place to bump the major version.
  • Conventional Commits all commits follow the conventional commit standards outlined in the main README.
  • Docs: includes a technically accurate README, and the docs have been updated accordingly based on the changes in this PR.

@filipgutica filipgutica force-pushed the fix/analytics-chart-legend-item-truncation-too-aggressive branch from 93bd08e to 50c3587 Compare September 14, 2023 20:22
Copy link
Contributor

@adorack adorack left a comment

Choose a reason for hiding this comment

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

It looks like there's something a bit off with the alignment of long labels?

image

@filipgutica
Copy link
Contributor Author

It looks like there's something a bit off with the alignment of long labels?

image

I'm not sure I follow regarding the alignment.

image

@filipgutica filipgutica force-pushed the fix/analytics-chart-legend-item-truncation-too-aggressive branch from 46581a5 to cd8a88b Compare September 15, 2023 02:34
calculate the number of row in the grid layout, representing
the legend by comparing the "top" position of each item
incrementing the numberOfRows each time there is a difference.

Use the number of rows to determine if a label should be
truncated or not
@filipgutica filipgutica force-pushed the fix/analytics-chart-legend-item-truncation-too-aggressive branch from cd8a88b to 1b4914b Compare September 15, 2023 03:20
@filipgutica filipgutica requested a review from adorack September 15, 2023 03:22
mihai-peteu
mihai-peteu previously approved these changes Sep 15, 2023
@filipgutica filipgutica force-pushed the fix/analytics-chart-legend-item-truncation-too-aggressive branch from 36a7385 to b77e90f Compare September 15, 2023 16:33
@filipgutica filipgutica dismissed adorack’s stale review September 15, 2023 22:29

Addressed your comments. Since you're on PTO, got approval from @mihai-peteu

@filipgutica filipgutica merged commit 20b30fd into main Sep 15, 2023
5 checks passed
@filipgutica filipgutica deleted the fix/analytics-chart-legend-item-truncation-too-aggressive branch September 15, 2023 22:30
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.

3 participants