@@ -77,51 +77,46 @@ export class AppComponent {
7777
7878 uploadDataByVisualRange ( ) {
7979 const dataSource = this . component . instance . getDataSource ( ) ;
80- const storage = dataSource . items ( ) ;
81- const bounded = ! ! storage . length ;
8280 const ajaxArgs = {
8381 startVisible : this . getDateString ( this . _visualRange . startValue as Date ) ,
8482 endVisible : this . getDateString ( this . _visualRange . endValue as Date ) ,
85- startBound : this . getDateString ( bounded ? storage [ 0 ] . date : null ) ,
86- endBound : this . getDateString ( bounded ? storage [ storage . length - 1 ] . date : null ) ,
8783 } ;
8884
89- if ( ajaxArgs . startVisible !== ajaxArgs . startBound
90- && ajaxArgs . endVisible !== ajaxArgs . endBound && ! this . packetsLock ) {
91- this . packetsLock ++ ;
85+ if ( ! this . packetsLock ) {
86+ this . packetsLock += 1 ;
9287 this . component . instance . showLoadingIndicator ( ) ;
9388
9489 this . getDataFrame ( ajaxArgs )
9590 . then ( ( dataFrame : Record < string , number | Date > [ ] ) => {
96- this . packetsLock -- ;
97- dataFrame = dataFrame . map ( ( i ) => ( {
98- date : new Date ( i . Date ) ,
99- minTemp : i . MinTemp ,
100- maxTemp : i . MaxTemp ,
101- } ) ) ;
91+ this . packetsLock -= 1 ;
10292
10393 const componentStorage = dataSource . store ( ) ;
10494
105- dataFrame . forEach ( ( item ) => componentStorage . insert ( item ) ) ;
95+ dataFrame
96+ . map ( ( i ) => ( {
97+ date : new Date ( i . Date ) ,
98+ minTemp : i . MinTemp ,
99+ maxTemp : i . MaxTemp ,
100+ } ) )
101+ . forEach ( ( item ) => componentStorage . insert ( item ) ) ;
102+
106103 dataSource . reload ( ) ;
107104
108105 this . onVisualRangeChanged ( ) ;
109106 } )
110- . catch ( ( error ) => {
111- this . packetsLock -- ;
107+ . catch ( ( ) => {
108+ this . packetsLock -= 1 ;
112109 dataSource . reload ( ) ;
113110 } ) ;
114111 }
115112 }
116113
117114 getDataFrame ( args : Record < string , string > ) {
118115 const params = `startVisible=${ args . startVisible } `
119- + `&endVisible=${ args . endVisible } `
120- + `&startBound=${ args . startBound } `
121- + `&endBound=${ args . endBound } ` ;
116+ + `&endVisible=${ args . endVisible } ` ;
122117
123118 return lastValueFrom (
124- this . httpClient . get ( `https://js.devexpress.com/Demos/WidgetsGallery/data/temperatureData ?${ params } ` ) ,
119+ this . httpClient . get ( `https://js.devexpress.com/Demos/NetCore/api/TemperatureData ?${ params } ` ) ,
125120 ) ;
126121 }
127122
0 commit comments