shivamsriva31093 edited a comment on issue #10153: Y Axis values are displayed 
but the graph does not appear 
URL: 
https://github.com/apache/incubator-echarts/issues/10153#issuecomment-480856962
 
 
   I tried using the un-minified version of echarts, but still getting the same 
error in console in the production build. I downloaded the js file, created one 
directive and followed the starter tutorial 
https://ecomfe.github.io/echarts-doc/public/en/tutorial.html#Get%20Started%20with%20ECharts%20in%205%20minutes
   
   ```
   import {
     Directive, ElementRef, Input, OnInit, HostBinding, OnChanges, OnDestroy
   } from '@angular/core';
   
   import { Subject, Subscription } from 'rxjs';
   
   import * as echarts from '../../../assets/echarts.js';
   // import ECharts = echarts.ECharts;
   // import EChartOption = echarts.EChartOption;
   import { distinctUntilChanged } from 'rxjs/operators';
   
   @Directive({
     selector: '[ts-chart]',
   })
   export class EchartsDirective implements OnChanges, OnInit, OnDestroy {
   
     @Input('ts-chart') public options: any;
   
     @HostBinding('style.height.px')
     public elHeight: number;
     private chart: any;
     private sizeCheckInterval = null;
     private reSize$ = new Subject<string>();
     private onResize: Subscription;
   
     constructor(private el: ElementRef) {
       this.chart = echarts.init(this.el.nativeElement, 'vintage');
     }
   
     public ngOnChanges(changes) {
       if (this.options) {
         this.chart.setOption(this.options);
       }
     }
   
     public ngOnInit() {
       this.sizeCheckInterval = setInterval(() => {
         
this.reSize$.next(`${this.el.nativeElement.offsetWidth}:${this.el.nativeElement.offsetHeight}`);
       }, 100);
       this.onResize = this.reSize$.pipe(distinctUntilChanged())
         .subscribe((_) => this.chart.resize());
   
       this.elHeight = this.el.nativeElement.offsetHeight;
       if (this.elHeight < 300) {
         this.elHeight = 300;
       }
     }
   
     public ngOnDestroy() {
       if (this.sizeCheckInterval) {
         clearInterval(this.sizeCheckInterval);
       }
       this.reSize$.complete();
       if (this.onResize) {
         this.onResize.unsubscribe();
       }
     }
   }
   ```
   
   the echarts file I also tried using the one generated in dist folder of this 
project.
   Error in production build :
   ``vendors~main.894cc1548d12aa81550a.chunk.js:1 ERROR TypeError: Cannot read 
property '__

Reply via email to