Skip to content

Conversation

@matchlessNostril
Copy link
Contributor

[Bug #1] Overflow Issue with Bars and DataLabels at Chart Edges

output2
Although the related issue #2264 was marked as resolved, the error still persists and the current fix is inadequate.

Problem Solving Description

dataLabels

  • Issue:

    • Data labels were sometimes displayed outside the x-axis range—overlapping with the y-axis or appearing without their corresponding bars.
    • This happened because there wasn’t a clear rule for when to hide them.
  • Solution:

    • Updated the filtering logic to ensure that only dataLabels corresponding to the current x-axis range are displayed. This guarantees that dataLabels do not overflow beyond the visible chart area.

Bars

  • Issue:

    • Bars were drawn beyond the x-axis boundaries because the grid element (elGridRectBar) that defines the bar chart’s grid dimensions was set wider than the x-axis range.
    • As a result, bars near the edges were partially rendered outside the intended chart area.
  • Solution:

    • Adjusted the size of elGridRectBar to match the x-axis range.
    • Also, added half a bar’s width to both ends of the range so that the entire bar is properly contained within the chart area.

To check the results, run start-watch-ref and switch between the main branch and the bug/bar-datalabel-overflow branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants