import { Component , OnInit , ViewEncapsulation } from '@angular/core' ; import { NgForage } from 'ngforage' ; import { AnalysisService } from './analysis.service' ; import { EChartOption } from 'echarts' ; import { Sales , WeatherReport } from './weather.interface' ; @ Component ( { selector : 'analysis' , templateUrl : './analysis.component.html' , styleUrls : [ './analysis.component.scss' ] , encapsulation : ViewEncapsulation . None } ) export class AnalysisComponent implements OnInit { widgets : Array < any > ; scatterMapOption : EChartOption ; trendBarOption : EChartOption ; salesOption : Sales ; weatherReport : WeatherReport ; constructor ( private service , private ngForage ) { } ngOnInit ( ) { this . service . getWidgets ( ) . subscribe ( widgets => { this . widgets = widgets ; } ) ; this . ngForage . setItem ( 'TOKEN_DATA' , 'token-demo' ) ; this . service . getScatterMapOption ( ) . subscribe ( ( option ) => { this . scatterMapOption = option ; } ) ; this . trendBarOption = this . service . getTrendBarOption ( ) ; this . weatherReport = this . service . getWeatherReportData ( ) ; this . salesOption = this . service . getSalesOption ( ) ; } }