Page MenuHomePhabricator

Add clickable pie slice in the Traffic graphic
Closed, ResolvedPublicFeature

Description

Summary

On the Pageviews app, the "Referrers" pie chart in the sidebar (single-page queries, e.g. https://pageviews.wmcloud.org/?project=en.wikipedia.org&pages=Nicole%20Saphier&range=latest-30) is display-only. Its slices should be clickable: clicking a slice for a referring article should open the Pageviews report for that article.

Why

The pie answers "where does this article's traffic come from?", and the natural next question is "how popular is that source itself?". At the moment the user has to read the slice name from the tooltip, retype it into the page box and rerun the query. Clicking the slice would do that in one step. It would also fit the other links already in that panel (the Referrers heading links to WikiNav, and the "All languages" and "Redirects" links go to other apps).

Expected behaviour

  • Slices for article referrers have a pointer cursor and open /pageviews?project=…&platform=…&agent=…&start=…&end=…&pages=<referrer title> in a new tab. The current project, platform, agent and date range are kept; only the page changes.
  • Slices that have no article do nothing and show no pointer cursor: the Clickstream pseudo-referrers (other-search, other-empty, other-internal, other-external, other-other) and the pooled "Other" slice.
  • Keyboard and screen-reader access is unchanged. The chart's aria-label already lists the slices as text. A follow-up could expose the links there too.

Where

The pie lives in the rewrite at https://gitlab.wikimedia.org/repos/data-engineering/pageviews (the GitHub repo is archived):

  • assets/vue/apps/pageviews/Totals.vue: add a target (the article title) to the article slices in referrerSeries, and an openReferrer() handler for a new @slice-click event.
  • assets/vue/charts/options/circular.js: sliceData() passes target through and sets cursor: 'pointer' on slices that have one.
  • assets/vue/composables/useChart.js and assets/vue/components/Chart.vue: register an ECharts click handler for pie series and emit it as slice-click.
  • assets/vue/apps/pageviews/Totals.test.js: tests for which slices get a target, the URL opened, and that slices without a target are ignored.

image.png (239×345 px, 18 KB)

Event Timeline

The WikiNav API is currently down (I've reported this). When it's back up, I'll get this implemented.

MusikAnimal claimed this task.
MusikAnimal moved this task from Backlog to Done on the Tool-Pageviews board.