'NotYetImplemented error ng2-charts

Getting an error with message "NotYetImplemented" from utils.js .

I get the error while using nodejs server, what this exact error means?

When I'm using "ng serve" there is no such error.

I'm using line chart from ng2-charts module.

Full Stack Trace:

ERROR Error: NotYetImplemented
    at HTMLCanvasElement.exports.nyi (/home/project15/web/node_modules/domino/lib/utils.js:41:9)
    at BaseChartDirective.ngOnInit (/home/project15/web/node_modules/ng2-charts/charts/charts.js:24:47)
    at checkAndUpdateDirectiveInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:12439:19)
    at checkAndUpdateNodeInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13966:20)
    at checkAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13909:16)
    at prodCheckAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14633:5)
    at Object.updateDirectives (/home/project15/web/dist-server/main.bundle.js:1:51133)
    at Object.updateDirectives (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14355:29)
    at checkAndUpdateView (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13875:14)
    at callViewAction (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14226:21)

Using the following:

NodeJS: 9.3.0

Angular: 5.1.2

OS: linux x64

"chart.js": "^2.7.1"

"ng2-charts": "^1.6.0"

EDIT :

setup for node server:

https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce

Error is visible in the terminal after accessing the web url, while running the command

node server.js


Solution 1:[1]

I had the same issue and solve it as below:

1- Create a boolean in your component .ts file and set its value like this

import { Inject, PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";

isBrowser: boolean;

constructor(@Inject(PLATFORM_ID) private platformId: unknown) {}

ngOnInit(): void {
    this.isBrowser = isPlatformBrowser(this.platformId);
}

2- Then in your HTML file use the ng2-charts HTML tag as below

<canvas *ngIf="isBrowser"
        baseChart
        ...
        ...
        ... >
</canvas>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamran Taghaddos