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?
Using add-highcharts-modules and I have updated it to spider chart
Plunker
You don't need to use an external module to use highcharts or any of the extension packages in your Angular app. All you need to do
npm install --save highcharts
and then in your component along with the other imports include:and example usage:
and you can update the chart options:
Not sure you should import that. In my opinion, based on the usage in the library's npm page (https://www.npmjs.com/package/highcharts-more) you simply have to include it in your code base, using a
<script>
tag, or by adding its path to thescripts
array in.angular-cli.json
.The
highcharts-more
npm package is deprecated - there's no need to install it. Just make surehighcharts
is installed.Solution: