Files
perfdb/pdb-js/src/app/plot.service.ts

64 lines
1.2 KiB
TypeScript

import { Injectable, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
@Injectable({
providedIn: 'root'
})
export class PlotService {
plotTypes: Array<PlotType>;
tagFields: Observable<TagField>;
constructor(private http: HttpClient) {
this.plotTypes = new Array<PlotType>();
this.plotTypes.push(new PlotType("Scatter"));
this.plotTypes.push(new PlotType("Cumulative Distribution"));
this.plotTypes.push(new PlotType("Parallel Requests"));
this.plotTypes.push(new PlotType("Parallel Requests"));
this.tagFields = new Array<TagField>();
}
ngOnInit() {
}
getPlotTypes(): Array<PlotType> {
return this.plotTypes;
}
getTagFields(): Observable<TagField> {
const that = this;
this.http.get('//localhost:8080/fields').subscribe(data => {
data.forEach(function(name) {
that.tagFields.push(new TagField(name));
});
});
return this.tagFields;
}
}
export class PlotType {
name: string;
constructor(name: string) {
this.name = name;
}
}
export class TagField {
name: string;
constructor(name: string) {
this.name = name;
}
}