Fixed line chart shows negative values #1594
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: Adjust bar path to fit within a specified rectangular area, #1593
This commit adds a new function called
adjustPath
that takes aPath
and aRect
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.