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

StatPanel: Add padding between horizontal name and value #55299

Merged
merged 4 commits into from Sep 16, 2022

Conversation

JoaoSilvaGrafana
Copy link
Contributor

What this PR does / why we need it:

The Stat Panel has an option to set the data horizontally and they currently have no space between the name and the value. This PR adds some padding there.

Before After
Screenshot 2022-09-15 at 17 59 57 Screenshot 2022-09-15 at 18 00 33

Which issue(s) this PR fixes:

Fixes #54160

const styles: CSSProperties = {
fontSize: `${this.titleFontSize}px`,
lineHeight: LINE_HEIGHT,
};

if (this.props.parentOrientation === VizOrientation.Horizontal && this.justifyCenter) {
styles.paddingRight = this.props.theme.spacing(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

what would something font-dependant look like, like 1ch (or maybe like 0.75ch) instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Put differently, is using fixed pixels, where the gap will remain constant size regardless of the surrounding font size, the right approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Here is what a very small and very large one look like, the top line is with 8px padding the bottom one is with 0.75ch. You barely notice the difference on the big one but on the small one the ch definitely looks better:
Screenshot 2022-09-16 at 14 42 15
Screenshot 2022-09-16 at 14 42 22

@grafanabot
Copy link
Contributor

@grafanabot
Copy link
Contributor

@grafanabot
Copy link
Contributor

@JoaoSilvaGrafana JoaoSilvaGrafana merged commit bf5b215 into main Sep 16, 2022
@JoaoSilvaGrafana JoaoSilvaGrafana deleted the joao_silva/spacing-stat-panel branch September 16, 2022 16:53
@dsotirakis dsotirakis modified the milestones: 9.2.0, 9.2.0-beta1 Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stat display needs tweak to allow spacing between name and value
4 participants