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

Speed up sparklines when larger periods are selected and improve detection of trends as well as fix comparison of dates #20090

Merged
merged 9 commits into from Dec 12, 2022

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 10, 2022

Description:

  • fix Change sparklines visualisation depending on the selected date range #20066 when selecting currently eg a date range of 2 years it can take 2 minutes to load. Instead, we select 24 months which takes 2 seconds and allows the detection of trends much better.
    • When now selecting a range of 6+ months Matomo will plot weeks in the sparklines
    • When now selecting a range of 24+ months Matomo will plot months in the sparklines
  • Fix sparklines when comparing dates. Eg when you compared year vs previous year, then Matomo would load the previous 9 years in days (3000+days) and compared it to 1 year entry. It's completely broken visually and also performance wise it takes forever to load. Now no matter what period is selected, it will behave consistently and compare the selected dates. Eg when a year is compared to previous year, then we're showing the weeks of the first year and also plot the years of the second year so you can compare both years in detail. When comparing, selecting eg the previous 30 periods and comparing them is not as useful (although it can be).
    • --> Right now without this change comparing any date of a week, month or year is basically broken as the sparklines never load.
    • --> It now also makes the sparklines behavior consistent with the evolution graph.
  • We're now showing tooltips when possible to describe what date range and period the sparkline is showing. Before this was never clear eg when a year is selected, it's not obvious if Matomo is showing the months in that period or the previous years.
  • Changed the logic to have things tested and clearly defined and so the behaviour can be changed easily.
  • This PR does not change anything in the evolution graph.

Review

@tsteur tsteur marked this pull request as draft December 10, 2022 23:03
@tsteur tsteur marked this pull request as ready for review December 11, 2022 20:43
@tsteur tsteur added the Needs Review PRs that need a code review label Dec 11, 2022
@tsteur tsteur added this to the 4.13.1 milestone Dec 11, 2022
Copy link
Contributor

@bx80 bx80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on different date ranges and comparisons, the sparkline periods behave as expected with weeks being chosen over days for ranges over six months and months being chosen for ranges over two years. Should be a nice performance boost 👍

@tsteur
Copy link
Member Author

tsteur commented Dec 12, 2022

Thanks @bx80 for reviewing 👍

@tsteur tsteur merged commit 72f39a4 into 4.x-dev Dec 12, 2022
@tsteur tsteur deleted the fixsparklines branch December 12, 2022 00:17
tsteur added a commit that referenced this pull request Dec 12, 2022
…t compares correct periods

Since we merged #20090 when comparing dates we no longer need to force day periods when comparing date ranges since we're ensuring the correct period is being used in the Sparklines visualisation.
sgiehl added a commit that referenced this pull request Dec 12, 2022
…t compares correct periods (#20094)

Since we merged #20090 when comparing dates we no longer need to force day periods when comparing date ranges since we're ensuring the correct period is being used in the Sparklines visualisation.

Co-authored-by: sgiehl <stefan@matomo.org>
@justinvelluppillai justinvelluppillai added c: Performance For when we could improve the performance / speed of Matomo. and removed Needs Review PRs that need a code review labels Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Performance For when we could improve the performance / speed of Matomo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change sparklines visualisation depending on the selected date range
3 participants