0

Line chart breaks after null value as the title says. It plots line until point with value: null comes, after that only points are plotted but line isn't. I can fix this by manually changing null into 0 or NaN and it will be plotted as 0 or connected from last non-null value to the next non-null value, but i would like a non-continuous line.

enter image description here

I've seen solution to this problem here and tried to implement it using patch-package (which does it job in changing node_modules package) but the change isn't seen in Chrome's DevTools. https://github.com/swimlane/ngx-charts/issues/799

One of the errors i get in Chrome's DevTools: enter image description here

How to replicate? Install ngx-charts and insert series that contains element with value null. You can also try to add patch-package and add following code at the end of functions getLineGenerator() and getRangeGenerator() which is supposed to fix this issue.

.defined(function(d) {
            return d.value !== null; ;
        });
Gašper Štepec
  • 115
  • 1
  • 1
  • 7
  • Can you add your data which contain the null values? – Martin Godzina Jan 05 '22 at 21:35
  • [{"name":"Hoja","series":[{"name":"2020-05-05T00:00:00.000Z","value":"75.23"},{"name":"2020-05-06T00:00:00.000Z","value":"84.06"},{"name":"2020-05-07T00:00:00.000Z","value":"89.89"},{"name":"2020-05-08T00:00:00.000Z","value":"91.03"},{"name":"2020-05-09T00:00:00.000Z","value":"88.0"},{"name":"2020-05-10T00:00:00.000Z","value":"82.63"},{"name":"2020-05-11T00:00:00.000Z","value":null},{"name":"2020-05-12T00:00:00.000Z","value":null},{"name":"2020-05-13T00:00:00.000Z","value":"75.34"},{"name":"2020-05-14T00:00:00.000Z","value":"83.07"}]}] – Gašper Štepec Jan 05 '22 at 21:42
  • I've made it work. There's multiple files containing these 2 functions. The right one is node_modules/@swimlane/ngx-charts/fesm2015/swimlane-ngx-charts.js – Gašper Štepec Jan 05 '22 at 22:02

0 Answers0