Ionic 2 Highcharts

I am using the 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 (ion command) to set up my first high schedule.

The error I get, I can not import, but I installed with node modules

Error

enter image description here

 angular2-highcharts include in my node_modules

please, help

+4
source share
2 answers

To use HighChart in Ionic 2, you must:

  • installation

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

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

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

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

I hope I get it.

0
source

, angular 2 RC. mharrington - .37 ( ), - angular 2.

ChartModule. . github demo (plnkr)

angular2 -highcharts:

@ngModule (prob app.module.ts)

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ChartModule } from 'angular2-highcharts';
import { App } from './App';

@NgModule({
    imports: [BrowserModule, ChartModule],
    declarations: [App],
    bootstrap: [App]
})
export class AppModule {}

:

import { Component } from '@angular/core';

@Component({
    selector: 'simple-chart-example',
    template: `
        <chart [options]="options"></chart>
    `
})
export class App {
    constructor() {
        this.options = {
            title : { text : 'simple chart' },
            series: [{
                data: [29.9, 71.5, 106.4, 129.2],
            }]
        };
    }
    options: HighchartsOptions;
}

, , ,

import { ChartModule } from 'ng2-charts';

import { ChartModule } from 'ng2-charts/components/charts/charts';

- (# 440)

, , , [datasets] , [data] : ng2-charts - Can not " " , " "

+6

Source: https://habr.com/ru/post/1658296/


All Articles