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.

Visibility observer causing performance issues

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior When using ngx-charts, I noticed in my profiling tab that something was running every 50ms. I tracked it down to the VisibilityObserver.

This is what it looks like. screen shot 2017-09-28 at 19 57 50

I’m not exactly sure what the observer does, but my dashboard is showing 6 charts and it looks like the UI becomes kinda unresponsive because of this.

Expected behavior /

Reproduction of the problem /

What is the motivation / use case for changing the behavior? Performance issue

Please tell us about your environment: macOS, VS Code, Angular-CLI

  • ngx-charts version: 6.0.2

  • Angular version: 4.x

  • Browser: all

  • Language: TypeScript

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
SamVerschuerencommented, Sep 28, 2017

This is how I fixed it. It feels really hacky though and somehow I think it should be solved in this library. This made sure those values are not 0 and prevents the VisibilityObserver to trigger an infinite loop.

	ngx-charts-advanced-pie-chart,
	ngx-charts-number-card,
	ngx-charts-bar-vertical,
	ngx-charts-bar-horizontal,
	ngx-charts-tree-map,
	ngx-charts-charts {
		display: block;
		min-height: 1px;
	}
0reactions
shah-dhavalcommented, Jun 19, 2020

Please add this to documentation so anyone face issue set width height

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript Intersection Observer: Everything You Need to Know
Use the Intersection Observer API to implement lazy loading, infinite scrolling, and more, without using complicated logic or causing performance issues.
Read more >
Timing element visibility with the Intersection Observer API
In this article, we'll build a mock blog which has a number of ads interspersed among the contents of the page, then use...
Read more >
Intersection Observer API for Element Visibility ... - Medium
The significant performance overhead this causes through continuous polling leads to image loading, page loading, and scrolling delay. Lazy ...
Read more >
IntersectionObserver API Performance: Many vs. Shared In ...
At this point, it may become clear that sharing IntersectionObserver instances has better performance. But, if we dig a bit deeper, it becomes...
Read more >
Intersection Observer fails sometimes when i scroll fast
Intersection Observer runs an asynchronous function in a loop which checks the position of observed DOM elements.
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