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.

Bug(tree map): 'Cannot read property 'filter' of undefined'

See original GitHub issue

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

[x] bug report 
[ ] feature request
[ ] support request

Current behavior The tree map component will crash if given an empty data collection

Expected behavior The component shouldn’t crash. Instead, it shouldn’t render any information/elements

Reproduction of the problem https://plnkr.co/edit/K9aaZWwZWkqxXDWZFgOo?p=preview

What is the motivation / use case for changing the behavior? The other chart components have no problems to handle empty data collections. I would expect the same of the tree map component

  • ngx-charts version:
  1. 4.x.x (local project)
  2. Latest version in the plnkr
  • Angular version:
  1. 2.4.x (local project)
  2. Latest version in the plnkr

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
marjan-georgievcommented, May 16, 2017

We will fix this. In the meantime, you can also just hide the chart with *ngIf until the data is ready.

1reaction
williangdcommented, Jul 27, 2018

I’m having this problem. Has it been fixed in any version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'filter' of Undefined in JS
The "Cannot read property 'filter' of undefined" error occurs when calling the filter() method on a variable that stores an undefined value.
Read more >
TypeError: Cannot read properties of undefined (reading 'map')
I had the same error and solved it by first asking if the array existed. Example: <Filter> { product.color?.map((c) => ( <FilterColor color ......
Read more >
cannot read properties of undefined (reading 'filter') in react js
Because you are using state.users here, filter expect it to be an array. const ...
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
Sometimes, your object is nested deeper like Tree.folder.path . You just have to make sure that if you need to access folder ,...
Read more >
Uncaught TypeError: Cannot read property '1' of undefined
This error is because there is a property field in that model, on that form that doesn't have his generic value defined, probably...
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