import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { MatTableDataSource } from '@angular/material'; import { ScheduleService } from '../services/schedule.service'; import { ScheduleDataSource } from '../services/schedule.datasource'; @Component({ selector: 'schedule', templateUrl: './schedule.component.html', styleUrls: [ './schedule.component.css' ] }) export class ScheduleComponent implements OnInit { dataSource: ScheduleDataSource; timeZone: string; displayedColumns = [ 'title', 'day', 'time' ]; constructor(private route: ActivatedRoute, private scheduleService: ScheduleService) { } ngOnInit() { this.dataSource = new ScheduleDataSource(this.scheduleService); this.dataSource.loadSchedule(false); } changeTimeZone(value) { this.timeZone = value; } calcColor(value) { let x = Math.min(Math.exp(value / 600000), 255); return `rgb(255, ${x}, ${x})`; } }