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
Latest version in the plnkr
Angular version:
Same error +1
I have the same bug implementing tree map chart on angular 2, any suggestions to solve this?
I have a solution:
Init your chartData link that:
public chartData = [{ 'name': 'init', 'value': 0 }];
and refresh after push in array link that:
this.chartData.push({ 'name': varStr, 'value': varNumber});
this.chartData = [...this._chartData];
I think it's missing a condition on the empty array
We will fix this. In the meantime, you can also just hide the chart with *ngIf until the data is ready.
I'm having this problem. Has it been fixed in any version?
@williangd what version are you using? I believe this was addressed in 7.3.0.
Please reopen if this is still an issue.
Most helpful comment
We will fix this. In the meantime, you can also just hide the chart with *ngIf until the data is ready.