site-kit-wp: Duplicate Dates on Graphs when 7 Days Selected

Bug Description

While testing #3517 I noticed that the dates on the x-axis were duplicated when 7 days was selected. After further investigation it appears that this issue appears on all graphs, i.e. on AdSense, Analytics, etc.

dates

Steps to reproduce

  1. Make sure you are on the develop branch
  2. Go to a Module page, i.e. Analytics
  3. Select 7 days
  4. Scroll down to the graph and observe the dates

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • In any of the chronological charts on the per-module pages (Search Console, AdSense, Analytics) it should never happen that a single date is displayed multiple times as label for the x-axis.
    • This is particularly relevant for the “last 7 days” filter, in which right now it usually causes several dates to display more than once.

Implementation Brief

In assets/js/modules/analytics/components/module/ModuleOverviewWidget/SiteStats.js

  • Create an array of only Date objects from dataMap
  • Add this to the options object for the key hAxis.ticks (Make sure to spread in ...SiteStats.options.hAxis so as not to override any existing options)

(Work done on branch here https://github.com/google/site-kit-wp/tree/bug/3643-Duplicate-Dates-Graphs-7-Days__idea-1)

Test Coverage

  • N/A

Visual Regression Changes

  • N/A

QA Brief

For each of the chronological charts on the per-module pages (Search Console, AdSense, Analytics)

  • View with the “last 7 days” filter,
  • Observe that no dates are repeated on the x-axis (see the original problem on the screenshot in ticket description)

Changelog entry

  • Update stats graphs not to duplicate dates when 7 days period is selected.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@wpdarren I see this bug on the AdSense, Analytics, and Search Console pages. Is there anywhere else you spotted?

@danielgent those are the only places I noticed the duplicate dates, when 7 days was selected.

Just a headsup that my changes have caused some VRT regressions.

Upon looking at the differences, I don’t think it’s actually an improvement

before and after

before-A

after-A

another before and after

before-B

after-B

I could restrict my changes to only take effect when the user has selected Last 7 days

@eugene-manuilov I’ve just realized that @wpdarren mentioned several modules in the description, but my IB is only for the analytics module

Not a huge problem, I’ll see if I can do anything clever to not duplicate code, and then I’ll assign the CR to you 👍