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

Visual indication of incomplete periods on charts #18086

Merged
merged 10 commits into from Oct 14, 2021

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Sep 30, 2021

Description:

Fixes #10291

For charts where the last point on the horizontal axis has a date that is either today or in the future, then that segment of the line will be plotted in a dashed style to indicate that data for that period will be incomplete.

image

Review

@bx80 bx80 added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Sep 30, 2021
@bx80 bx80 added this to the 4.6.0 milestone Sep 30, 2021
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

That already looks nice 👍
Left a comment as the date check isn't proper. Besides that I'm not sure if that change should also be reflected in the scheduled reports. For those the graphs are rendered using the ImageGraph plugin. That one currently won't use a dotted line for incomplete periods. Not sure if that should be the case for consistency reasons. ping @tsteur @mattab

plugins/CoreVisualizations/javascripts/jqplot.js Outdated Show resolved Hide resolved
@tsteur
Copy link
Member

tsteur commented Oct 3, 2021

ImageGraph we could have a separate issue for it maybe as most important be the UI (re 80/20 rule). cc @mattab

@mattab
Copy link
Member

mattab commented Oct 3, 2021

Sounds good to have a separate issue for it, as the most pain is felt in the UI 👍

@mattab
Copy link
Member

mattab commented Oct 4, 2021

Looks great. Feedback:

  • As people will wonder what the dashed line means, maybe we could edit the tooltip on the last period and mention (incomplete period.) under the date in the tooltip? or some other better wording?

@bx80 bx80 self-assigned this Oct 6, 2021
@tsteur
Copy link
Member

tsteur commented Oct 8, 2021

@bx80 looks like there might be changes from another PR in there from exclude parameters?

@bx80
Copy link
Contributor Author

bx80 commented Oct 10, 2021

@tsteur Because the periods service had been converted to vue while I was working on this issue I merged 4.x-dev into this branch to use those changes. The 4.x-dev branch now includes the exclude parameters change which I think is why those changes are appearing in this branch. I should perhaps have used rebase instead of merge?

@justinvelluppillai
Copy link
Contributor

@bx80 merge should normally be fine. I don't see any changes from your other PR here, has it resolved itself meantime or did I miss something? It does have some conflicts now though.

@tsteur
Copy link
Member

tsteur commented Oct 11, 2021

Looks all good to me and works @bx80 . Could we create a UI test though showing the dotted line that this works?

@bx80
Copy link
Contributor Author

bx80 commented Oct 11, 2021

It might be tricky to do a UI test as the dotted line will only show if the current period contains today, the check for whether it is today or not is being done in the periods service. I've tried overriding the Date.now() function prior to loading the page in a UI test, which is how the periods service tests work. but those tests directly call the periods calls, and that approach doesn't seem to work here, as I'm guessing a new javascript vm is being spawned by the test system when loading the page. Is there a usual way to fake today's date in javascript for a UI test?

@bx80
Copy link
Contributor Author

bx80 commented Oct 11, 2021

@justinvelluppillai The outstanding conflicts are all from the vue.js typescript build output, I suppose I'll need to merge 4.x-dev into this branch again to pickup whatever has changed CoreHome typescript in 4.x-dev and then do another ./console build:vue, then commit an updated set of UMDs, then resolve this branch conflict by preferring them over the current 4.x-dev versions (assuming 4.x-dev hasn't changed again in the meantime) Seems like a 'build vue' github action like we have for 'build js' could save a lot of time going forward.

@tsteur
Copy link
Member

tsteur commented Oct 12, 2021

@bx80 I was hoping that it might work similarly to https://github.com/matomo-org/matomo/blob/4.5.0/tests/UI/specs/OnlyRawDataNotification_spec.js#L11-L13

I'm thinking if we could use idSite=1&period=year&date=today as URL and in the fixture track a wee bit of data for this year, and some data for the past year, then this might work? We would probably just need to update the image once a year but otherwise the screenshot might not change.

Be great to check if that could work. It might be even easiest to create a new spec file just for this and a dedicated fixture where we track bit of data for this and for the previous year. Since it's something that could easily regress it be very valuable to have a screenshot test for it.

@bx80
Copy link
Contributor Author

bx80 commented Oct 13, 2021

@tsteur That approach worked well, thank you. I've committed a new UI test and dedicated fixture to create a few visits in the current and previous year and compare the visitors overview chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show difference in graphs for data of "unfinished periods" and "complete periods"
5 participants