Search code examples
angularionic-frameworkhighchartsionic2highcharts-ng

Ionic 2 Highcharts


I am using Ionic 2 framework and want to implement highcharts.

I followed this step https://forum.ionicframework.com/t/ionic-2-and-highcharts-modules/59365/2 from mharington (ionic team) to setup my first high chart.

The error I get is I can't import it but I installed with node modules

Error

enter image description here

 angular2-highcharts include in my node_modules

please help


Solution

  • To use HighChart in Ionic 2 you must:

    • installation

      npm install highcharts --save
      
    • Load module on the page where you want to use the charts

      declare var require: any;
      let hcharts = require('highcharts');
      require('highcharts/modules/exporting')(hcharts);`
      
    • On the activity.html page

      <div #graph></div>
      
    • and finally

      initLapChart() {
          hcharts.chart(this.div.nativeElement, {
              chart: {..}
          ... 
      }
      

    I hope I was clear.