eapatel edited a comment on issue #16095: URL: https://github.com/apache/echarts/issues/16095#issuecomment-977454238
Below is my code using setOption. ``` <div style="width:100%; height:100%" [options]="option" (chartInit)="onChartInit($event)"> </div> ``` ``` echartsInstance: any; option: EChartOption = {}; flag: boolean = false; data: any; ``` ``` constructor() { this.setOption(); this.mySerive.getData().subscribe( res => { if (res) { this.data = res; } }); if(this.echartsInstance) { this.updateSeries(); } } }); } ``` ``` setOptions() { this.option = { legend: { selected: this.selectedLegend, selected: {}, selectedMode: 'multiple', type: 'scroll', orient: 'vertical', right: 23, top: 83, data: [], icon: 'roundRect' }, globe: { globeRadius: 80, ... }, series: [] }; } ``` ``` LinesSeries() { return { type: 'lines3D', name: 'data', data: [ [data.SRCLATLON, data.DSTLATLON] ], ... }; } PointsSeries() { return { type: 'scatter3D', name: 'data', coordinateSystem: 'globe', data: [ { value: [data.SRCLATLON], }, { value: [data.DSTLATLON], } ] ... }; } ``` ``` updateSeries() { if (!this.flag && this.option.series.length > 100) { this.flag = true; } if(this.flag) { this.option.series.splice(0,2); } this.option.series.push(this.LinesSeries(), this.PointsSeries()); this.echartsInstance.setOption({series: this.option.series}); } ``` ``` onChartInit(event: any) { if (this.alive) { this.echartsInstance = event; } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org