mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-14 01:25:38 -05:00
Setup proxy, change scaling, and add chart zoom
This commit is contained in:
@@ -20,7 +20,7 @@ import { DashboardComponent } from './components/dashboard/dashboard.component';
|
||||
import { WeatherChartsComponent } from './components/weather/charts/weather-charts.component';
|
||||
import { WeatherCurrentComponent } from './components/weather/current/weather-current.component';
|
||||
|
||||
const config: SocketIoConfig = { url: 'http://home.kaczorzoo.net:9091', options: {} };
|
||||
const config: SocketIoConfig = { url: '/api/laundry', options: {} };
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
||||
@@ -114,7 +114,7 @@ export class WeatherChartsComponent implements OnInit {
|
||||
const startString = start.toISOString();
|
||||
const endString = end.toISOString();
|
||||
|
||||
const request = this.httpClient.get<WeatherReadingGrouped[]>(`http://172.23.10.3/api/weather/readings/history-grouped?start=${startString}&end=${endString}&bucketMinutes=5`);
|
||||
const request = this.httpClient.get<WeatherReadingGrouped[]>(`/api/weather/readings/history-grouped?start=${startString}&end=${endString}&bucketMinutes=5`);
|
||||
|
||||
request.subscribe(data => {
|
||||
const seriesData: Array<SeriesLineOptions> = [];
|
||||
@@ -127,16 +127,17 @@ export class WeatherChartsComponent implements OnInit {
|
||||
data.forEach(dataElement => {
|
||||
const date = Date.parse(dataElement.bucket);
|
||||
seriesData[0].data.push([date, dataElement.averagePressureTemperature]);
|
||||
seriesData[1].data.push([date, dataElement.averagePressure / 33.864]);
|
||||
seriesData[1].data.push([date, dataElement.averagePressure / 33.864 / 100]);
|
||||
seriesData[2].data.push([date, dataElement.averageHumidity]);
|
||||
seriesData[3].data.push([date, dataElement.averageLightLevel]);
|
||||
seriesData[3].data.push([date, dataElement.averageLightLevel * 100]);
|
||||
});
|
||||
|
||||
const title = this.selectedTimeSpan === TimeSpan.Last24Hours ? this.timeSpanItems[TimeSpan.Last24Hours] : this.getSelectedDateDisplayString();
|
||||
|
||||
this.chart = new Chart({
|
||||
chart: {
|
||||
type: 'line'
|
||||
type: 'line',
|
||||
zoomType: "x"
|
||||
},
|
||||
title: {
|
||||
text: title
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
Light
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.LightLevel.toFixed(2) }}
|
||||
{{ ((latestReading.LightLevel / latestReading.BatteryLevel) * 100).toFixed(2) }}%
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -12,7 +12,7 @@ export class WeatherService {
|
||||
|
||||
constructor() {
|
||||
this.connection = new HubConnectionBuilder()
|
||||
.withUrl('http://172.23.10.3:80/api/hub/weather')
|
||||
.withUrl('/api/hub/weather')
|
||||
.build();
|
||||
|
||||
this.connection.on('LatestReading', (message: string) => {
|
||||
|
||||
Reference in New Issue
Block a user