Chart components do not take data labels into account for layout #1852

Closed
opened 2026-01-29 17:59:23 +00:00 by claunia · 3 comments
Owner

Originally created by @sfiruch on GitHub (Sep 3, 2025).

Chart components do not seem to take the size of data labels into account when computing layouts. This results in data labels that go outside the bounds of the chart component.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://blazor.radzen.com/donut-chart?theme=material3
  2. Check "Show Data Labels"
  3. Resize the browser window to be narrow

Expected behavior
The data label for Q1 should not be cut off.

Screenshots
Image

The left-most data label for Q1 is cut off. It should say "30000".

Desktop (please complete the following information):
Tested with Edge 139.0.3405.125 on Windows 11.

Originally created by @sfiruch on GitHub (Sep 3, 2025). Chart components do not seem to take the size of data labels into account when computing layouts. This results in data labels that go outside the bounds of the chart component. **To Reproduce** Steps to reproduce the behavior: 1. Go to https://blazor.radzen.com/donut-chart?theme=material3 2. Check "Show Data Labels" 3. Resize the browser window to be narrow **Expected behavior** The data label for Q1 should not be cut off. **Screenshots** <img width="485" height="779" alt="Image" src="https://github.com/user-attachments/assets/138d6f75-2e60-4ebe-a870-8d672b470db4" /> The left-most data label for Q1 is cut off. It should say "30000". **Desktop (please complete the following information):** Tested with Edge 139.0.3405.125 on Windows 11.
Author
Owner

@akorchev commented on GitHub (Sep 3, 2025):

Indeed data labels aren't taken into account when computing the layout. We don't plan to change that as it isn't trivial implementation (and in cases as this one there isn't a very good placement for them). We recommend either disabling them or changing the size of the chart if you need it to fit in tight space.

@akorchev commented on GitHub (Sep 3, 2025): Indeed data labels aren't taken into account when computing the layout. We don't plan to change that as it isn't trivial implementation (and in cases as this one there isn't a very good placement for them). We recommend either disabling them or changing the size of the chart if you need it to fit in tight space.
Author
Owner

@sfiruch commented on GitHub (Sep 4, 2025):

Thank you for confirming my suspicion :)

For me as caller, the problem appears to be even more difficult to solve, because I don't know where the data labels will be placed. Perhaps I didn't understand your suggestion?

To prevent the problem I would have to add a border around the chart, big enough to fit the largest label. This is a lot of whitespace, meaning that the charts end up tiny.

@sfiruch commented on GitHub (Sep 4, 2025): Thank you for confirming my suspicion :) For me as caller, the problem appears to be even more difficult to solve, because I don't know where the data labels will be placed. Perhaps I didn't understand your suggestion? To prevent the problem I would have to add a border around the chart, big enough to fit the largest label. This is a *lot* of whitespace, meaning that the charts end up tiny.
Author
Owner

@akorchev commented on GitHub (Sep 8, 2025):

I am afraid the only other solution I can suggest is to disable the labels. The current label rendering algorithm assumes there is enough space for them to display.

@akorchev commented on GitHub (Sep 8, 2025): I am afraid the only other solution I can suggest is to disable the labels. The current label rendering algorithm assumes there is enough space for them to display.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1852