fix(graph): adding satuan in sumbu Y
This commit is contained in:
parent
ae43ca880c
commit
d6e7c7696c
|
|
@ -312,7 +312,6 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
chart.data.datasets.forEach((dataset: any) => {
|
||||
dataset.hidden = dataset.label !== this.parameterDisplayNames[parameter];
|
||||
});
|
||||
|
||||
chart.update();
|
||||
}
|
||||
}
|
||||
|
|
@ -364,8 +363,6 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
.filter(parameter => {
|
||||
if (selectedOption === 'npk') {
|
||||
return ['soilphosphorus', 'soilnitrogen', 'soilpotassium'].includes(parameter);
|
||||
} else if (selectedOption === 'others') {
|
||||
return !['soilphosphorus', 'soilnitrogen', 'soilpotassium'].includes(parameter);
|
||||
} else if (selectedOption === 'temperature') {
|
||||
return ['soiltemperature'].includes(parameter);
|
||||
} else if (selectedOption === 'humidity') {
|
||||
|
|
@ -454,7 +451,22 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
}
|
||||
}
|
||||
},
|
||||
y: { grid: { display: false }, beginAtZero: true }
|
||||
y: {
|
||||
grid: { display: false },
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
callback: (value: number | string) => {
|
||||
if (this.activeButton === 'vicitemperature') {
|
||||
return `${value} °C`;
|
||||
} else if (this.activeButton === 'vicihumidity') {
|
||||
return `${value} %`;
|
||||
} else if (this.activeButton === 'viciluminosity') {
|
||||
return `${value} lux`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -497,7 +509,25 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
}
|
||||
}
|
||||
},
|
||||
y: { grid: { display: false }, beginAtZero: true }
|
||||
y: {
|
||||
grid: { display: false },
|
||||
beginAtZero: true,
|
||||
ticks:{
|
||||
callback: (value: number | string) => {
|
||||
if(selectedOption === 'npk'){
|
||||
return `${value} mg/L`;
|
||||
} else if(selectedOption === 'temperature'){
|
||||
return `${value} °C`;
|
||||
} else if(selectedOption === 'humidity'){
|
||||
return `${value} %`;
|
||||
} else if(selectedOption === 'conductivity'){
|
||||
return `${value} μS/cm`;
|
||||
} else if(selectedOption === 'ph'){
|
||||
return `${value} pH`;
|
||||
} return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -552,5 +582,5 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
|||
const days = ['Sun', 'Mon', 'Tues', 'Wed', 'Thrus', 'Fri', 'Sat'];
|
||||
return days[date.getDay()];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user