Skip to content

feat: add metric name for big number chart types#33013

Closed
fardin-developer wants to merge 7 commits into
apache:masterfrom
fardin-developer:show-metric-big-number
Closed

feat: add metric name for big number chart types#33013
fardin-developer wants to merge 7 commits into
apache:masterfrom
fardin-developer:show-metric-big-number

Conversation

@fardin-developer
Copy link
Copy Markdown
Contributor

Fixes: #32985

SUMMARY

This PR introduces support for displaying the Metric name in Big Number chart types, including Big Number and Big Number with Time Comparison. The metric name appears above the main number, styled consistently with existing elements, and includes customization options in the control panel.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

CHANGES

  • Added metric name display to:
    • Big Number
    • Big Number with Time Comparison
  • Positioning and spacing follow existing patterns of Big Number and subtitle.
  • Metric name font size defaults to 24px and scales responsively with the chart.
  • Added toggle in Customize section to show/hide metric name.
  • Added input to control metric name font size (similar to Subheader Font Size).

BEFORE/AFTER SCREENSHOTS

Before

Screenshot 2025-04-07 at 1 28 27 AM
Screenshot 2025-04-07 at 1 32 45 AM

After

Screenshot 2025-04-07 at 12 34 36 AM
Screenshot 2025-04-07 at 12 35 58 AM

Screen.Recording.2025-04-07.at.12.32.34.AM.mov

ADDITIONAL NOTES

  • Ensured the feature behaves correctly across chart types and screen sizes.
  • Maintained dynamic scaling and visual hierarchy.
  • Verified with RTL support and Storybook examples.

CHECKLIST

  • Displayed metric name above the number for all Big Number chart types.
  • Used responsive font scaling with base size 24px.
  • Added toggle and font size input to Customize controls.
  • Verified RTL compatibility.

@dosubot dosubot Bot added the viz:charts:bignumber Related to BigNumber charts label Apr 6, 2025
Copy link
Copy Markdown

@korbit-ai korbit-ai Bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Functionality Incorrect Boolean Type Declaration ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/sharedControls.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/utils.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/PopKPI.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

@geido geido added hold! On hold preset:bounty Issues that have been selected by Preset and have a bounty attached. labels Apr 7, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2025

@kgabryje Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2025

@kgabryje Ephemeral environment spinning up at http://34.214.166.129:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be better to use the theme.typography.sizes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be weird if existing charts start showing the metric all of the sudden, wouldn't be better to default to false?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 for this. It should be either false by default (preferable I guess? and low effort solution) or we need a migration that sets that to false in existing charts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be weird if existing charts start showing the metric all of the sudden, wouldn't be better to default to false?

Fixed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same comment about default from above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Curious what's the header here? the big number? and probably we could use the same sizes as the header or subheader?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the header font size is used for displaying the big number. I’ve unified the font sizes for both the metric name and subheader (comparison) into a single array:
const sharedFontSizes = [16, 20, 26, 32, 40];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not fault of this PR but we could DRY these utils a bit since all these methods are pretty much the same but reading from different arrays: metricNameFontSizes, headerFontSizes etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I've DRYed it up, let me know if it looks good!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we DRY this to render any info? because this is the same as how you're rendering kickerFontSize

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup, I DRY’d it into a renderWithFontSize(rendererFn, fontSize) helper method that calculates the height based on the font size and optional trendline, and renders the desired content using the passed function.

@kgabryje
Copy link
Copy Markdown
Member

kgabryje commented Apr 7, 2025

I found 2 issues in BigNumber chart:

  1. We display the "not pretty" metric name instead of label
  2. I don't see an option to disable displaying metric name
  3. It appeared on an existing chart - the existing charts should remain unchanged
image

@kgabryje
Copy link
Copy Markdown
Member

kgabryje commented Apr 7, 2025

Do we want this feature in Big Number with Trendline as well? I think the feature wasn't implemented there

@sadpandajoe
Copy link
Copy Markdown
Member

@kasiazjc to review ui changes.

@fardin-developer
Copy link
Copy Markdown
Contributor Author

Do we want this feature in Big Number with Trendline as well? I think the feature wasn't implemented there

Thank you @kgabryje. I have added metric name for Big Number with Trendline as well.

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Apr 11, 2025
@fardin-developer
Copy link
Copy Markdown
Contributor Author

Created a new PR
#33099

Antonio-RiveroMartnez pushed a commit that referenced this pull request May 7, 2025
Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local>
LevisNgigi pushed a commit to LevisNgigi/superset that referenced this pull request Jun 18, 2025
…#33099)

Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local>
alexandrusoare pushed a commit to alexandrusoare/superset that referenced this pull request Jun 19, 2025
…#33099)

Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local>
(cherry picked from commit a928f8c)
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
…#33099)

Co-authored-by: Fardin Mustaque <fardinmustaque@Fardins-Mac-mini.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:npm doc Namespace | Anything related to documentation hold! On hold plugins preset:bounty Issues that have been selected by Preset and have a bounty attached. size/XXL viz:charts:bignumber Related to BigNumber charts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Show Metric for Big Number chart types

5 participants