Chocksmith
Chocksmith

Reputation: 1208

Highcharts (ng2-highcharts) gauge in Ionic

I want to use highchart's gauges in my Ionic App.

I've installed highcharts following the steps shown here https://stackoverflow.com/a/47196806/1837599 and here https://github.com/Bigous/ng2-highcharts/wiki/Ionic-usage

It worked for the given example, but when I try to use a gauge chart, I get the error "Error: Highcharts error #17".

After some research, I found that I need to include highcharts-more.js before loading the gauge.

I tried to include:

<script src="../node_modules/highcharts/highcharts.js"></script>
<script src="../node_modules/highcharts/highcharts-more.js"></script>

at index.html but it did not work.

How should I include the libraries at IONIC? Or even before that, is it really what I need to do?

  • ionic version: 3.20.0
  • npm version: 5.6.0
  • "highcharts": "^6.0.7",
  • "ng2-highcharts": "^1.1.2",

Upvotes: 1

Views: 766

Answers (1)

Deep 3015
Deep 3015

Reputation: 10075

Check official npm package for more details

Steps

1>Install from npm

npm install --save highcharts

2> In home.ts import highcharts and highcharts-more.js

import Highcharts from 'highcharts';
import More from 'highcharts/highcharts-more';
More(Highcharts);

stackblitz demo

Upvotes: 2

Related Questions