fix(graph): fix pulign ticks satuan

This commit is contained in:
Desy Ayurianti 2024-11-29 15:01:29 +07:00
parent a5fbb018c4
commit 7c44188d6e

View File

@ -301,6 +301,7 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
if (this.charts['dht']) { if (this.charts['dht']) {
this.filterData(this.activeButton); this.filterData(this.activeButton);
console.log(this.activeButton);
} }
} }
@ -455,7 +456,7 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
grid: { display: false }, grid: { display: false },
beginAtZero: true, beginAtZero: true,
ticks: { ticks: {
callback: (value: number | string) => { callback: (value: string | number, index: number, values: any) => {
if (this.activeButton === 'vicitemperature') { if (this.activeButton === 'vicitemperature') {
return `${value} °C`; return `${value} °C`;
} else if (this.activeButton === 'vicihumidity') { } else if (this.activeButton === 'vicihumidity') {
@ -513,7 +514,7 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
grid: { display: false }, grid: { display: false },
beginAtZero: true, beginAtZero: true,
ticks:{ ticks:{
callback: (value: number | string) => { callback: (value: string | number, index: number, values: any) => {
if(selectedOption === 'npk'){ if(selectedOption === 'npk'){
return `${value} mg/L`; return `${value} mg/L`;
} else if(selectedOption === 'temperature'){ } else if(selectedOption === 'temperature'){