Ngx-charts: ERROR TypeError: n.rgb is not a function

Created on 29 Oct 2019  路  8Comments  路  Source: swimlane/ngx-charts

Describe the bug
I have added several bar graphs to my Angular 8.2.12 application, and they work beautifully. I recently added a heat map, and I am seeing the following error:

main.663f7eda36bb1abc50f2.js:1 ERROR TypeError: n.rgb is not a function
at MI (main.663f7eda36bb1abc50f2.js:1)
at AI (main.663f7eda36bb1abc50f2.js:1)
at t (main.663f7eda36bb1abc50f2.js:1)
at eR (main.663f7eda36bb1abc50f2.js:1)
at jR (main.663f7eda36bb1abc50f2.js:1)
at n.c [as scale] (main.663f7eda36bb1abc50f2.js:1)
at n.getColor (main.663f7eda36bb1abc50f2.js:1)
at main.663f7eda36bb1abc50f2.js:1
at Array.map ()
at main.663f7eda36bb1abc50f2.js:1

ngx-charts version
I am using nix-charts 12.0.1, and this problem is visible in both Safari, and Chrome.

Bug

Most helpful comment

I solved my problem. Updated version of @angular-devkit/build-angular from 0.801.0 to 0.803.17.

All 8 comments

I have the same problem. As a workaround I use the angular-cli option --optimization=false.

I solved my problem. Updated version of @angular-devkit/build-angular from 0.801.0 to 0.803.17.

Hello,

I got the error when I have reload the page. In "@angular-devkit/build-angular": "^0.10.6" version

Error TypeError: t.rgb is not a function

Thanks @Michel73 Updated version of @angular-devkit/build-angular solved the issue

Having the same issue with latest angular packages. None of the solutions above worked.

Project works fine in npm start / jit mode, but not int AOT.

I think the issue is related to d3 packages. I solve this kind of problem with this solution.
https://github.com/swimlane/ngx-charts/issues/1305#issuecomment-557113006

The d3 packages have been updated in v 13.0.0. Closing this as fixed. Please open a new issue if you still see a problem.

Was this page helpful?
0 / 5 - 0 ratings