xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.11k stars 197 forks source link

ERROR TypeError: Cannot read property 'init' of null #252

Closed wjchicago closed 4 years ago

wjchicago commented 4 years ago

Hi Xieziyu,

I am using echarts in an Angular project. Basically I just used this 3D bar. https://echarts.apache.org/examples/en/editor.html?c=bar3d-punch-card&gl=1

In dev mode the graph works fine and can be shown on page. However in production build. There is an exception and graph cannot be displayed. Here is the stack trace.

main-es2015.82cd2d9aa52c748ae4fb.js:1 ERROR TypeError: Cannot read property 'init' of null
    at main-es2015.82cd2d9aa52c748ae4fb.js:1
    at l.invoke (polyfills-es2015.0e455a55c25c81d32f30.js:1)
    at i.run (polyfills-es2015.0e455a55c25c81d32f30.js:1)
    at _r.runOutsideAngular (main-es2015.82cd2d9aa52c748ae4fb.js:1)
    at d.createChart (main-es2015.82cd2d9aa52c748ae4fb.js:1)
    at d.onOptionsChange (main-es2015.82cd2d9aa52c748ae4fb.js:1)
    at d.initChart (main-es2015.82cd2d9aa52c748ae4fb.js:1)
    at main-es2015.82cd2d9aa52c748ae4fb.js:1
    at l.invokeTask (polyfills-es2015.0e455a55c25c81d32f30.js:1)
    at Object.onInvokeTask (main-es2015.82cd2d9aa52c748ae4fb.js:1)

I am new to both Angular and echarts. Do you mind to help? Below is the version and dependency info.

C:\projects\ficceqd-qis-web-ui>ng --version
Your global Angular CLI version (9.1.11) is greater than your local
version (9.1.0). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 9.1.0
Node: 10.16.0
OS: win32 x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: No

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.0
@angular-devkit/build-angular     0.901.0
@angular-devkit/build-optimizer   0.901.0
@angular-devkit/build-webpack     0.901.0
@angular-devkit/core              9.1.0
@angular-devkit/schematics        9.1.0
@ngtools/webpack                  9.1.0
@schematics/angular               9.1.0
@schematics/update                0.901.0
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

C:\projects\ficceqd-qis-web-ui>npm list --depth=0
sb-admin-angular@1.1.1 C:\CLSA\eclipse_workspace\ficceqd-qis\ficceqd-qis-web-ui
+-- @angular-devkit/build-angular@0.901.0
+-- @angular/animations@9.1.0
+-- @angular/cli@9.1.0
+-- @angular/common@9.1.0
+-- @angular/compiler@9.1.0
+-- @angular/compiler-cli@9.1.0
+-- @angular/core@9.1.0
+-- @angular/forms@9.1.0
+-- @angular/language-service@9.1.0
+-- UNMET PEER DEPENDENCY @angular/localize@^9.0.0
+-- @angular/platform-browser@9.1.0
+-- @angular/platform-browser-dynamic@9.1.0
+-- @angular/router@9.1.0
+-- @fortawesome/angular-fontawesome@0.6.1
+-- @fortawesome/fontawesome-svg-core@1.2.28
+-- @fortawesome/free-brands-svg-icons@5.13.0
+-- @fortawesome/free-regular-svg-icons@5.13.0
+-- @fortawesome/free-solid-svg-icons@5.13.0
+-- @inip/static-server@1.0.1
+-- @ng-bootstrap/ng-bootstrap@6.0.2
+-- @prettier/plugin-pug@1.2.0
+-- @sbpro/ng@1.1.3
+-- @types/chart.js@2.9.18
+-- @types/echarts@4.6.3
+-- @types/jasmine@3.5.10
+-- @types/jasminewd2@2.0.8
+-- @types/node@12.12.17
+-- @types/object-hash@1.3.1
+-- @types/uuid@7.0.2
+-- ag-grid-angular@23.2.1
+-- ag-grid-community@23.2.1
+-- ag-grid-enterprise@23.2.1
+-- bootstrap@4.4.1
+-- chart.js@2.9.3
+-- chokidar@3.3.1
+-- codelyzer@5.2.2
+-- concurrently@5.1.0
+-- cross-env@7.0.2
+-- echarts@4.8.0
+-- echarts-gl@1.1.1
+-- jasmine-core@3.5.0
+-- jasmine-spec-reporter@5.0.1
+-- UNMET PEER DEPENDENCY jquery@1.9.1 - 3
+-- karma@4.4.1
+-- karma-chrome-launcher@3.1.0
+-- karma-coverage-istanbul-reporter@2.1.1
+-- karma-jasmine@3.1.1
+-- karma-jasmine-html-reporter@1.5.3
+-- ngx-echarts@5.0.0
+-- object-hash@2.0.3
+-- UNMET PEER DEPENDENCY popper.js@^1.16.0
+-- prettier@2.0.2
+-- protractor@5.4.3
+-- pug@2.0.4
+-- pug-lint@2.6.0
+-- rxjs@6.5.5
+-- shelljs@0.8.3
+-- ts-node@8.8.1
+-- tslib@1.11.1
+-- tslint@6.1.1
+-- tslint-plugin-prettier@2.3.0
+-- typescript@3.8.3
+-- uuid@7.0.3
+-- webpack-bundle-analyzer@3.6.1
`-- zone.js@0.10.3
wjchicago commented 4 years ago

duplicate with #https://github.com/xieziyu/ngx-echarts/issues/243