cebor / angular-highcharts

Highcharts directive for Angular
MIT License
214 stars 63 forks source link

Cannot read property 'options' of undefined #196

Closed vadost closed 6 years ago

vadost commented 6 years ago

"@angular/core": "^6.0.7", "angular-highcharts": "^6.2.6", "highcharts": "^6.1.1",

BalanceHistoryChartComponent.html:1 ERROR TypeError: Cannot read property 'options' of undefined at a.Chart.redraw (highcharts.js:247) at a.Chart. (stock.src.js:8540) at a.Chart.a.(:8080/anonymous function) (http://localhost:8080/vendor.js:191211:80) at a.Chart. (stock.src.js:8540) at a.Chart.a.(:8080/anonymous function) [as redraw] (http://localhost:8080/vendor.js:191211:80) at e.update (highcharts.js:341) at eachBaseSeries (stock.src.js:6520) at Array.forEach () at a.each (highcharts.js:28) at Navigator.updateNavigatorSeries (stock.src.js:6475)

ERROR TypeError: Cannot read property 'normalize' of undefined at Navigator.onMouseMove (stock.src.js:5984) at HTMLDivElement.mouseMoveHandler (stock.src.js:5794) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:3748) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496) at invokeTask (zone.js:1540) at HTMLDivElement.globalZoneAwareCallback (zone.js:1566)

When I try to make a this chart (https://www.highcharts.com/stock/demo/column) appear errors @cebor Tell me please how it can be fixed?

vadost commented 6 years ago

It's all because I'm import the ChartModule in my SharedModule! If move all the Chart imports to the module where the chart is used, then everything works! But I would like that the ChartModule would be import once and in one place!

cebor commented 6 years ago

@vadost do you declare and re-export the ChartDirective in your SharedModule?

cebor commented 6 years ago

I'm not very common with Sharedmodules. Here is the ChartModule https://github.com/cebor/angular-highcharts/blob/master/src/chart.module.ts, can you tell me what i have to change to get your approach working?

hakimio commented 6 years ago

It works fine with SharedModule. You just have to export the module.

Iecy commented 6 years ago

Have you solved your problem? I had the same problem.

Iecy commented 6 years ago

I tried to introduce Highcharts in different modules, but it had the save problem.@cebor

vikkylu commented 6 years ago

No still i am struggling to resolve it,

On Tue, Jul 31, 2018 at 4:09 AM, paopao notifications@github.com wrote:

Have you solved your problem? I had the same problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cebor/angular-highcharts/issues/196#issuecomment-409070213, or mute the thread https://github.com/notifications/unsubscribe-auth/ARrd7hMdo2zhYk30IJg5_cLfhjo3D0WQks5uL7xEgaJpZM4U9T4M .

-- vikram

Iecy commented 6 years ago

Are you using his stock module, too? This makes me so miserable that I can't find the problem. If you have solved it, please reply to me @vikkylu

zymr-keshav commented 5 years ago

facing the same issue on angular v 6.1.10 angular-highcharts v 6.2.6

Even I have added chart modules on the modules where I have been using in imports and exports metadata

import { ChartModule } from 'angular-highcharts';

thow error:

ERROR in ./node_modules/angular-highcharts/angular-highcharts.es5.js Module not found: Error: Can't resolve 'highcharts' in '/opt/project-name/z-client/node_modules/angular-highcharts'

hakimio commented 5 years ago

@zymr-keshav create a test app which reproduces the problem if you still need help.

zymr-keshav commented 5 years ago

Yes, I still have the issue BUt now I have changed the library. I am confused whether your package is more reliable( Yes you have more starts definitely) and updated or the one which Highchart recommended on their website?

JFYI, I have the license for the highchair but do not know where and how to use it.