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

Fix graph height calculation for small value ranges #59

Merged
merged 4 commits into from
Oct 26, 2024

Conversation

guptarohit
Copy link
Owner

@guptarohit guptarohit commented Oct 11, 2024

This merge request addresses an issue where graphs with small value ranges (less than 1) were not being displayed correctly, often resulting in a flat line at 0.00. This will resolve the issue #56.

The problem was caused by the height calculation rounding down to 0 for small intervals, which led to division by zero errors in subsequent calculations. This was also suggested by @palash25 in the comments of the issue, thanks.

Changes made to resolve the issue:

  • Refactored the height calculation logic into a separate function calculateHeight().
  • Implemented a scaling mechanism for small intervals, i.e. when the difference in max & min values of series is <1

The solution maintains consistency in height calculation across different scales of data, so graphs with ranges like {0.2, 0.3, 0.1} will have a similar appearance to graphs with ranges like {2, 3, 1}.

Also, refactored a bit related to the conflicting name of variables with built-in methods.

@coveralls
Copy link

coveralls commented Oct 11, 2024

Pull Request Test Coverage Report for Build 11530060756

Details

  • 17 of 17 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 96.063%

Totals Coverage Status
Change from base Build 10341981841: 0.08%
Covered Lines: 366
Relevant Lines: 381

💛 - Coveralls

@guptarohit guptarohit linked an issue Oct 11, 2024 that may be closed by this pull request
@guptarohit guptarohit self-assigned this Oct 12, 2024
@guptarohit guptarohit merged commit 1919005 into master Oct 26, 2024
8 checks passed
@guptarohit guptarohit mentioned this pull request Oct 26, 2024
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.

Incorrect plot
3 participants