Removed xy-chart-viewer component

Signed-off-by: Matthias Koller <m.koller@peak-solution.de>
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/chartviewer.module.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/chartviewer.module.ts
index 410eb1d..2fcb508 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/chartviewer.module.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/chartviewer.module.ts
@@ -29,7 +29,6 @@
 
 import { MDMCoreModule } from '../core/mdm-core.module';
 import { ChartViewerComponent } from './components/chartviewer/chart-viewer.component';
-import { XyChartviewerComponent } from './components/xychartviewer/xy-chart-viewer.component';
 import { DataTableComponent } from './components/datatable/data-table.component';
 import { ChartViewerNavCardComponent } from './components/chatviewer-nav-card/chart-viewer-nav-card.component';
 import { XyChartViewerComponent } from './components/xy-chart-viewer/xy-chart-viewer.component';
@@ -53,7 +52,6 @@
     MultiSelectModule
   ],
   declarations: [
-    XyChartviewerComponent,
     ChartViewerNavCardComponent,
     ChartViewerComponent,
     DataTableComponent,
@@ -64,7 +62,6 @@
   exports: [
     ChartViewerNavCardComponent,
     XyChartViewerNavCardComponent,
-    XyChartViewerComponent,
   ]
 })
 export class ChartviewerModule {}
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.html b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.html
index d979996..8cc9516 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.html
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.html
@@ -22,7 +22,6 @@
     <div [ngSwitch]="selectedMode">
         <mdm5-chartViewer *ngSwitchCase="'chart'" [channelGroup]="channelGroup" [channels]="channels" ></mdm5-chartViewer>
         <mdm5-dataTable *ngSwitchCase="'table'" [channelGroup]="channelGroup" [channels]="channels"></mdm5-dataTable>
-        <mdm5-xyChartViewer *ngSwitchCase="'xy-chart'"></mdm5-xyChartViewer>
         <div *ngSwitchDefault></div>
     </div>
 </div>
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.ts
index 2354f74..7b21a64 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chatviewer-nav-card/chart-viewer-nav-card.component.ts
@@ -13,18 +13,14 @@
  ********************************************************************************/
 
 import { Component, OnInit, OnDestroy } from '@angular/core';
-import { Http } from '@angular/http';
 import { NavigatorService } from '../../../navigator/navigator.service';
-import { HttpErrorHandler } from '../../../core/http-error-handler';
 import { MDMNotificationService } from '../../../core/mdm-notification.service';
 import { TranslateService } from '@ngx-translate/core';
 import { NodeService } from '../../../navigator/node.service';
-import { PropertyService } from '../../../core/property.service';
-import { ChartViewerDataService } from '../../services/chart-viewer-data.service';
 import { forkJoin, Observable } from 'rxjs';
-import { Node, Attribute } from '../../../navigator/node';
+import { Node } from '../../../navigator/node';
 import { SelectItem } from 'primeng/api';
