Skip to content

Commit 65acade

Browse files
authored
Merge branch 'develop' into feature/legendDynamicPosition
2 parents 4515578 + 4111ae9 commit 65acade

File tree

5 files changed

+41
-25
lines changed

5 files changed

+41
-25
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ buildscript {
3636
}
3737
}
3838

39-
version "5.3.2"
39+
version "5.3.3"
4040
group "OpenSpeedMonitor"
4141

4242
apply plugin: "eclipse"

frontend/src/app/modules/time-series/services/line-chart.service.ts

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838

3939
import 'd3-transition';
4040

41-
import {brushX as d3BrushX} from 'd3-brush';
41+
import {BrushBehavior, brushX as d3BrushX} from 'd3-brush';
4242
import {EventResultDataDTO} from 'src/app/modules/time-series/models/event-result-data.model';
4343
import {EventResultSeriesDTO} from 'src/app/modules/time-series/models/event-result-series.model';
4444
import {EventResultPointDTO} from 'src/app/modules/time-series/models/event-result-point.model';
@@ -62,15 +62,17 @@ export class LineChartService {
6262
// D3 margin conventions
6363
// > With this convention, all subsequent code can ignore margins.
6464
// see: https://bl.ocks.org/mbostock/3019563
65-
private _margin = {top: 40, right: 70, bottom: 40, left: 60};
66-
private _width = 600 - this._margin.left - this._margin.right;
67-
private _height = 550 - this._margin.top - this._margin.bottom;
68-
private _legendGroupTop = this._margin.top + this._height + 50;
69-
private _legendGroupLeft = this._margin.left;
65+
private _margin: any = {top: 40, right: 70, bottom: 40, left: 60};
66+
private _width: number = 600 - this._margin.left - this._margin.right;
67+
private _height: number = 550 - this._margin.top - this._margin.bottom;
68+
private _labelGroupHeight: number;
69+
private _legendGroupTop: number = this._margin.top + this._height + 50;
70+
private _legendGroupLeft: number = this._margin.left;
7071
private _legendGroupColumnWidth;
7172
private _legendGroupColumns;
72-
private legendDataMap = {};
73-
private brush;
73+
private legendDataMap: Object = {};
74+
private brush: BrushBehavior<{}>;
75+
private focusedLegendEntry: string;
7476

7577
// Map that holds all points clustered by their x-axis values
7678
private _xAxisCluster: any = {};
@@ -98,13 +100,11 @@ export class LineChartService {
98100
* Draws a line chart for the given data into the given svg
99101
*/
100102
public drawLineChart(incomingData: EventResultDataDTO): void {
101-
102-
let data: TimeSeries[] = this.prepareData(incomingData);
103-
104-
if (data.length == 0) {
103+
if (incomingData.series.length == 0) {
105104
return;
106105
}
107106

107+
let data: TimeSeries[] = this.prepareData(incomingData);
108108
let chart: D3Selection<D3BaseType, {}, D3ContainerElement, {}> = d3Select('g#time-series-chart-drawing-area');
109109
let xScale: D3ScaleTime<number, number> = this.getXScale(data);
110110
let yScale: D3ScaleLinear<number, number> = this.getYScale(data);
@@ -134,6 +134,10 @@ export class LineChartService {
134134
* Set the data for the legend after the incoming data is received
135135
*/
136136
public setLegendData(incomingData: EventResultDataDTO) {
137+
if (incomingData.series.length == 0) {
138+
return;
139+
}
140+
137141
let labelDataMap = {};
138142
incomingData.series.forEach((data: EventResultSeriesDTO) => {
139143
let label = data.identifier;
@@ -784,24 +788,36 @@ export class LineChartService {
784788
.style('opacity', 0)
785789
.remove()
786790
)
787-
.attr("transform", (datum, index) => this.position(index))
791+
.attr("transform", (datum, index) => this.getPosition(index))
788792
.on('click', (datum) => this.onMouseClick(datum, incomingData));
789793
}
790794

791-
private position(index: number): string {
795+
private getPosition(index: number): string {
792796
const x = index % this._legendGroupColumns * this._legendGroupColumnWidth;
793797
const y = Math.floor(index / this._legendGroupColumns) * ChartCommons.LABEL_HEIGHT + 12;
794798

795799
return "translate(" + x + "," + y + ")";
796800
}
797801

798802
private onMouseClick(labelKey: string, incomingData: EventResultDataDTO): void {
799-
if (d3Event.metaKey) {
800-
this.legendDataMap[labelKey].show ? this.legendDataMap[labelKey].show = false : this.legendDataMap[labelKey].show = true;
803+
if (d3Event.metaKey || d3Event.ctrlKey) {
804+
this.legendDataMap[labelKey].show = !this.legendDataMap[labelKey].show;
801805
} else {
802-
Object.keys(this.legendDataMap).forEach((legend) => {
803-
this.legendDataMap[legend].show = legend === labelKey;
804-
});
806+
if (labelKey == this.focusedLegendEntry) {
807+
Object.keys(this.legendDataMap).forEach((legend) => {
808+
this.legendDataMap[legend].show = true;
809+
});
810+
this.focusedLegendEntry = "";
811+
} else {
812+
Object.keys(this.legendDataMap).forEach((legend) => {
813+
if (legend === labelKey) {
814+
this.legendDataMap[legend].show = true;
815+
this.focusedLegendEntry = legend;
816+
} else {
817+
this.legendDataMap[legend].show = false;
818+
}
819+
});
820+
}
805821
}
806822
this.drawLineChart(incomingData);
807823
}

grails-app/controllers/de/iteratec/osm/csi/CsiBenchmarkController.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CsiBenchmarkController extends ExceptionHandlerController {
5353
}
5454

5555
String selectedCsiType = params.csiType == "visuallyComplete" ? 'csByWptVisuallyCompleteInPercent' : 'csByWptDocCompleteInPercent'
56-
List<JobGroup> allJobGroups = JobGroup.findAllByNameInList(cmd.jobGroups)
56+
List<JobGroup> allJobGroups = JobGroup.findAllByIdInList(cmd.jobGroups)
5757

5858
CsiAggregationInterval interval = CsiAggregationInterval.findByIntervalInMinutes(CsiAggregationInterval.DAILY)
5959

grails-app/controllers/de/iteratec/osm/result/PageComparisonController.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ class PageComparisonController extends ExceptionHandlerController {
6464
BarchartDatum comparativeSeries = mapToSeriesFor(aggregation.comperativeAggregation)
6565
return new BarchartSeries(
6666
stacked: false,
67-
dimensionalUnit: aggregation.baseAggregation.selectedMeasurand.getMeasurandGroup().unit.label,
67+
dimensionalUnit: aggregation.baseAggregation.unit,
6868
data: [baseSeries, comparativeSeries]
6969
)
7070
}
7171

7272
private BarchartDatum mapToSeriesFor(BarchartAggregation aggregation) {
7373
return new BarchartDatum(
74-
measurand: i18nService.msg("de.iteratec.isr.measurand.${aggregation.selectedMeasurand.name}", aggregation.selectedMeasurand.name),
74+
measurand: i18nService.msg("de.iteratec.isr.measurand.${aggregation.measurandName}", aggregation.measurandName),
7575
value: aggregation.value,
7676
aggregationValue: aggregation.aggregationValue,
7777
grouping: "${aggregation.jobGroup.name} | ${aggregation.page.name}")

grails-app/views/csiBenchmark/show.gsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
data: {
107107
from: selectedTimeFrame[0].toISOString(),
108108
to: selectedTimeFrame[1].toISOString(),
109-
selectedJobGroups: JSON.stringify($.map($("#folderSelectHtmlId option:selected"), function (e) {
110-
return $(e).text()
109+
jobGroups: JSON.stringify($.map($("#folderSelectHtmlId option:selected"), function (e) {
110+
return parseInt(e.value);
111111
})),
112112
csiType: $('input[name=csiTypeRadios]:checked').val()
113113
},

0 commit comments

Comments
 (0)