Skip to content

Commit

Permalink
feat: chart spinner only shows while fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercchase committed Sep 18, 2024
1 parent bdbc15b commit d6cd0ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@
[zoomIn$]="zoomInChart$"
[zoomToFit$]="zoomToFitChart$"
[zoomOut$]="zoomOutChart$"
[chartData]="chartData"></app-timeseries-chart>
[chartData]="chartData"
[isLoading]="isLoading"></app-timeseries-chart>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export class TimeseriesResultsMenuComponent implements OnInit, OnDestroy {
public dateRange = [];
public totalPoints = 0;

public isLoading = false;

constructor(
private store$: Store<AppState>,
private screenSize: ScreenSizeService,
Expand Down Expand Up @@ -180,8 +182,10 @@ export class TimeseriesResultsMenuComponent implements OnInit, OnDestroy {
this.timeseries_subscription.unsubscribe();
}
this.chartData.next(null);
this.isLoading = true;
this.timeseries_subscription = this.netcdfService.getTimeSeries(geometry).pipe(first()).subscribe(data => {
this.chartData.next(data);
this.isLoading = false;

let test_products = [];
this.totalPoints = Object.keys(data).length - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div #timeseriesChart id="timeseriesChart" >

</div>
@if(dataSource.length <= 0){
@if(isLoading){
<div class="disp-spinner">
<mat-spinner></mat-spinner>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class TimeseriesChartComponent implements OnInit, OnDestroy {


private selectedScene: string;
@Input() isLoading: boolean = false;

private subs = new SubSink();
constructor(
Expand Down

0 comments on commit d6cd0ed

Please sign in to comment.