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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Donut summary metric value and label responsiveness #243

Open
marshallpete opened this issue Apr 15, 2024 · 0 comments
Open

Donut summary metric value and label responsiveness #243

marshallpete opened this issue Apr 15, 2024 · 0 comments
Labels
enhancement New feature or request rsc:Donut

Comments

@marshallpete
Copy link
Member

marshallpete commented Apr 15, 2024

Provide a general summary of the feature here

The summary metric and value at the center of a donut chart should be responsive to the size of the donut hole.

image

馃 Expected Behavior?

An algorithm should figure out target font size of both the metric value and the metric label based on the donut hole radius.

The font sizes for both the metric value and metric label should have max and min values.

Metric value (need to verify these look good once implemented)

  • max: 72
  • min: 18

Metric label (need to verify these look good once implemented)

  • max: 48
  • min: 12

If text is too wide to fit without overlapping the donut ring, it should be truncated.

If the inner radius of the donut is less than 100 (need to try this out and adjust as needed once implemented), then the metric value and metric label should not be drawn at all.

All the pixel values listed here are starting points. They will need to be adjusted once we have a basic implementation and can try out this feature.

馃拋 Possible Solution

If the inner radius is < 100px. Set the fontSize for the summary text to 0.

To figure out the available width for the text. you can use the pythagorean theorem (a^2 + b^2 = c^2).

Variables:
r = inner radius of the donut
h = font size + any offset from the circle center
w = available width for the text

Solution:
(2r)^2 = (2h)^2 + w^2
w = 2 * sqrt(r^2 - h^2)

Example:
Inner radius is 200px and the font height is 24 and the offset from center is 4.
w = 2 * sqrt(200^2 - (24 + 4)^2)
w = 396px

馃敠 Context

If you have a larger donut chart, the summary number and value should be larger.
If you have a smaller donut chart, the summary number and value should be smaller.
If the donut is really small, there shouldn't be any summary info in the center.
If the donut is a displayed as a pie chart, we also shouldn't have any summary content in the center.

馃捇 Examples

No response

馃Б Your Company/Team

Adobe

@marshallpete marshallpete added the enhancement New feature or request label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rsc:Donut
Projects
None yet
Development

No branches or pull requests

2 participants