File
Metadata
selector |
home |
styleUrls |
visualization.component.css |
templateUrl |
visualization.component.html |
Methods
Public personSelected
|
personSelected(person: any)
|
Returns: void
|
Private _timeNetData
|
_timeNetData: TimeNetData
|
Private chartData
|
chartData: any[]
|
Private personSearch
|
personSearch: PersonSearchData[]
|
Private selectedPerson
|
selectedPerson: PersonData
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {
Component,
OnInit
} from '@angular/core';
import { Http, Response } from '@angular/http';
import { Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {TimeNetDataService, TimeNetData, PersonData} from './timenet.service';
import {isNullOrUndefined} from "util";
export interface PersonSearchData {
id: string,
name: string,
birth: number,
dispName: string
}
@Component({
selector: 'home',
providers: [ ],
styleUrls: [ './visualization.component.css' ],
templateUrl: './visualization.component.html',
})
export class VisualizationComponent implements OnInit {
private chartData: Array<any>;
private _timeNetData: TimeNetData;
constructor(
public timeNetDataService: TimeNetDataService
) {}
private personSearch: PersonSearchData[];
public ngOnInit() {
this._timeNetData = this.timeNetDataService.getTimeNetData();
this.personSearch = this._timeNetData.persons.map((p) => <PersonSearchData>
{id:p.id, name:p.name.join(' '), birth:p.dateOfBirth, dispName:p.name.join(' ')+' (' + p.dateOfBirth + ')'});
this.selectedPerson = this._timeNetData.persons[Math.floor(Math.random() * this._timeNetData.persons.length)];
}
private selectedPerson: PersonData;
public personSelected(person) {
if(isNullOrUndefined(person) === false) {
if(this.timeNetDataService.getPersonById(person.id))
this.selectedPerson = this.timeNetDataService.getPersonById(person.id);
}
}
}