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

Fixed line chart shows negative values #1594

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harshpjoshi
Copy link

@harshpjoshi harshpjoshi commented Feb 27, 2024

fix: Adjust bar path to fit within a specified rectangular area, #1593

This commit adds a new function called adjustPath that takes a Path and a Rect as parameters. The function adjusts the given path to fit within the specified rectangular area by clamping the path's points to the rect's boundaries. This ensures that the bar path is always fully visible within the chart area.

The function iterates over the path metrics of the input path and for each path metric, it iterates over its length. For each iteration, it gets the tangent at the current offset and checks if the tangent's position is within the rectangular area. If it's not, the position is clamped to the rect's boundaries. Finally, the adjusted path is returned.

@imaNNeo
Copy link
Owner

imaNNeo commented Feb 28, 2024

I think this approach adds some bugs. For example, there might be some displacements between the line and the grid lines behind it.

@imaNNeo
Copy link
Owner

imaNNeo commented Feb 28, 2024

Ahh, now I see the issue.

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