delete(actualgraph): console log
This commit is contained in:
parent
a68c0f045b
commit
5ffd7fc241
|
|
@ -32,14 +32,12 @@ export class ActualgraphComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData(sensorType: string): void {
|
loadData(sensorType: string): void {
|
||||||
console.log('Loading data for sensor:', sensorType);
|
|
||||||
this.selectedButton = sensorType;
|
this.selectedButton = sensorType;
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.isNoData = false;
|
this.isNoData = false;
|
||||||
|
|
||||||
this.sensorService.getLatestData().subscribe(
|
this.sensorService.getLatestData().subscribe(
|
||||||
(response: ApiResponse) => {
|
(response: ApiResponse) => {
|
||||||
console.log('Data received:', response);
|
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
const selectedData = (response.data as { [key: string]: any[] })[sensorType];
|
const selectedData = (response.data as { [key: string]: any[] })[sensorType];
|
||||||
|
|
||||||
|
|
@ -80,10 +78,8 @@ export class ActualgraphComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Chart
|
|
||||||
private initializeChart(): void {
|
private initializeChart(): void {
|
||||||
if (this.chartCanvas?.nativeElement) {
|
if (this.chartCanvas?.nativeElement) {
|
||||||
console.log('Initializing chart...');
|
|
||||||
const ctx = this.chartCanvas.nativeElement.getContext('2d');
|
const ctx = this.chartCanvas.nativeElement.getContext('2d');
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
this.chart = new Chart(ctx, {
|
this.chart = new Chart(ctx, {
|
||||||
|
|
@ -166,7 +162,6 @@ export class ActualgraphComponent implements OnInit {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: function (tooltipItem: any) {
|
title: function (tooltipItem: any) {
|
||||||
// Display the label (Nitrogen, Phosphorus, or Kalium)
|
|
||||||
return tooltipItem[0].label;
|
return tooltipItem[0].label;
|
||||||
},
|
},
|
||||||
label: function (tooltipItem: any) {
|
label: function (tooltipItem: any) {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,6 @@ export class GraphComponent implements OnInit, AfterViewInit, OnDestroy, OnChang
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
this.isLoadingNPK2 = false;
|
this.isLoadingNPK2 = false;
|
||||||
if (response.statusCode === 200 && response.data.npk2?.length > 0) {
|
if (response.statusCode === 200 && response.data.npk2?.length > 0) {
|
||||||
console.log('NPK2 Data:', response);
|
|
||||||
this.createChart(this.npk2ChartElement.nativeElement, response, 'npk2', this.selectedNPK2);
|
this.createChart(this.npk2ChartElement.nativeElement, response, 'npk2', this.selectedNPK2);
|
||||||
this.isNoDataNPK2 = false;
|
this.isNoDataNPK2 = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user