fix(dashboard): fix responsive ui for data grafik

This commit is contained in:
Desy Ayurianti 2024-09-30 13:37:12 +07:00
parent 991da7be77
commit e478095235
2 changed files with 16 additions and 2 deletions

View File

@ -6,8 +6,8 @@
}
canvas {
width: max-content;
height: 80%!important;
width: 100%;
height: 30vh;
margin: 20px;
align-items: center;
}

View File

@ -57,6 +57,14 @@ export class GraphComponent implements OnInit {
this.selectedSensor = 'dht';
this.parameters = this.sensorParameters[this.selectedSensor];
this.createChart(this.dhtData.temperature, 'Temperature', '#8F5A62', this.labelHourly);
window.addEventListener('resize', () => {
if (this.chart) {
this.chart.destroy();
this.createChart(this.dhtData.temperature, 'Temperature', '#8F5A62', this.labelHourly);
}
});
}
createChart(data: number[], label: string, borderColor: string, labels: string[]): void {
@ -131,9 +139,15 @@ export class GraphComponent implements OnInit {
},
scales: {
x: {
grid:{
display: false
},
beginAtZero: true
},
y: {
grid:{
display: false
},
beginAtZero: true
}
}