-
Notifications
You must be signed in to change notification settings - Fork 14.9k
fix(chart): Restore subheader used in bignumber with trendline #33196
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
Conversation
@@ -294,6 +343,11 @@ class BigNumberVis extends PureComponent<BigNumberVizProps> { | |||
{this.renderHeader( | |||
Math.ceil(headerFontSize * (1 - PROPORTION.TRENDLINE) * height), | |||
)} | |||
{this.rendermetricComparisonSummary( | |||
Math.ceil( | |||
subheaderFontSize * (1 - PROPORTION.TRENDLINE) * height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this to metricComparisonFontSize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can,this means the subheader font size in the UI needs updating here well?
); | ||
expect(result.headerFormatter.format(500)).toBe('$500'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great!
@geido Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
@geido Ephemeral environment spinning up at http://44.247.250.79:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
Hey! The suffix is working as expected, however, when you set a subtitle, and you remove it, it's not clearing it up: Screen.Recording.2025-04-23.at.4.09.00.PM.mov |
@Antonio-RiveroMartnez Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
@Antonio-RiveroMartnez Ephemeral environment spinning up at http://34.221.106.45:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, subheader and subtitle working as expected
Screen.Recording.2025-04-23.at.8.42.43.PM.mov
Performed below manual tests on my end:
![]() ![]() |
@LevisNgigi my last comment was longer just to highlight the testing scenarios and flows, but to summarize, these are the remaining issues:
To easily repro this:
![]() ![]() ![]() Let me know if you have any questions! |
@Vitor-Avila Thanks for the thorough testing and concise feedback with repro steps.The steps were super helpful! I’ve fixed the subtitle duplication issue for Big Number charts. However, the issue where legacy charts (those created with subheader only) don’t show the subtitle content or correct size in Explore is still pending. Mapping the control to subheader brings back the value in explore and configs are restored, but it prevents the subtitle from being fully clearable, which isn’t ideal.Since subheader is also used as the comparison suffix in Big Number with Trendline, a simple migration isn’t straightforward I think.So wondering the best way forward. |
@LevisNgigi glad to help and excited we're making progress here! 🙌 hmm could we make the migration dynamic based on the viz type? If it's a Big Number migrate Let me know if that makes sense/is possible -- I'm not super close to our frontend logic so it's totally possible that this wouldn't work/isn't possible. |
if ( | ||
form_data.viz_type === 'big_number_total' && | ||
slice?.form_data?.subheader && | ||
(!controls.subtitle?.value || controls.subtitle.value === '') | ||
) { | ||
controls.subtitle = { | ||
...controls.subtitle, | ||
value: slice.form_data.subheader, | ||
}; | ||
} | ||
if ( | ||
form_data.viz_type === 'big_number_total' && | ||
slice?.form_data?.subheader_font_size && | ||
(!controls.subtitle_font_size?.value || | ||
controls.subtitle_font_size.value === '') | ||
) { | ||
controls.subtitle_font_size = { | ||
...controls.subtitle_font_size, | ||
value: slice.form_data.subheader_font_size, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting this change for two reasons:
- It moves the second change (
controls.subtitle_font_size = slice.form_data.subheader_font_size
) as part of the firstif
block. This is mostly because if the chart has asubheader
config and does not have asubtitle
config, thensubheader_font_size
should be the source of truth. For safety, just checking ifslice?.form_data?.subheader_font_size
exists. - In the current implementation,
!controls.subtitle_font_size?.value
is evaluated. I believecontrols.subtitle_font_size
always gets a default value, so that secondif
would never really execute and instead the oldsubheader
ends up with the default size.
if ( | |
form_data.viz_type === 'big_number_total' && | |
slice?.form_data?.subheader && | |
(!controls.subtitle?.value || controls.subtitle.value === '') | |
) { | |
controls.subtitle = { | |
...controls.subtitle, | |
value: slice.form_data.subheader, | |
}; | |
} | |
if ( | |
form_data.viz_type === 'big_number_total' && | |
slice?.form_data?.subheader_font_size && | |
(!controls.subtitle_font_size?.value || | |
controls.subtitle_font_size.value === '') | |
) { | |
controls.subtitle_font_size = { | |
...controls.subtitle_font_size, | |
value: slice.form_data.subheader_font_size, | |
}; | |
} | |
if ( | |
form_data.viz_type === 'big_number_total' && | |
slice?.form_data?.subheader && | |
(!controls.subtitle?.value || controls.subtitle.value === '') | |
) { | |
controls.subtitle = { | |
...controls.subtitle, | |
value: slice.form_data.subheader, | |
}; | |
if (slice?.form_data?.subheader_font_size) { | |
controls.subtitle_font_size = { | |
...controls.subtitle_font_size, | |
value: slice.form_data.subheader_font_size, | |
}; | |
} | |
} |
@LevisNgigi thank you so much for taking the time to implement these fixes! 🙏 I tested the flow again and:
I suggested a potential fix for this remaining issue, but I didn't want to commit it as I want your thoughts on it first. If you're comfortable with it, feel free to push it to this branch and I can do one final round of tests. 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
SUMMARY
We lost the subheader in the big number with trendline as we tried to map it to subtitle.This aims at restoring the subheader being used in big number with trendline.
related to this pr
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE

AFTER

TESTING INSTRUCTIONS
1)Create or open a chart using Big Number with Trendline chart configured with subheader/comparison suffix such as Wow,MoM etc
2)Confirm that the chart displays the subheader as expected.
ADDITIONAL INFORMATION