angularhighchartsangular2-highcharts

How to import highcharts-more


I would like to use the spiderweb chart from highcharts, which requires me to import highcharts-more, but I cannot figure out how to do that. Currently, this is how I've added highcharts to my project, from app.module.ts:

import { ChartModule } from 'angular2-highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';
import * as Highcharts from 'highcharts/highstock';

imports: [
    ChartModule
]

providers: [{
    provide: HighchartsStatic,
    useValue: Highcharts
}],

When I try to import it like this:

import * as HighchartsMore from 'highcharts/highcharts-more';

I get the following error:

Module '"c:/pdws-view-v2/node_modules/@types/highcharts/highcharts-more"' resolves to a non-module entity and cannot be imported using this construct.

Any ideas?


Solution

  • The highcharts-more npm package is deprecated - there's no need to install it. Just make sure highcharts is installed.

    Solution:

    import * as Highcharts from 'highcharts';
    import more from 'highcharts/highcharts-more';
    more(Highcharts);