Skip to content

Commit b971f11

Browse files
author
DanielSteger
committed
[IT-2793] Fix legend
1 parent 8550cbe commit b971f11

File tree

6 files changed

+86
-100
lines changed

6 files changed

+86
-100
lines changed

frontend/src/app/enums/chart-commons.enum.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export enum ChartCommons {
55
COMPONENT_MARGIN = 15,
66
CHART_HEADER_HEIGHT = 40,
77
COLOR_PREVIEW_SIZE = 10,
8-
COLOR_PREVIEW_MARGIN = 5
8+
COLOR_PREVIEW_MARGIN = 5,
9+
LABEL_HEIGHT = 30
910
}

frontend/src/app/modules/aggregation/components/aggregation-chart/aggregation-chart.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ export class AggregationChartComponent implements OnChanges {
417417
.attr('width', ChartCommons.COLOR_PREVIEW_SIZE)
418418
.attr("rx", 2)
419419
.attr("ry", 2)
420-
.attr("ry", 2)
421420
.attr('fill', datum => this.measurandDataMap[datum].color);
422421
legendElement
423422
.append('text')
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<div class="time-series-line-chart-container">
22
<div class="card">
3-
<div class="svg-container">
4-
<svg #svg id="time-series-svg" class="time-series-svg" xmlns="http://www.w3.org/1999/html">
5-
</svg>
6-
</div>
3+
<svg #svg />
74
</div>
85
</div>

frontend/src/app/modules/time-series/components/time-series-line-chart/time-series-line-chart.component.scss

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ osm-time-series-line-chart {
44
visibility: hidden;
55
}
66

7-
/*.aggregation-chart {
8-
position: relative;
9-
width: 100%;
10-
}*/
11-
12-
svg.time-series-svg {
13-
width: 100%;
14-
height: 100%;
15-
}
16-
177
#time-series-chart-drawing-area {
188
.axis {
199
.domain {
@@ -23,6 +13,7 @@ svg.time-series-svg {
2313
line {
2414
stroke: $color-contour-medium;
2515
}
16+
2617
text {
2718
fill: $color-text-light;
2819
}

frontend/src/app/modules/time-series/components/time-series-line-chart/time-series-line-chart.component.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {LineChartService} from '../../services/line-chart.service';
1818
selector: 'osm-time-series-line-chart',
1919
encapsulation: ViewEncapsulation.None, // needed! otherwise the scss style do not apply to svg content (see https://stackoverflow.com/questions/36214546/styles-in-component-for-d3-js-do-not-show-in-angular-2/36214723#36214723)
2020
templateUrl: './time-series-line-chart.component.html',
21-
styleUrls: [ './time-series-line-chart.component.scss' ]
21+
styleUrls: ['./time-series-line-chart.component.scss']
2222
})
2323
export class TimeSeriesLineChartComponent implements AfterContentInit, OnChanges {
2424

@@ -32,13 +32,22 @@ export class TimeSeriesLineChartComponent implements AfterContentInit, OnChanges
3232

3333
constructor(
3434
private lineChartService: LineChartService
35-
) {}
35+
) {
36+
}
37+
38+
ngAfterContentInit(): void {
39+
this.lineChartService.initChart(this.svgElement);
40+
}
41+
42+
ngOnChanges(changes: SimpleChanges): void {
43+
this.redraw();
44+
}
3645

3746
@HostListener('window:resize', ['$event'])
3847
windowIsResized() {
3948
this.lineChartService.startResize(this.svgElement);
4049

41-
// Wati until the resize is done before redrawing the chart
50+
// Wait until the resize is done before redrawing the chart
4251
clearTimeout(this._resizeTimeoutId);
4352
this._resizeTimeoutId = window.setTimeout(() => {
4453
this.lineChartService.resizeChart(this.svgElement);
@@ -49,16 +58,7 @@ export class TimeSeriesLineChartComponent implements AfterContentInit, OnChanges
4958
}
5059

5160
redraw() {
52-
this.lineChartService.initLegendData(this.timeSeriesResults);
61+
this.lineChartService.setLegendData(this.timeSeriesResults);
5362
this.lineChartService.drawLineChart(this.timeSeriesResults);
5463
}
55-
56-
ngAfterContentInit(): void {
57-
this.lineChartService.initChart(this.svgElement);
58-
}
59-
60-
ngOnChanges(changes: SimpleChanges): void {
61-
this.redraw();
62-
}
63-
6464
}

0 commit comments

Comments
 (0)