Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added click functionality for 2 gauges
  • Loading branch information
ema14006 committed Apr 3, 2019
1 parent f36ddfd commit 6168e23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
18 changes: 13 additions & 5 deletions src/app/statistics/statistics.component.html
Expand Up @@ -20,10 +20,14 @@
<button class="btn btn-primary btn-block m-1" (click)="viewYear()">Last Year</button>
</div>
</div> -->
<div class = "row mt-3">
<button class="btn btn-primary btn-block m-1" (click) = "goToGraphGen()">Graph</button>

</div>
<div class="row mt-3 text-center" *ngIf = "isRecent">

<div class="col-md-4">
<radial-gauge width="200" units="Amps" title="Phase A Current" height="200" major-ticks="0,60,120,180,240,300" [value]="pACurrent">
<radial-gauge width="200" units="Amps" title="Phase A Current" height="200" major-ticks="0,60,120,180,240,300" [value]="pACurrent" >
</radial-gauge>
</div>
<div class="col-md-4">
Expand Down Expand Up @@ -85,12 +89,16 @@
<linear-gauge width="150" title = "Oil Pressure" major-ticks = "0,50,100,150,200" max-value = "120" height="350" [value] = "oilPressure"></linear-gauge>
</div>
<div class="col-md-3">
<!--<radial-gauge width="200" units="°C" title="Fuel Temperature" height="200" [value]="fuelTemp"></radial-gauge> -->
<linear-gauge width="150" title = "Oil Temperature" major-ticks = "0,50,100,150,200" max-value = "200" height="350" [value]="oilTemp"></linear-gauge>
<!--<radial-gauge width="200" units="°C" title="Fuel Temperature" height="200" [value]="fuelTemp"></radial-gauge> -->
<div (click)= "goToGraphSpec('oil.temp')">
<linear-gauge width="150" title = "Oil Temperature" major-ticks = "0,50,100,150,200" max-value = "200" height="350" [value]="oilTemp"></linear-gauge>
</div>
</div>
<div class="col-md-3">
<!--<radial-gauge width="200" units="°C" title="Fuel Temperature" height="200" [value]="fuelTemp"></radial-gauge> -->
<linear-gauge width="150" title = "Fuel Temperature" major-ticks = "0,50,100,150,200" max-value = "200" height="350" [value]="fuelTemp"></linear-gauge>
<!--<radial-gauge width="200" units="°C" title="Fuel Temperature" height="200" [value]="fuelTemp"></radial-gauge> -->
<div (click)= "goToGraphSpec('fuel.temp')">
<linear-gauge width="150" title = "Fuel Temperature" major-ticks = "0,50,100,150,200" max-value = "200" height="350" [value]="fuelTemp"></linear-gauge>
</div>
</div>
</div>
<!--
Expand Down
15 changes: 13 additions & 2 deletions src/app/statistics/statistics.component.ts
@@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {MetricsService} from '../services/metrics.service';
import {HttpClient, HttpHeaders} from '@angular/common/http';

import { Router } from '@angular/router';

@Component({
selector: 'app-statistics',
Expand All @@ -11,7 +11,7 @@ import {HttpClient, HttpHeaders} from '@angular/common/http';
export class StatisticsComponent implements OnInit {


constructor(public data: MetricsService, private http: HttpClient) {
constructor(public data: MetricsService, private http: HttpClient, private router: Router) {

}

Expand Down Expand Up @@ -146,6 +146,17 @@ export class StatisticsComponent implements OnInit {

}

goToGraphGen()
{
this.router.navigateByUrl('/visualize-one');

}
goToGraphSpec(dataType)
{
this.router.navigateByUrl('/visualize-one');
localStorage.setItem('data_type', dataType);
}

ngOnInit() {

const jsonToken = localStorage.getItem('auth_token');
Expand Down

0 comments on commit 6168e23

Please sign in to comment.