dev smartfarming #1

Merged
agrilink merged 53 commits from development into main 2024-12-30 05:53:19 +00:00
Showing only changes of commit d6e7c7696c - Show all commits

View File

@ -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()];
}
}
};