fix: clean code
This commit is contained in:
parent
cff1e79837
commit
50c3ce7497
|
|
@ -20,7 +20,7 @@
|
|||
<div class="sensor-wrapper">
|
||||
<div class="title-with-dropdown">
|
||||
<div class="title">Sensor NPK 1</div>
|
||||
<select class="form-select" style="margin-top: 10px" [(ngModel)]="selectedNPK1" (change)="updateCharts(); onResize()">
|
||||
<select class="form-select" style="margin-top: 10px" [(ngModel)]="selectedNPK1" (change)="onResize()">
|
||||
<option value="npk">NPK</option>
|
||||
<option value="others">Lainnya</option>
|
||||
</select>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<div class="sensor-wrapper">
|
||||
<div class="title-with-dropdown">
|
||||
<div class="title">Sensor NPK 2</div>
|
||||
<select class="form-select" style="margin-top: 10px" [(ngModel)]="selectedNPK2" (change)="updateCharts(); onResize()">
|
||||
<select class="form-select" style="margin-top: 10px" [(ngModel)]="selectedNPK2" (change)=" onResize()">
|
||||
<option value="npk">NPK</option>
|
||||
<option value="others">Lainnya</option>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -82,15 +82,12 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
this.updateCharts();
|
||||
}
|
||||
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['interval'] && !changes['interval'].firstChange) {
|
||||
this.selectedInterval = changes['interval'].currentValue;
|
||||
this.updateCharts();
|
||||
if (changes['interval'] && changes['interval'].previousValue !== changes['interval'].currentValue) {
|
||||
this.selectedInterval = changes['interval'].currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.onResize();
|
||||
}
|
||||
|
|
@ -157,7 +154,6 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
|
||||
fetchNPK2Data(savedTimeRange: string): void {
|
||||
const startEnd = this.getDate();
|
||||
const timeRange = this.interval;
|
||||
this.sensorService.getSensorData('npk2', this.selectedNPK2, startEnd, savedTimeRange).subscribe({
|
||||
next: (response) => {
|
||||
console.log(savedTimeRange);
|
||||
|
|
@ -192,7 +188,6 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
}
|
||||
|
||||
|
||||
|
||||
createChart(canvas: HTMLCanvasElement, response: ApiResponse, sensor: string, selectedOption: string): void {
|
||||
const ctx = canvas.getContext('2d');
|
||||
const parameters = this.sensorParameters[sensor];
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
<button (click)="updateInterval('DAILY')" [class.active-button]="selectedButton === 'daily'">Daily</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="graph">
|
||||
<app-graph [interval]="selectedInterval"></app-graph>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ export class HistorygraphComponent implements OnInit, OnDestroy {
|
|||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.intervalId) {
|
||||
clearInterval(this.intervalId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user