Showing channel unit as part of the label in chartviewer

Signed-off-by: Matthias Koller <m.koller@peak-solution.de>
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.html b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.html
index 9397c30..85ba743 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.html
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.html
@@ -11,12 +11,6 @@
  * SPDX-License-Identifier: EPL-2.0
  *
  ********************************************************************************-->
- 
-<div class="ui-g ui-fluid">
-    <div class="ui-g-12 ui-md-2">
-        <p-checkbox  label="Show legend"  binary="true" [(ngModel)]="showLegend" (ngModelChange)="onChangeShowLegend($event)"></p-checkbox>
-    </div>
-</div>
 
 <p-chart #lineChart type="line" [data]="data" [options]="options"></p-chart>
 
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.ts
index b96703b..10262be 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/chartviewer/chart-viewer.component.ts
@@ -38,7 +38,6 @@
   @ViewChild('lineChart')
   chart: UIChart;
 
-  showLegend = false;
   maxRequestedValues = 10000;
   previewEnabled = true;
   numberOfChunks = 600;
@@ -71,24 +70,7 @@
       }
     },
     legend: {
-      display: this.showLegend,
-    },
-    scales: {
-      xAxes: [{
-        display: true,
-        scaleLabel: {
-          display: true,
-          labelString: ''
-        }
-        // afterSetDimensions: this.onSize,
-      }],
-      yAxes: [{
-        display: true,
-        scaleLabel: {
-          display: true,
-          labelString: ''
-        }
-      }],
+      display: true,
     },
     plugins: {
       zoom: {
@@ -125,11 +107,6 @@
     }
   }
 
-  onChangeShowLegend(event: any) {
-    this.options.legend.display = this.showLegend;
-    this.chart.reinit();
-  }
-
   getColor(name: string) {
     return this.data.datasets.find(dataset => dataset.label === name).borderColor;
   }
@@ -149,14 +126,12 @@
         data: {
           labels: this.getLabels(this.rangeValues[0], this.rangeValues[1], this.getLength(mvl)),
           datasets: mvl.map(this.convertToDataset, this)
-        },
-        unit: mvl.map(m => m.unit)
+        }
       }),
       catchError(this.httpErrorHandler.handleError)
     ).subscribe(d => {
       console.log(d);
       this.data = d.data;
-      this.options.scales.yAxes[0].scaleLabel.labelString = d.unit;
     });
   }
 
@@ -179,7 +154,7 @@
 
   convertToDataset(measuredValues: MeasuredValues) {
     return <any>{
-      label: measuredValues.name,
+      label: measuredValues.name + ' [' + measuredValues.unit + ']',
       unit: measuredValues.unit,
       data: getDataArray(measuredValues).values,
       borderColor: '#' + Math.random().toString(16).substr(-6),
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer/xy-chart-viewer.component.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer/xy-chart-viewer.component.ts
index c2591f4..549a418 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer/xy-chart-viewer.component.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/components/xy-chart-viewer/xy-chart-viewer.component.ts
@@ -153,12 +153,6 @@
             labelString: resp.datasets.map(ds => (<ChartXyDataSet> ds).xUnit).join(', ')
           }
         }],
-        yAxes: [{
-          scaleLabel: {
-            display: true,
-            labelString: resp.datasets.map(ds => (<ChartXyDataSet> ds).yUnit).join(', ')
-          }
-        }],
       },
     };
   }
diff --git a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/services/chart-viewer.service.ts b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/services/chart-viewer.service.ts
index fac2a07..7e0587d 100644
--- a/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/services/chart-viewer.service.ts
+++ b/org.eclipse.mdm.application/src/main/webapp/src/app/chartviewer/services/chart-viewer.service.ts
@@ -26,7 +26,7 @@
     const xValues = xData.getDataArray().values as number[];
     const yValues = getDataArray(yData).values as number[];
     const points = this.getDataPoints(xValues, yValues);
-    const dataset = new ChartXyDataSet(yData.name, points);
+    const dataset = new ChartXyDataSet(yData.name + ' [' + yData.unit + ']', points);
     dataset.xUnit = xData.unit;
     dataset.yUnit = yData.unit;
     return dataset;