fix(dashboard): fix responsive ui for data grafik
This commit is contained in:
parent
991da7be77
commit
e478095235
|
|
@ -6,8 +6,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
width: max-content;
|
width: 100%;
|
||||||
height: 80%!important;
|
height: 30vh;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,14 @@ export class GraphComponent implements OnInit {
|
||||||
this.selectedSensor = 'dht';
|
this.selectedSensor = 'dht';
|
||||||
this.parameters = this.sensorParameters[this.selectedSensor];
|
this.parameters = this.sensorParameters[this.selectedSensor];
|
||||||
this.createChart(this.dhtData.temperature, 'Temperature', '#8F5A62', this.labelHourly);
|
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 {
|
createChart(data: number[], label: string, borderColor: string, labels: string[]): void {
|
||||||
|
|
@ -131,9 +139,15 @@ export class GraphComponent implements OnInit {
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
|
grid:{
|
||||||
|
display: false
|
||||||
|
},
|
||||||
beginAtZero: true
|
beginAtZero: true
|
||||||
},
|
},
|
||||||
y: {
|
y: {
|
||||||
|
grid:{
|
||||||
|
display: false
|
||||||
|
},
|
||||||
beginAtZero: true
|
beginAtZero: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user