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

Compacted scalars over different widths #16528

Merged
merged 5 commits into from
Jun 11, 2021
Merged

Compacted scalars over different widths #16528

merged 5 commits into from
Jun 11, 2021

Conversation

howonlee
Copy link
Contributor

@howonlee howonlee commented Jun 9, 2021

Problem: They don't compact when they should, sometimes #12629

Solution: Get the compaction to happen with respect to length of the full representation, not just to width of box

@howonlee howonlee requested a review from kulyk June 9, 2021 22:44
@howonlee howonlee marked this pull request as ready for review June 9, 2021 22:44
@howonlee
Copy link
Contributor Author

howonlee commented Jun 9, 2021

You can't actually repro the bug with 1.5 million, as far as I can tell, so I will go and figure out how to do 1.5 trillion

@howonlee
Copy link
Contributor Author

howonlee commented Jun 9, 2021

Also, is pictured: on mobile screen size the underlying problem doesn't occur at all, thanks to some responsive magic that existed beforehands
Screenshot from 2021-06-09 16-43-49

@kulyk
Copy link
Member

kulyk commented Jun 10, 2021

Hey @howonlee,

Not sure I'm the best person to review visualizations code. I guess @alxnddr has much more knowledge here than I do

I'd be happy to review anyway, but could you please provide some extra context like what was the problem, how did it look before, and some steps to reproduce it? Would be perfect if there is a dedicated issue I can check

Thank you!

@kulyk kulyk requested a review from alxnddr June 10, 2021 09:57
@howonlee
Copy link
Contributor Author

Hey @howonlee,

Not sure I'm the best person to review visualizations code. I guess @alxnddr has much more knowledge here than I do

I'd be happy to review anyway, but could you please provide some extra context like what was the problem, how did it look before, and some steps to reproduce it? Would be perfect if there is a dedicated issue I can check

Thank you!

This stuff is all Tom and Paul anyways

Underlying problem was that, if there were a lot of digits in a scalar being displayed in a box on a dashboard, it wouldn't compact properly if the box was too small. This was because the trigger for the compaction was based on overall box width alone, not anything to do with the content. This PR adds a consideration for the number of digits for the scalar.

Issue to check is #12629

@@ -33,6 +33,7 @@ function legacyScalarSettingsToFormatOptions(settings) {

// used below to determine whether we show compact formatting
const COMPACT_MAX_WIDTH = 250;
const COMPACT_WIDTH_PER_DIGIT = 25;
Copy link
Member

Choose a reason for hiding this comment

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

It looks a bit hackish tbh even though works fine. What do you think about comparing the real width of the scalar element?
We have it in this._scalar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried it and it starts flashing back and forth between the renders, giving it hysteresis would be pretty annoying I think

Copy link
Member

@kulyk kulyk left a comment

Choose a reason for hiding this comment

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

Works great. However, I'd better trust @alxnddr's review for that

@howonlee howonlee merged commit f74203a into release-x.39.x Jun 11, 2021
@howonlee howonlee deleted the hum-12629 branch June 11, 2021 17:05
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.

None yet

3 participants