Skip to content

Commit 75c4eac

Browse files
committed
feat: add trajectory view
Re-adds the trajectory view with filtering support.
1 parent 199748c commit 75c4eac

File tree

6 files changed

+52
-2
lines changed

6 files changed

+52
-2
lines changed

report-app/src/app/app.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ <h1>Web Codegen Scorer</h1>
1313
<span class="material-symbols-outlined">arrow_back</span>
1414
</a>
1515

16+
<a
17+
routerLink="/trajectory"
18+
routerLinkActive="active"
19+
class="icon-button"
20+
title="Go to trajectory page">
21+
<span class="material-symbols-outlined">trending_up</span>
22+
</a>
23+
1624
<button class="icon-button" title="Toggle dark mode" (click)="toggleColorMode()">
1725
<span class="material-symbols-outlined">{{colorMode()}}_mode</span>
1826
</button>

report-app/src/app/app.routes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {Routes} from '@angular/router';
22
import {ReportViewer} from './pages/report-viewer/report-viewer';
33
import {ComparisonPage} from './pages/comparison/comparison';
44
import {ReportListComponent} from './pages/report-list/report-list';
5+
import {Trajectory} from './pages/trajectory/trajectory';
56

67
export const routes: Routes = [
78
{
@@ -16,6 +17,10 @@ export const routes: Routes = [
1617
path: 'comparison',
1718
component: ComparisonPage,
1819
},
20+
{
21+
path: 'trajectory',
22+
component: Trajectory,
23+
},
1924
{
2025
path: '',
2126
redirectTo: 'reports',
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<report-filters #filters/>
2+
3+
<div class="card">
4+
<score-visualization [groups]="filters.filteredGroups()" />
5+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
report-filters {
2+
margin-bottom: 1rem;
3+
}
4+
5+
.card {
6+
padding-top: 0.5rem;
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {ChangeDetectionStrategy, Component} from '@angular/core';
2+
import {ScoreVisualization} from '../../shared/visualization/score-visualization';
3+
import {ReportFilters} from '../../shared/report-filters/report-filters';
4+
5+
@Component({
6+
selector: 'trajectory',
7+
templateUrl: './trajectory.html',
8+
styleUrls: ['./trajectory.scss'],
9+
imports: [ScoreVisualization, ReportFilters],
10+
changeDetection: ChangeDetectionStrategy.OnPush,
11+
})
12+
export class Trajectory {}

report-app/src/app/shared/visualization/score-visualization.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {afterRenderEffect, Component, ElementRef, inject, input, viewChild} from
22
import {RunGroup} from '../../../../../runner/shared-interfaces';
33
import {GoogleChartsLoader} from '../../services/google-charts-loader';
44
import {AppResizeNotifier} from '../../services/app-resize-notifier';
5+
import {AppColorMode} from '../../services/app-color-mode';
56

67
@Component({
78
selector: 'score-visualization',
@@ -10,6 +11,7 @@ import {AppResizeNotifier} from '../../services/app-resize-notifier';
1011
export class ScoreVisualization {
1112
private googleChartsLoader = inject(GoogleChartsLoader);
1213
private notifier = inject(AppResizeNotifier);
14+
private colorModeService = inject(AppColorMode);
1315

1416
readonly groups = input.required<RunGroup[]>();
1517
readonly chartContainer = viewChild.required<ElementRef>('chart');
@@ -57,6 +59,7 @@ export class ScoreVisualization {
5759
// Note: we need to call `_processData` synchronously
5860
// so the wrapping effect picks up the data dependency.
5961
const {dataRows, averageAppsCount} = this._processData();
62+
const colorMode = this.colorModeService.colorMode();
6063

6164
await this.googleChartsLoader.ready;
6265

@@ -77,19 +80,29 @@ export class ScoreVisualization {
7780
);
7881

7982
const chart = new google.visualization.LineChart(this.chartContainer().nativeElement);
83+
const textColor = colorMode === 'dark' ? '#f9fafb' : '#1e293b';
84+
8085
chart.draw(table, {
8186
curveType: 'function',
8287
title: `Score average over time (~${averageAppsCount.toFixed(0)} apps generated per day)`,
88+
titleTextStyle: {color: textColor},
89+
backgroundColor: 'transparent',
8390
vAxis: {
8491
format: 'percent',
92+
viewWindowMode: 'maximized',
93+
textStyle: {color: textColor},
94+
maxValue: 1,
8595
},
96+
legend: {textStyle: {color: textColor}},
8697
hAxis: {
8798
minTextSpacing: 20,
88-
textStyle: {fontSize: 10},
99+
textStyle: {fontSize: 10, color: textColor},
89100
},
90101
chartArea: {
91102
left: 50,
92-
right: 300,
103+
right: 155,
104+
bottom: 10,
105+
top: 50,
93106
},
94107
// TODO: Consider enabling trendlines.
95108
// trendlines: { 0: {}, 1: {} },

0 commit comments

Comments
 (0)