Skip to content

Commit

Permalink
Change key generation for legend.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSteger committed Nov 19, 2019
1 parent 81bc493 commit 4f28141
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ export class LineChartService {
}

private generateKey(data: EventResultSeriesDTO): string {
return data.identifier.split(' | ').join().split(':').join("").split("?").join("");
let key: string = data.identifier.replace(/[^_a-zA-Z0-9-]/g, "");
if (new RegExp('[0-9]').test(key.charAt(0))) {
key = key.replace(/[0-9]/, '_');
}
return key;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ class LineChartTimeSeriesService {
timeSeriesChartDTO.summaryLabels.add new SummaryLabel("connectivity", "${connectivity?.name}")
}

fillData(timeSeriesChartDTO, eventResultProjections, measurands, performanceAspectTypes, jobGroups,
measuredEvents, locations, connectivityProfiles, jobGroup, measuredEvent, location, connectivity)
timeSeriesChartDTO = fillData(timeSeriesChartDTO, eventResultProjections, measurands, performanceAspectTypes,
jobGroups, measuredEvents, locations, connectivityProfiles, jobGroup, measuredEvent, location, connectivity)

rebuildIdentifierForEdgeCases(timeSeriesChartDTO, measuredEvents, locations, connectivityProfiles)
timeSeriesChartDTO = rebuildIdentifierForEdgeCases(timeSeriesChartDTO, measuredEvents, locations, connectivityProfiles)
timeSeriesChartDTO.series.sort { it.identifier.toUpperCase() }
return timeSeriesChartDTO
}

private void fillData(TimeSeriesChartDTO timeSeriesChartDTO, List<EventResultProjection> eventResultProjections,
List<SelectedMeasurand> measurands, List<PerformanceAspectType> performanceAspectTypes,
List<JobGroup> jobGroups, List<MeasuredEvent> measuredEvents, List<Location> locations,
List<ConnectivityProfile> connectivityProfiles, JobGroup jobGroup,
MeasuredEvent measuredEvent, Location location, ConnectivityProfile connectivity) {
private TimeSeriesChartDTO fillData(TimeSeriesChartDTO timeSeriesChartDTO, List<EventResultProjection> eventResultProjections,
List<SelectedMeasurand> measurands, List<PerformanceAspectType> performanceAspectTypes,
List<JobGroup> jobGroups, List<MeasuredEvent> measuredEvents, List<Location> locations,
List<ConnectivityProfile> connectivityProfiles, JobGroup jobGroup,
MeasuredEvent measuredEvent, Location location, ConnectivityProfile connectivity) {
performanceLoggingService.logExecutionTime(DEBUG, "create DTO for TimeSeriesChart", 1) {
eventResultProjections.each { EventResultProjection eventResultProjection ->
String identifier = ""
Expand Down Expand Up @@ -193,6 +193,7 @@ class LineChartTimeSeriesService {
}
}
}
return timeSeriesChartDTO
}

private void buildSeries(Double value, String identifier, Date date, String measurandName, JobGroup jobGroup,
Expand All @@ -214,8 +215,8 @@ class LineChartTimeSeriesService {
timeSeries.data.add(timeSeriesDataPoint)
}

private void rebuildIdentifierForEdgeCases(TimeSeriesChartDTO timeSeriesChartDTO, List<MeasuredEvent> measuredEvents,
List<Location> locations, List<ConnectivityProfile> connectivityProfiles) {
private TimeSeriesChartDTO rebuildIdentifierForEdgeCases(TimeSeriesChartDTO timeSeriesChartDTO, List<MeasuredEvent> measuredEvents,
List<Location> locations, List<ConnectivityProfile> connectivityProfiles) {
if (timeSeriesChartDTO.series.size() == 1) {
timeSeriesChartDTO.series.each { TimeSeries timeSeries ->
timeSeries.identifier = "${timeSeries.measurand} | ${timeSeries.jobGroup} | ${timeSeries.measuredEvent} | ${timeSeries.location} | ${timeSeries.connectivity}"
Expand Down Expand Up @@ -290,6 +291,7 @@ class LineChartTimeSeriesService {
}
}
}
return timeSeriesChartDTO
}

private String addToIdentifier(String element, String identifier) {
Expand Down

0 comments on commit 4f28141

Please sign in to comment.