fix(dashboard): fix responsive grafik data

This commit is contained in:
Desy Ayurianti 2024-10-08 10:29:38 +07:00
parent 6aab9e1b71
commit d1d0c5498a

View File

@ -47,7 +47,6 @@ export class GraphComponent implements OnInit {
};
chart: any;
isChartLoaded = false;
labelHourly = [
'01.00', '02.00', '03.00', '04.00', '05.00', '06.00', '07.00', '08.00',
'09.00', '10.00', '11.00', '12.00', '13.00', '14.00', '15.00', '16.00',
@ -58,8 +57,8 @@ export class GraphComponent implements OnInit {
Chart.register(LineController, LineElement, PointElement, LinearScale, Title, CategoryScale, Tooltip, Filler);
this.selectedSensor = 'dht';
this.parameters = this.sensorParameters[this.selectedSensor];
}
ngAfterViewInit(): void {
this.isLoading = true;
setTimeout(() => {
@ -67,10 +66,12 @@ export class GraphComponent implements OnInit {
this.isLoading = false;
}, 2000);
console.log(this.chartElement.nativeElement);
console.log(this.chart);
console.log(this.isLoading);
window.addEventListener('resize', () => {
if (this.chart) {
this.chart.destroy();
this.createChart(this.dhtData.temperature, 'Temperature', '#8F5A62', this.labelHourly);
}
});
}