fix(dashboard): fix responsive grafik data
This commit is contained in:
parent
6aab9e1b71
commit
d1d0c5498a
|
|
@ -47,7 +47,6 @@ export class GraphComponent implements OnInit {
|
||||||
};
|
};
|
||||||
|
|
||||||
chart: any;
|
chart: any;
|
||||||
isChartLoaded = false;
|
|
||||||
labelHourly = [
|
labelHourly = [
|
||||||
'01.00', '02.00', '03.00', '04.00', '05.00', '06.00', '07.00', '08.00',
|
'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',
|
'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);
|
Chart.register(LineController, LineElement, PointElement, LinearScale, Title, CategoryScale, Tooltip, Filler);
|
||||||
this.selectedSensor = 'dht';
|
this.selectedSensor = 'dht';
|
||||||
this.parameters = this.sensorParameters[this.selectedSensor];
|
this.parameters = this.sensorParameters[this.selectedSensor];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -67,10 +66,12 @@ export class GraphComponent implements OnInit {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
console.log(this.chartElement.nativeElement);
|
if (this.chart) {
|
||||||
console.log(this.chart);
|
this.chart.destroy();
|
||||||
console.log(this.isLoading);
|
this.createChart(this.dhtData.temperature, 'Temperature', '#8F5A62', this.labelHourly);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user