Skip to content

Commit 38e2017

Browse files
authored
Recreate the Experiments Parallel Coordinates Graph (#1974)
* UI: Import echarts and ngx-echarts (#1879) * Import echarts module and ngx-echarts directive for Echarts. Signed-off-by: Elena Zioga <[email protected]> * UI: Remove trials graph component (#1879) * Remove trials graph component. Signed-off-by: Elena Zioga <[email protected]> * UI: Introduce graph's component (#1879) * Create a new component that uses Echarts Parallel Graph. Signed-off-by: Elena Zioga <[email protected]> * UI: Modify graph's wrapper component (#1879) * Make the wrapper component use the new graph. * Show the graph when at least one trial is completed. Signed-off-by: Elena Zioga <[email protected]> * UI: Parallel Graph unit test (#1879) * Create unit test for Parallel Graph. Signed-off-by: Elena Zioga <[email protected]> Signed-off-by: Elena Zioga <[email protected]>
1 parent cc740de commit 38e2017

17 files changed

+599
-3209
lines changed

pkg/new-ui/v1beta1/frontend/angular.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"assets": ["src/favicon.ico", "src/assets"],
2727
"styles": ["src/styles.scss", "src/assets/css/d3.parcoords.css"],
2828
"scripts": [
29-
"node_modules/d3/d3.js",
3029
"node_modules/ace-builds/src-min/ace.js",
3130
"node_modules/ace-builds/src-min/mode-yaml.js",
3231
"node_modules/ace-builds/src-min/theme-xcode.js"

pkg/new-ui/v1beta1/frontend/package-lock.json

Lines changed: 44 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/new-ui/v1beta1/frontend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
"@fortawesome/free-brands-svg-icons": "^5.12.0",
3333
"@fortawesome/free-solid-svg-icons": "^5.12.0",
3434
"@swimlane/ngx-charts": "^19.0.1",
35-
"d3": "^3.5.17",
36-
"d3-shape": "^2.0.0",
3735
"date-fns": "1.29.0",
36+
"echarts": "^5.3.2",
37+
"echarts-stat": "^1.2.0",
3838
"js-yaml": "^4.0.0",
3939
"lodash-es": "4.17.11",
4040
"material-icons": "^0.3.1",
4141
"ng2-ace-editor": "^0.3.9",
42+
"ngx-echarts": "^8.0.1",
4243
"ngx-json-viewer": "^2.4.0",
4344
"rxjs": "~6.6.7",
4445
"tslib": "^2.0.0",
@@ -50,7 +51,6 @@
5051
"@angular/compiler-cli": "~12.2.7",
5152
"@angular/language-service": "~12.2.7",
5253
"@kubernetes/client-node": "^0.12.2",
53-
"@types/d3-shape": "^2.0.0",
5454
"@types/jasmine": "~3.6.0",
5555
"@types/jasminewd2": "~2.0.3",
5656
"@types/node": "^12.11.1",

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-details/experiment-details.component.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,21 @@
1313
<ng-container *ngIf="pageLoading; else content">
1414
<lib-loading-spinner></lib-loading-spinner>
1515
</ng-container>
16-
1716
<!--the tabs-->
1817
</div>
1918
</div>
2019

2120
<ng-template #content>
22-
<app-trials-graph
21+
<app-trials-graph-echarts
2322
*ngIf="showGraph; else emptyGraph"
2423
[experimentTrialsCsv]="experimentTrialsCsv"
25-
[hoveredTrial]="hoveredTrial"
24+
[experiment]="experimentDetails"
2625
class="graph"
27-
></app-trials-graph>
26+
></app-trials-graph-echarts>
2827

2928
<ng-template #emptyGraph>
3029
<lib-panel icon="info" color="primary" class="panel">
31-
Couldn't find information for the underlying Trials.
30+
Couldn't find any successful Trial.
3231
</lib-panel>
3332
</ng-template>
3433

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-details/experiment-details.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class ExperimentDetailsComponent implements OnInit, OnDestroy {
110110
const data = transformStringResponses(response);
111111
this.columns = data.types;
112112
this.details = this.parseTrialsDetails(data.details);
113-
this.showGraph = true;
113+
this.showGraph = this.showGraphFn(response);
114114
});
115115
this.backendService
116116
.getExperiment(this.name, this.namespace)
@@ -184,7 +184,7 @@ export class ExperimentDetailsComponent implements OnInit, OnDestroy {
184184
const data = transformStringResponses(trials);
185185
this.columns = data.types;
186186
this.details = this.parseTrialsDetails(data.details);
187-
this.showGraph = trials.split(/\r\n|\r|\n/).length > 1;
187+
this.showGraph = this.showGraphFn(trials);
188188
});
189189
}),
190190
);
@@ -253,4 +253,10 @@ export class ExperimentDetailsComponent implements OnInit, OnDestroy {
253253
return StatusEnum.CREATED;
254254
}
255255
}
256+
257+
private showGraphFn(response: string): boolean {
258+
if (!response.includes(',,') && response.includes('\n')) {
259+
return true;
260+
}
261+
}
256262
}

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-details/experiment-details.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { ExperimentDetailsComponent } from './experiment-details.component';
1414
import { TrialsTableModule } from './trials-table/trials-table.module';
1515
import { ExperimentOverviewModule } from './overview/experiment-overview.module';
1616
import { ExperimentDetailsTabModule } from './details/experiment-details-tab.module';
17-
import { TrialsGraphModule } from './trials-graph/trials-graph.module';
1817
import { ExperimentYamlModule } from './yaml/experiment-yaml.module';
18+
import { TrialsGraphEchartsModule } from './trials-graph-echarts/trials-graph-echarts.module';
1919

