diff --git a/src/app/components/results-graph/results-graph.component.ts b/src/app/components/results-graph/results-graph.component.ts index 83b55ff9897869cd215e8deadf8688d4a2b6c258..ceba3ed605228d082014ac93c7723b69b3ad1fc5 100644 --- a/src/app/components/results-graph/results-graph.component.ts +++ b/src/app/components/results-graph/results-graph.component.ts @@ -7,16 +7,15 @@ import { GenericSelectComponent } from '../generic-select/generic-select.compone selector: "graph-type", templateUrl: "../generic-select/generic-select.component.html" }) -export class GraphTypeSelectComponent extends GenericSelectComponent { +export class GraphTypeSelectComponent extends GenericSelectComponent<GraphType> { private _entries: GraphType[] = [GraphType.Histogram, GraphType.Scatter]; private _entriesLabels: string[] = ["Histogramme", "XY"]; - protected get entries(): any[] { + protected get entries(): GraphType[] { return this._entries; } - protected entryLabel(entry: any): string { - // return entry; + protected entryLabel(entry: GraphType): string { const i = this._entries.indexOf(entry); return this._entriesLabels[i]; } @@ -26,11 +25,9 @@ export class GraphTypeSelectComponent extends GenericSelectComponent { selector: 'results-graph', templateUrl: './results-graph.component.html' }) -export class ResultsGraphComponent { //implements AfterViewInit { +export class ResultsGraphComponent { private _results: FixedVarResults; - private _currentGraphType: GraphType; - @ViewChild(GraphTypeSelectComponent) private _graphTypeComponent: GraphTypeSelectComponent; @@ -56,12 +53,11 @@ export class ResultsGraphComponent { //implements AfterViewInit { public set results(r: FixedVarResults) { this._results = r; - this._currentGraphType = r.graphType; - this._graphTypeComponent.selectedValue = this._currentGraphType; + this._graphTypeComponent.selectedValue = r.graphType; } public updateView() { - switch (this._currentGraphType) { + switch (this._graphTypeComponent.selectedValue) { case GraphType.Histogram: this.graph_type = "bar"; this.generateBarGraph(); @@ -80,7 +76,6 @@ export class ResultsGraphComponent { //implements AfterViewInit { } private onGraphTypeSelectChange(event) { - this._currentGraphType = event; this.updateView(); }