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: Big Number side cut fixed #31407

Merged
merged 6 commits into from
Dec 27, 2024
Merged

fix: Big Number side cut fixed #31407

merged 6 commits into from
Dec 27, 2024

Conversation

fardin-developer
Copy link
Contributor

@fardin-developer fardin-developer commented Dec 11, 2024

SUMMARY

Fixes #31010

BEFORE/AFTER SCREENSHOTS

Before
Screenshot 2024-12-11 at 10 35 47 PM

After

Screenshot 2024-12-11 at 10 36 07 PM

Solution

  • Adjusted the chart rendering logic to dynamically resize the font to fit the available space.
  • Ensured compatibility with all font size options (Small, Tiny, Normal, Large, Huge).

@dosubot dosubot bot added the viz:charts:bignumber Related to BigNumber charts label Dec 11, 2024
@fardin-developer fardin-developer changed the title Big Number side cut fixed Fixes #{31010} Big Number side cut fixed Fixes Dec 11, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@rusackas rusackas requested a review from geido December 11, 2024 19:46
@rusackas
Copy link
Member

Updated the PR description to correctly link to and close the issue.

@sadpandajoe sadpandajoe changed the title Big Number side cut fixed Fixes fix: Big Number side cut fixed Dec 11, 2024
@sadpandajoe sadpandajoe added the hold! On hold label Dec 12, 2024
@geido geido added the preset:bounty Issues that have been selected by Preset and have a bounty attached. label Dec 13, 2024
@geido geido requested a review from kgabryje December 13, 2024 17:00
@kgabryje
Copy link
Member

/testenv up

@kgabryje
Copy link
Member

@fardin-developer thanks for the contribution! Could you provide some repro steps? TBH I haven't seen that bug in quite some time

color: numberColor,
marginBottom: '10px',
Copy link
Member

Choose a reason for hiding this comment

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

is this additional margin needed here? If so, can we use theme.gridUnit * 2 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @kgabryje we need margin-bottom here to give some space between header and subheader. You are right we can use theme.gridUnit * 2
I've made the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kgabryje
Please review my pull request and suggest any additional changes if needed!

@fardin-developer
Copy link
Contributor Author

To repro the same bug:
Please follow the steps

  1. Go to Dashboards
  2. add + Dashboard
  3. create a new chart
  4. search big number
  5. Add big number
  6. Add dataset (search sales and add - cleaned_sales_data)
  7. from left side Colums drag sales and drop to Metric
  8. Simply save it (sum)
  9. Go to customize and increase the font to huge
  10. Format .3% or ,d like that which gives more number in header
  11. save and goto dashboard u can see the bug --- Thank You
    I will also share a video

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

@fardin-developer Thanks for this. Testing locally works. I have just some question about the prop being removed.

@@ -120,7 +120,7 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> {
className="kicker"
style={{
fontSize,
height: maxHeight,
height: 'auto',
Copy link
Member

Choose a reason for hiding this comment

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

Do we know what was the intended use of this maxHeight?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The maxHeight is used here for two purposes:

  • To calculate the fontSize dynamically, ensuring the text fits well.
  • To set the height of the div elements, like .header-line and .subheader-line.

Since these div elements only contain text, their height could automatically adjust based on the calculated fontSize. However, maxHeight is still important because it helps determine what the fontSize should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://painted-tune-041.notion.site/Results-1664127ab6d4806dbab9f3316356e257
Here I have uploaded all the changes and results related to updating height: maxHeight to height: auto.
Let me know if you’d like more details or have any suggestions.

@geido geido removed the hold! On hold label Dec 27, 2024
@geido geido merged commit 640dac1 into apache:master Dec 27, 2024
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins preset:bounty Issues that have been selected by Preset and have a bounty attached. size/S viz:charts:bignumber Related to BigNumber charts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Big Number + Big Number with Trendline get cut off on dashboards
5 participants