2020
@NgModule({
2121
declarations: [ExperimentDetailsComponent],
@@ -29,10 +29,10 @@ import { ExperimentYamlModule } from './yaml/experiment-yaml.module';
2929
PanelModule,
3030
ExperimentOverviewModule,
3131
ExperimentDetailsTabModule,
32-
TrialsGraphModule,
3332
MatProgressSpinnerModule,
3433
ExperimentYamlModule,
3534
TitleActionsToolbarModule,
35+
TrialsGraphEchartsModule
3636
],
3737
exports: [ExperimentDetailsComponent],
3838
})
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="graph-wrapper">
2+
<div echarts [initOpts]="initOpts" [options]="options" [merge]="options" class="graph"></div>
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
1-
:host {
2-
display: block;
3-
}
4-
5-
.graph-wrapper {
6-
position: relative;
7-
display: flex;
8-
justify-content: center;
9-
align-items: center;
10-
flex-direction: column;
11-
}
12-
13-
.d3-graph {
14-
width: 400px;
15-
16-
@media (min-width: 768px) {
17-
width: 700px;
18-
}
19-
20-
@media (min-width: 1024px) {
21-
width: 1000px;
22-
}
23-
24-
@media (min-width: 1400px) {
25-
width: 1300px;
26-
}
27-
28-
@media (min-width: 1650px) {
29-
width: 1600px;
30-
}
31-
32-
@media (min-width: 2000px) {
33-
width: 1900px;
34-
}
35-
36-
height: 600px;
37-
}
38-
39-
.spinner {
40-
display: flex;
41-
align-items: center;
42-
justify-content: center;
43-
}
1+
.graph-wrapper {
2+
position: relative;
3+
display: flex;
4+
justify-content: center;
5+
align-items: center;
6+
flex-direction: column;
7+
}
8+
9+
.graph {
10+
width: 400px;
11+
12+
@media (min-width: 768px) {
13+
width: 700px;
14+
}
15+
16+
@media (min-width: 1024px) {
17+
width: 1000px;
18+
}
19+
20+
@media (min-width: 1400px) {
21+
width: 1300px;
22+
}
23+
24+
@media (min-width: 1650px) {
25+
width: 1600px;
26+
}
27+
28+
@media (min-width: 2000px) {
29+
width: 1900px;
30+
}
31+
32+
height: 600px;
33+
}

0 commit comments

Comments
 (0)