question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update UserDimensionsPieChart to render an empty circle graphic when in "Zero Data" state

See original GitHub issue

Feature Description

As mentioned in the Zero States Design Doc, the UserDimensionsPieChart should render an empty pie chart when Analytic’s hasZeroData() selector (#4673).

Populated Design

CleanShot 2022-01-19 at 02 05 49

Proposed Zero State Design

CleanShot 2022-01-19 at 02 07 42

It seems wasteful (and possibly buggy) to render a Google chart for this component. If straightforward, we should render a static, responsive SVG/element that mimics an empty, grey pie chart whenever Analytics is in a “Zero Data state” eg. select( MODULE_ANALYTICS ).hasZeroData() === true.


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

Acceptance criteria

  • The changes for this issue should only happen when the zeroDataStates feature flag is enabled. #4726
  • When select( MODULE_ANALYTICS ).hasZeroData() === true, assets/js/modules/analytics/components/dashboard/DashboardAllTrafficWidget/UserDimensionsPieChart.js should render an empty grey Pie Chart. See: https://www.figma.com/file/lPdnmgVoPqOEO82AMle9gH/Zero-State?node-id=435%3A2481
  • It could be worth, briefly, exploring using Google Charts to render this pie chart programatically with no report data to show, but I suspect it might cause an error. Otherwise, this should be rendered using a component rendering an SVG/element (eg. a responsive representation of the empty pie chart, like in the Figma mockup).
  • Other parts of this component’s redesign will be handled in another issue; this is specific to the Pie Chart rendering empty data.

Implementation Brief

  • Implement the following only when the zeroDataStates feature flag is enabled.
  • Export the empty chart icon from Figma and save it as assets/svg/icons/pie-chart-zero-data.svg.

Within assets/js/modules/analytics/components/dashboard/DashboardAllTrafficWidget/UserDimensionsPieChart.js:

  • Import the new pie-chart-zero-data.svg icon as PieChartZeroData.
  • Retrieve hasZeroData via useSelect -> select( MODULE_ANALYTICS ).hasZeroData().
  • Replace the current unconditional rendering of GoogleChart with a conditional render. When hasZeroData is true, render the following, otherwise render GoogleChart as usual.
<div className="googlesitekit-widget--analyticsAllTraffic__chart-zero-data">
	<PieChartZeroData />
</div>

Within assets/sass/components/dashboard/_googlesitekit-dashboard-charts.scss:

  • Add the class googlesitekit-widget--analyticsAllTraffic__chart-zero-data as follows:
.googlesitekit-widget--analyticsAllTraffic__chart-zero-data {
	align-items: center;
	display: flex;
	justify-content: center;
	min-height: 368px;

	> svg {
		height: 300px;
		width: 300px;
	}
}

Test Coverage

  • Add a new Zero Data (zeroDataStates enabled) variants to the All Traffic Widget stories in stories/module-analytics-components.stories.js.

QA Brief

Note: The empty chart is displayed using the colour #CCC, making use of the current palette.

  • Connect Analytics using an account with zero data.
  • Enable the zeroDataStates feature flag.
  • Navigate to the Dashboard.
  • Verify the empty chart is displayed as per the AC.
  • Navigate to the Entity Dashboard.
  • Verify the empty chart is displayed as per the AC.
  • Verify the two new Zero Data (zeroDataStates enabled) Storybook stories display correctly: image

Changelog entry

  • Improve the zero state design in the All Traffic Widget.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
techanvilcommented, Mar 11, 2022

@techanvil re. the gathering data, yes, I ended up editing my comment after because I’d realised my mistake smile As for the out of scope point, sure will create a ticket for that. Thanks for looking at this!

No problem! Sorry I didn’t spot your edit, and thanks for creating the issue.

0reactions
wpdarrencommented, Mar 11, 2022

QA Update: ✅

Verified:

  • For main dashboard: the empty chart is displayed as per the AC/Figma file.
  • For entity dashboard: the empty chart is displayed as per the AC/Figma file.
  • The two new Zero Data (zeroDataStates enabled) on Storybook display correctly.
  • Checked with unifiedDashboard enabled and disabled.
  • Checked on small screen sizes.
Screenshots

image image image image

Read more comments on GitHub >

github_iconTop Results From Across the Web

UI best practices for loading, error, and empty states in React
Here, we cover the best practices to use in client-side rendered React apps when handling loading, error, and empty state.
Read more >
Render Blank Pie Chartwhen no data - Kendo UI for jQuery
An example on how to show an empty pie chart when no data is available. ... Modify the article above to use a...
Read more >
Empty States – The Most Overlooked Aspect of UX - Toptal
Empty states are important to the user experience but are often overlooked. Knowing what they are and how to use them, and applying...
Read more >
Empty states - Carbon Design System
Empty states are moments in an app where there is no data to display to the user. They are most commonly seen the...
Read more >
6 Proven Tips to Engage With Empty State Designs
Empty states are a great way to offer unmatched user experience and foster better product engagement. Also referred to as zero-design states, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found