Error when using ngx-charts-line-chart in version 9.0.0
See original GitHub issueI’m submitting a … (check one with “x”)
- bug report - search github for a similar issue or PR before submitting
- feature request
- support request - use StackOverflow (add the
ngx-charts
tag) or the gitter chat for support questions
Current behavior
The ngx-charts-line-chart is throwing an error in the console Error: <rect> attribute x: Expected length, "NaN".
and is not visible. This error occurred after updating the package to version 9.0.0.
Expected behavior The chart should not throw an error in the console and should be visible.
Reproduction of the problem
Current template config:
<ngx-charts-line-chart [scheme]="{domain: ['#ef6c00']}" [results]="data" [xAxis]="true" [yAxis]="true" [legend]="false" [showXAxisLabel]="true" [showYAxisLabel]="true" [xAxisLabel]="'X-Axis-Label'" [yAxisLabel]="'Y-Axis-Label'" [autoScale]="true">
What is the motivation / use case for changing the behavior?
Please tell us about your environment: Windows: v10 Node: v9.8.0 NPM: v6.2.0 Yarn: 1.7.0
-
ngx-charts version: 9.0.0
-
Angular version: 6.0.9
-
Browser: all
-
Language: TypeScript 2.7.2
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
so why was this closed? it should be reopened, as the blitz shows https://stackblitz.com/edit/vertical-bar-chart-ubfedd the lib does not handle empty arrays properly, one thing is putting NaN in svg and throwing that errors, and another one is that odd empty tooltip + line showing up when hovering…
version 12.0.1
@Mazi10987 Please try the same with “new Date()” function like -
"series": [ { "name": new Date("2019-03-24T05:14:00Z"), "value": "0.031" }, { "name": new Date("2019-03-24T05:19:00Z"), "value": "0.015" }]
instead of"series": [ { "name": "2019-03-24T05:14:00Z", "value": "0.031" }, { "name": "2019-03-24T05:19:00Z", "value": "0.015" }