Adjust chart time intervals

This commit is contained in:
2020-04-18 17:27:00 -04:00
parent f1ad2ba441
commit b340fe1b5e
2 changed files with 8 additions and 4 deletions

View File

@@ -35,6 +35,8 @@ export class PowerChartsComponent implements OnInit {
private selectedTimeSpanValue: TimeSpan = TimeSpan.Last24Hours;
private selectedDateValue: moment.Moment = moment().startOf('day');
private timeInterval = 5;
constructor(private httpClient: HttpClient) { }
ngOnInit() {
@@ -87,8 +89,8 @@ export class PowerChartsComponent implements OnInit {
const endString = end.toISOString();
forkJoin([
this.httpClient.get<PowerStatusGrouped[]>(`/api/power/status/history-grouped?start=${startString}&end=${endString}&bucketMinutes=5`),
this.httpClient.get<WeatherValueGrouped[]>(`/api/weather/readings/value-history-grouped?weatherValueType=LightLevel&start=${startString}&end=${endString}&bucketMinutes=5`)
this.httpClient.get<PowerStatusGrouped[]>(`/api/power/status/history-grouped?start=${startString}&end=${endString}&bucketMinutes=${this.timeInterval}`),
this.httpClient.get<WeatherValueGrouped[]>(`/api/weather/readings/value-history-grouped?weatherValueType=LightLevel&start=${startString}&end=${endString}&bucketMinutes=${this.timeInterval}`)
]).subscribe(data => {
const seriesData: Array<SeriesLineOptions> = [];

View File

@@ -42,6 +42,8 @@ export class WeatherChartsComponent implements OnInit {
private selectedTimeSpanValue: TimeSpan = TimeSpan.Last24Hours;
private selectedDateValue: moment.Moment = moment().startOf('day');
private timeInterval = 5;
constructor(private httpClient: HttpClient) { }
ngOnInit() {
@@ -103,7 +105,7 @@ export class WeatherChartsComponent implements OnInit {
const startString = start.toISOString();
const endString = end.toISOString();
const request = this.httpClient.get<WeatherReadingGrouped[]>(`/api/weather/readings/history-grouped?start=${startString}&end=${endString}&bucketMinutes=30`);
const request = this.httpClient.get<WeatherReadingGrouped[]>(`/api/weather/readings/history-grouped?start=${startString}&end=${endString}&bucketMinutes=${this.timeInterval}`);
request.subscribe(data => {
const seriesData: Array<SeriesLineOptions | SeriesColumnOptions> = [];
@@ -224,7 +226,7 @@ export class WeatherChartsComponent implements OnInit {
const startString = start.toISOString();
const endString = end.toISOString();
const request = this.httpClient.get<WindHistoryGrouped[]>(`/api/weather/readings/wind-history-grouped?start=${startString}&end=${endString}&bucketMinutes=30`);
const request = this.httpClient.get<WindHistoryGrouped[]>(`/api/weather/readings/wind-history-grouped?start=${startString}&end=${endString}&bucketMinutes=${this.timeInterval}`);
request.subscribe(data => {
const seriesData: Array<SeriesLineOptions | SeriesWindbarbOptions> = [];