-import { MDMItem } from 'src/app/core/mdm-item';
+import { PropertyService } from 'src/app/core/property.service';
 
 @Component({
   selector: 'mdm5-chartViewerNavCard',
@@ -35,9 +31,8 @@
   private _contextUrl: string;
 
   modes: SelectItem[] = [
-    { label: 'Table', value: 'table'},
     { label: 'Chart', value: 'chart'},
-    { label: 'xy-Chart', value: 'xy-chart'}
+    { label: 'Table', value: 'table'},
   ];
   selectedMode = 'chart';
 
@@ -49,14 +44,11 @@
   showLegend = false;
   dataAvailable = false;
 
-  constructor(private http: Http,
-    private navigatorService: NavigatorService,
-    private httpErrorHandler: HttpErrorHandler,
+  constructor(private navigatorService: NavigatorService,
     private notificationService: MDMNotificationService,
     private translateService: TranslateService,
     private nodeService: NodeService,
-    private _prop: PropertyService,
-    private chartService: ChartViewerDataService) {
+    private _prop: PropertyService) {
     this._contextUrl = _prop.getUrl('mdm/environments');
   }
 
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer-nav-card/xy-chart-viewer-nav-card.component.html b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer-nav-card/xy-chart-viewer-nav-card.component.html
index b9ce5c8..e23db48 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer-nav-card/xy-chart-viewer-nav-card.component.html
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer-nav-card/xy-chart-viewer-nav-card.component.html
@@ -12,7 +12,7 @@
  *
  ********************************************************************************-->
 
- <div *ngIf="measurement === undefined || channelGroups === undefined || channels === undefined">
+<div *ngIf="measurement === undefined || channelGroups === undefined || channels === undefined">
   No Node selected.
   <button (click)="onClick()">Click</button>
 </div>
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.html b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.html
deleted file mode 100644
index 501c820..0000000
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************-->
-
-<div class="ui-g ui-fluid">
-    <div class="ui-g-12 ui-md-8">
-        <p-multiSelect defaultLabel="Choose Channels" [options]="chart.data.datasets" [(ngModel)]="selectedChannels" optionLabel="label" (ngModelChange)="onChangeSelectedChannels($event)">
-            <ng-template let-dataset pTemplate="item">
-                <span class="fa fa-fw fa-square" [ngStyle]="{'color':getColor(dataset.label)}"></span> {{dataset.label}}
-            </ng-template>
-        </p-multiSelect>  
-    </div>
-    <div class="ui-g-12 ui-md-2">
-        <p-checkbox  label="Show legend"  binary="true" [(ngModel)]="showLegend" (ngModelChange)="onChangeShowLegend($event)"></p-checkbox>
-    </div>
-    <div class="ui-g-12 ui-md-2">
-        <p-button label="Reset" (onClick)="resetZoom()"></p-button>
-    </div>
-</div>
-
-
-<div><canvas #lineChart>{{ chart }}</canvas></div>
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.ts
deleted file mode 100644
index 9a8b23b..0000000
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xychartviewer/xy-chart-viewer.component.ts
+++ /dev/null
@@ -1,326 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- ********************************************************************************/
-
-import { Component, OnInit, ViewChild } from '@angular/core';
-
-import { Chart } from 'chart.js';
-import 'hammerjs';
-import 'chartjs-plugin-zoom';
-import { HttpErrorHandler } from '../../../core/http-error-handler';
-import { Http, Headers, RequestOptionsArgs } from '@angular/http';
-import { PropertyService } from '../../../core/property.service';
-import { plainToClass, Type } from 'class-transformer';
-import { map, tap, catchError } from 'rxjs/operators';
-import { NavigatorService } from '../../../navigator/navigator.service';
-import { MDMNotificationService } from '../../../core/mdm-notification.service';
-import { TranslateService } from '@ngx-translate/core';
-import { Node, Attribute } from '../../../navigator/node';
-import { NodeService } from '../../../navigator/node.service';
-import { forkJoin, Observable } from 'rxjs';
-import { ChartViewerDataService } from '../../services/chart-viewer-data.service';
-import { MeasuredValues, MeasuredValuesResponse, NumberArray } from '../../model/chartviewer.model';
-
-@Component({
-  selector: 'mdm5-xyChartViewer',
-  templateUrl: 'xy-chart-viewer.component.html',
-  providers: []
-})
-export class XyChartviewerComponent implements OnInit {
-  private _contextUrl: string;
-
-  @ViewChild('lineChart')
-  private chartRef;
-  chart: any;
-
-  data = {
-    labels: [0, 1, 2],
-    datasets: [
-      {
-        label: 'Alle',
-        data: [227, 331, 11]
-      }, {
-        label: 'Cat 1',
-        data: [107, 115, 2]
-      }, {
-        label: 'Cat 2',
-        data: [120, 116, 9]
-      }
-    ]
-  };
-
-  selectedNode: Node;
-  channelGroup: Node;
-  channels: Node[];
-  subscription: any;
-
-  selectedChannels: any[];
-  showLegend = false;
-
-  constructor(private http: Http,
-    private navigatorService: NavigatorService,
-    private httpErrorHandler: HttpErrorHandler,
-    private notificationService: MDMNotificationService,
-    private translateService: TranslateService,
-    private nodeService: NodeService,
-    private _prop: PropertyService,
-    private chartService: ChartViewerDataService) {
-    this._contextUrl = _prop.getUrl('mdm/environments');
-  }
-
-  ngOnInit() {
-    this.onSelectedNodeChange(this.navigatorService.getSelectedNode());
-    this.subscription = this.navigatorService.selectedNodeChanged.subscribe(
-      node => this.onSelectedNodeChange(node),
-      error => this.notificationService.notifyError(this.translateService.instant('details.mdm-detail-view.cannot-update-node'), error)
-    );
-
-    Chart.defaults.global.elements.point.radius = 0;
-    Chart.defaults.global.elements.line.tension = 0;
-
-    this.chart = new Chart(this.chartRef.nativeElement, {
-      type: 'line',
-      data: this.data,
-      options: {
-        legend: {
-          display: this.showLegend,
-          onClick: this.showChannel.bind(this)
-        },
-        scales: {
-          xAxes: [{
-            display: true,
-          }],
-          yAxes: [{
-            display: true
-          }],
-        },
-        plugins: {
-          zoom: {
-            pan: {
-              enabled: true,
-              mode: 'xy'
-            },
-            zoom: {
-              enabled: true,
-              mode: 'xy'
-            }
-          }
-        },
-      }
-    });
-
-    console.log(this.chart);
-
-    this.doChartChannel(new Node(), new Node());
-  }
-
-  onSelectedNodeChange(node: Node) {
-    if (!node) {
-      return;
-    }
-    this.selectedChannels = [];
-    this.selectedNode = node;
-
-    if (node && node.type === 'Measurement') {
-      this.loadChannelGroupFromMeasurement(node)
-        .flatMap(channelGroup => forkJoin([Observable.of(channelGroup), this.loadChannels(channelGroup)]))
-        .subscribe(data => this.doChart(data[0], data[1]));
-    } else if (node && node.type === 'Channel') {
-      this.loadChannelGroup(node)
-        .flatMap(channelGroup => forkJoin([Observable.of(channelGroup), this.loadChannels(channelGroup)]))
-        .subscribe(data => this.doChartChannel(data[0], data[1][0]));
-    } else if (node && node.type === 'ChannelGroup') {
-      this.loadChannels(node).subscribe(channels => this.doChart(node, channels));
-    }
-  }
-
-  loadChannelGroupFromMeasurement(measurement: Node) {
-    let url = this._contextUrl + '/' + measurement.sourceName + '/channelgroups?filter=Measurement.Id eq \"' + measurement.id + '\"';
-    return this.nodeService.getNode(url).map(channelGroup => channelGroup[0]);
-  }
-
-  loadChannelGroup(channel: Node) {
-    let url = this._contextUrl + '/' + channel.sourceName + '/channelgroups?filter=Channel.Id eq \"' + channel.id + '\"';
-    return this.nodeService.getNode(url).map(channelGroup => channelGroup[0]);
-  }
-
-  loadChannels(channelgroup: Node) {
-    let url = this._contextUrl + '/' + channelgroup.sourceName + '/channels?filter=ChannelGroup.Id eq \"' + channelgroup.id + '\"';
-    return this.nodeService.getNode(url);
-  }
-
-  resetZoom() {
-    this.chart.resetZoom();
-  }
-
-  onChangeShowLegend(event: any) {
-    this.chart.options.legend.display = this.showLegend;
-    this.chart.update();
-  }
-
-  onChangeSelectedChannels(event: any) {
-    console.log(this.selectedChannels);
-    let indepenentChannelName = this.chart.data.datasets.filter(dataset => dataset.measuredValues.independent === true)[0].label;
-
-    forkJoin(
-      this.chartService.loadMeasuredValues(this.channelGroup, this.channels.filter(channel => channel.name === indepenentChannelName)),
-      this.chartService.loadMeasuredValues(this.channelGroup, this.selectedChannels.map(d => d.channel))
-    ).subscribe(
-      values => {
-        this.updateChartLabelValues(values[0][0]);
-        this.updateChartData2(this.selectedChannels.map(channel => channel.name), values[1]);
-      });
-  }
-
-  showChannel(event: any, labelItem: any) {
-    if (labelItem.hidden) {
-      let indepenentChannelName = this.chart.data.datasets.filter(dataset => dataset.measuredValues.independent === true)[0].label;
-
-      forkJoin(
-        this.chartService.loadMeasuredValues(this.channelGroup, this.channels.filter(channel => channel.name === indepenentChannelName)),
-        this.chartService.loadMeasuredValues(this.channelGroup, this.channels.filter(channel => channel.name === labelItem.text))
-      ).subscribe(
-        values => {
-          this.updateChartLabelValues(values[0][0]);
-          this.updateChartData(labelItem.text, values[1][0]);
-        });
-    } else {
-      this.chart.data.datasets[labelItem.datasetIndex].data = [];
-      this.chart.data.datasets[labelItem.datasetIndex].hidden = true;
-      this.chart.update();
-    }
-  }
-
-  updateChartLabelValues(indepenentChannelValues: MeasuredValues) {
-    this.chart.data.labels = indepenentChannelValues.getDataArray().values;
-    this.chart.update();
-  }
-
-  updateChartData2(name: string[], measuredValues: MeasuredValues[]) {
-    this.chart.data.datasets = this.chart.data.datasets.map(dataset => {
-      let currentMv = (measuredValues || []).find(mv => mv.name === dataset.label);
-      if (currentMv === undefined) {
-        dataset.hidden = true;
-      } else {
-        dataset.data = currentMv.getDataArray().values;
-        dataset.hidden = false;
-      }
-      return dataset;
-    });
-    this.chart.update();
-  }
-
-  updateChartData(name: string, measuredValues: MeasuredValues) {
-    this.chart.data.datasets = this.chart.data.datasets.map(dataset => {
-      if (dataset.label === name) {
-        dataset.data = measuredValues.getDataArray().values;
-        dataset.hidden = false;
-      }
-      return dataset;
-    });
-    console.log(this.chart.data);
-    this.chart.update();
-  }
-
-  getColor(name: string) {
-    return this.chart.data.datasets.find(dataset => dataset.label === name).borderColor;
-  }
-
-  doChartChannel(channelGroup: Node, channel: Node) {
-    // this.channelGroup = channelGroup;
-    // this.doChartChannel2(this.chartService.loadMeasuredValues(this.channelGroup, [channel]));
-
-    let timeChannel = new MeasuredValues();
-    timeChannel.name = 'time';
-    timeChannel.unit = 's';
-    timeChannel.length = 5;
-    timeChannel.independent = true;
-    timeChannel.integerArray = new NumberArray();
-    timeChannel.integerArray.values = [1, 2, 3, 4, 5];
-    timeChannel.flags = [true, true, true, true, true];
-
-    let channel1 = new MeasuredValues();
-    channel1.name = 'channel1';
-    channel1.unit = 'm';
-    channel1.length = 5;
-    channel1.independent = true;
-    channel1.integerArray = new NumberArray();
-    channel1.integerArray.values = [3, 5, 4, 3, 2];
-    channel1.flags = [true, true, true, true, true];
-
-    let data = new MeasuredValuesResponse();
-    data.values = [timeChannel, channel1];
-
-    this.doChartChannel2(Observable.of(data.values))
-  }
-
-  doChartChannel2(measuredValues: Observable<MeasuredValues[]>) {
-    measuredValues.pipe(
-      map(mvl => {
-        let chartData = {};
-
-        chartData['labels'] = mvl[0].integerArray.values.map((v, i) => i);
-
-        chartData['datasets'] = mvl.map(m => <any>{
-          label: m.name,
-          data: m.integerArray.values,
-          borderColor: '#' + Math.random().toString(16).substr(-6),
-          // hidden: true,
-          measuredValues: map,
-          channel: new Node()
-        });
-
-        return chartData;
-      }),
-      catchError(this.httpErrorHandler.handleError)
-    )
-      .subscribe(r => {
-        console.log(r);
-        this.chart.data = r;
-        this.selectedChannels = this.chart.data.datasets;
-        this.chart.update();
-      });
-  }
-
-  doChart(channelGroup: Node, channels: Node[]) {
-    this.channelGroup = channelGroup;
-    this.channels = channels;
-
-    this.chartService.loadMeasuredValues(this.channelGroup, this.channels).pipe(
-      map(mvl => {
-        let chartData = {}; // : { labels: string[], datasets: { label: string, data: any[] }[] };
-        let indepenentChannel = mvl.find(mv => mv.independent === true);
-        if (indepenentChannel === undefined) {
-          throw Error('No independent channel found!');
-        }
-        chartData['labels'] = indepenentChannel.getDataArray().values;
-
-        chartData['datasets'] = mvl.filter(mv => channels.find(channel => mv.name === channel.name) !== undefined).map(mv => <any>{
-          label: mv.name,
-          data: mv.getDataArray().values,
-          borderColor: '#' + Math.random().toString(16).substr(-6),
-          hidden: true,
-          measuredValues: mv,
-          channel: channels.find(channel => mv.name === channel.name)
-        });
-        return chartData;
-      }),
-      catchError(this.httpErrorHandler.handleError)
-    )
-      .subscribe(r => {
-        console.log(r);
-        this.chart.data = r;
-        this.chart.update();
-      });
-  }
-}
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules-routing.module.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules-routing.module.ts
index c4049e8..fad25cc 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules-routing.module.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules-routing.module.ts
@@ -25,7 +25,7 @@
     { path: '', redirectTo: 'search', pathMatch: 'full' },
     { path: 'details', loadChildren: '../details/mdm-detail.module#MDMDetailModule'},
     { path: 'search', component: MDMSearchComponent },
-    { path: 'chartviewer', component: ChartViewerNavCardComponent },
+    { path: 'quickviewer', component: ChartViewerNavCardComponent },
     { path: 'xychartviewer', component: XyChartViewerNavCardComponent },
   ]}
 ];
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules.component.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules.component.ts
index 0d833a7..fb2cd08 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules.component.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/modules/mdm-modules.component.ts
@@ -28,7 +28,7 @@
   links = [
     { name: TRANSLATE('modules.mdm-modules.details'), path: 'details'},
     { name: TRANSLATE('modules.mdm-modules.mdm-search'), path: 'search'},
-    { name: 'ChartViewer', path: 'chartviewer'},
+    { name: 'QuickViewer', path: 'quickviewer'},
     { name: 'X/Y-ChartViewer', path: 'xychartviewer'}
   ];
   constructor(private router: Router) {}