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

Potential fix for an issue due to reliance on relative date #5

Closed
wants to merge 1 commit into from

Conversation

der-Lehmann
Copy link

Fixes #4 an issue where the SparkLine will only show SparkLineDay objects whose date does not differ from the current date by more than X days. Where X is the number of SparkLineDay objects passed into the SparkLine object (maxItemAmount).

That is because inside the resolveCoordinates method a collection of dates is created that is relative to the current date. Then those dates are used to find entries in the collection of SparkLineDay objects whose dates are not guaranteed to be relative to the current date.

This commit changed the way the SparkLineDay object of a day is retrieved by relying on the sort order of the $days collection.

Fixes an issue where the SparkLine will only show SparkLineDay objects whose date does not differ from the current date by more than X days. Where X is the number of SparkLineDay objects passed into the SparkLine object (maxItemAmount).

That is because inside the resolveCoordinates method a collection of dates is created that is relative to the current date. Then those dates are used to find entries in the collection of SparkLineDay objects whose dates are not guaranteed to be relative to the current date.

This commit changed the way the SparkLineDay object of a day is retrieved by relying on the sort order of the $days collection.
@der-Lehmann der-Lehmann changed the title Update SparkLine.php Potential fix for an issue due to reliance on relative date Oct 22, 2023
@brendt
Copy link
Owner

brendt commented Jun 11, 2024

v2 gets rid of the concept of days, so we don't need to fix this anymore :)

@brendt brendt closed this Jun 11, 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.

The SVG render a straight line only, no matter how data is
2 participants