@@ -136,31 +136,15 @@ export class LineChartService {
136
136
*/
137
137
public setLegendData ( incomingData : EventResultDataDTO ) {
138
138
let labelDataMap = { } ;
139
- let translateMeasurands : boolean = incomingData . summaryLabels . length > 0 && incomingData . summaryLabels [ 0 ] . key != "measurand" ;
140
139
incomingData . series . forEach ( ( data : EventResultSeriesDTO ) => {
141
- if ( translateMeasurands ) {
142
- let splitLabelList : string [ ] = data . identifier . split ( ' | ' , 2 ) ;
143
- this . translationService
144
- . get ( 'frontend.de.iteratec.isr.measurand.' + splitLabelList [ 0 ] )
145
- . pipe ( take ( 1 ) )
146
- . subscribe ( ( splitLabel : string ) => {
147
- if ( ! splitLabel . startsWith ( 'frontend.de.iteratec.isr.measurand.' ) ) {
148
- splitLabelList [ 0 ] = splitLabel ;
149
- }
150
- let key = this . generateKey ( data ) ;
151
- labelDataMap [ key ] = {
152
- text : splitLabelList . join ( ' | ' ) ,
153
- key : key ,
154
- show : true ,
155
- }
156
- } ) ;
157
- } else {
158
- let key = this . generateKey ( data ) ;
159
- labelDataMap [ key ] = {
160
- text : data . identifier ,
161
- key : key ,
162
- show : true ,
163
- }
140
+ if ( incomingData . summaryLabels . length > 0 && incomingData . summaryLabels [ 0 ] . key != "measurand" ) {
141
+ data . identifier = this . translateMeasurand ( data ) ;
142
+ }
143
+ let key = this . generateKey ( data ) ;
144
+ labelDataMap [ key ] = {
145
+ text : data . identifier ,
146
+ key : key ,
147
+ show : true
164
148
}
165
149
} ) ;
166
150
this . legendDataMap = labelDataMap ;
@@ -170,25 +154,36 @@ export class LineChartService {
170
154
* Prepares the incoming data for drawing with D3.js
171
155
*/
172
156
private prepareData ( incomingData : EventResultDataDTO ) : TimeSeries [ ] {
173
-
174
157
return incomingData . series . map ( ( data : EventResultSeriesDTO ) => {
175
158
let lineChartData : TimeSeries = new TimeSeries ( ) ;
159
+ if ( incomingData . summaryLabels . length > 0 && incomingData . summaryLabels [ 0 ] . key != "measurand" ) {
160
+ data . identifier = this . translateMeasurand ( data ) ;
161
+ }
176
162
lineChartData . key = this . generateKey ( data ) ;
177
163
178
164
lineChartData . values = data . data . map ( ( point : EventResultPointDTO ) => {
179
165
let lineChartDataPoint : TimeSeriesPoint = new TimeSeriesPoint ( ) ;
180
166
lineChartDataPoint . date = parseDate ( point . date ) ;
181
167
lineChartDataPoint . value = point . value ;
182
- lineChartDataPoint . tooltipText = data . jobGroup + ' | ' + data . measuredEvent + ' : '; // TODO Set exact label text when IT-2793 is implemented
168
+ lineChartDataPoint . tooltipText = data . identifier + ' : ' ;
183
169
return lineChartDataPoint ;
184
170
} ) ;
185
171
186
172
return lineChartData ;
187
173
} ) ;
188
174
}
189
175
176
+ private translateMeasurand ( data : EventResultSeriesDTO ) : string {
177
+ let splitLabelList : string [ ] = data . identifier . split ( ' | ' ) ;
178
+ let splitLabel : string = this . translationService . instant ( 'frontend.de.iteratec.isr.measurand.' + splitLabelList [ 0 ] ) ;
179
+ if ( ! splitLabel . startsWith ( 'frontend.de.iteratec.isr.measurand.' ) ) {
180
+ splitLabelList [ 0 ] = splitLabel ;
181
+ }
182
+ return splitLabelList . join ( ' | ' ) ;
183
+ }
184
+
190
185
private generateKey ( data : EventResultSeriesDTO ) : string {
191
- return data . identifier . split ( ' | ' ) . join ( ) . split ( ':' ) . join ( "" ) ;
186
+ return data . identifier . split ( ' | ' ) . join ( ) . split ( ':' ) . join ( "" ) . split ( "?" ) . join ( "" ) ;
192
187
}
193
188
194
189
/**
@@ -576,7 +571,7 @@ export class LineChartService {
576
571
} )
577
572
// fade in
578
573
. transition ( ) . duration ( 500 ) . style ( 'opacity' , ( timeSeries : TimeSeries ) => {
579
- return ( this . legendDataMap [ timeSeries . key ] . show ) ? '1' : '0.2 ' ;
574
+ return ( this . legendDataMap [ timeSeries . key ] . show ) ? '1' : '0.1 ' ;
580
575
} ) ;
581
576
582
577
return resultingSelection ;
0 commit comments