angular-highcharts icon indicating copy to clipboard operation
angular-highcharts copied to clipboard

Follow the steps but fail occurs

Open jcrecio opened this issue 6 years ago • 4 comments

I tried the basic steps to use angular-highcharts: highcharts

however I´m getting this error: error

but in the steps for the basic example there is no provider given any idea?

thanks in advance!

jcrecio avatar Apr 26 '18 16:04 jcrecio

Not sure about the vanilla start-up case, but here's how your module.ts should look once trying to add any extra highcharts modules. I think the error your getting is related to your lack of the providers section I show below. For your case you probably don't need the useFactory part of it, but you should declare HIGHCHARTS_MODULES as a provider.

import { ChartModule, HIGHCHARTS_MODULES } from 'angular-highcharts';
import * as more from 'highcharts/highcharts-more.src';
import * as drilldown from 'highcharts/modules/drilldown.src';
import * as exporting from 'highcharts/modules/exporting.src';

export function highchartsModules() {
  return [ more, drilldown, exporting, exportData ];
}
@NgModule({
...
  providers: [
    {
      provide: HIGHCHARTS_MODULES,
      useFactory: highchartsModules
    }
  ]
}

CollinGraf314 avatar Apr 26 '18 17:04 CollinGraf314

still don´t have the typings even installing @types/highcharts, any idea?

jcrecio avatar Apr 26 '18 18:04 jcrecio

Did you update your tsconfig.json file to include highcharts types?

tsconfig.app.json :

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": [
        "highcharts"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

CollinGraf314 avatar Apr 26 '18 20:04 CollinGraf314

Yes, I did. There must be some missing part of documentation for the vanilla start-up I guess.

jcrecio avatar Apr 28 '18 06:04 jcrecio