question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: chartModule is not a function

See original GitHub issue

Hi.

I have a problem using angular-highcharts-stockchart.

I paste example code in my code.

But it occurs an error.

in Chrome console :

TypeError: chartModule is not a function
    at eval (angular-highcharts.es5.js:245)
    at Array.forEach (<anonymous>)
    at ChartService.initModules (angular-highcharts.es5.js:244)
    at new ChartModule (angular-highcharts.es5.js:274)
    at _createClass (core.js:10915)
    at _createProviderInstance$1 (core.js:10889)
    at initNgModule (core.js:10842)
    at new NgModuleRef_ (core.js:12096)
    at createNgModuleRef (core.js:12086)
    at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.js:14430)

Below that is my code snippet.

app.module.ts :

...
import {ChartModule, HIGHCHARTS_MODULES} from 'angular-highcharts';
import highstock from 'highcharts/modules/stock.src';
import exporting from 'highcharts/modules/exporting.src';

export function highchartsModules() {
  // apply Highstock Modules to this array
  return [highstock, exporting];
}
...

@NgModule({
  declarations: [
    AppComponent,
    SigninComponent,
    StrategyListComponent,
    StrategyDetailComponent,
    StrategyComponent
  ],
  imports: [
    ...
  ],
  providers: [
    ...
    {provide: HIGHCHARTS_MODULES, useFactory: highchartsModules}
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}

package.json :

...
 "@angular/cdk": "^5.0.2",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.0.2",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "angular-highcharts": "^5.2.0",
    "core-js": "^2.4.1",
    "highcharts": "^6.0.4",
...

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:48 (11 by maintainers)

github_iconTop GitHub Comments

14reactions
inyonocommented, Feb 10, 2018

@joeykruger @ubirajr The workaround (as mentioned in https://github.com/angular/angular-cli/issues/9058#issuecomment-355021360) is to force the default import for your chart module imports. So do

import * as sunburst from 'highcharts/modules/sunburst.src';

instead of

import sunburst from 'highcharts/modules/sunburst.src';

for all your chart modules.

4reactions
manhar-developercommented, Apr 9, 2018

@attilacsanyi Tried providers: [ {provide: HIGHCHARTS_MODULES, useFactory: () => [drilldown] }], Its working 😃. Appreciate your help 👍 Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 - AOT - Calling function 'ChartModule', function calls ...
ERROR in Error encountered resolving symbol values statically. Calling function 'ChartModule'. function calls are not supported. Consider ...
Read more >
Angular 2 : AOT TypeError: base64 is not a function-angular.js
i found answer , its node js doing problem here , AOT requires node js v6+ , i just update my node and...
Read more >
charts not working [#3026499] | Drupal.org
It throws me this error (in the console): Uncaught TypeError: $(...).highcharts is not a function Any idea on how to resolve this issue?...
Read more >
Integration | Chart.js
You can pick and choose many of these, e.g. if you are not going to use ... require(['path/to/chartjs/dist/chart.umd.js'], function(Chart){ ...
Read more >
Chart.js: Uncaught TypeError: Cannot read property &#38;#039
js in conjunction with the mdb chart module. To avoid any issues with the imports, I only included the import { MDBBootstrapModulesPro }...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found