DevExtreme v23.1 is now available.
Explore our newest features/capabilities and share your thoughts with us.
In this demo, the range area Chart loads data as you pan it. Once the component loads a data block, this data stays in memory to reduce requests to the server. To implement this functionality, do the following:
Configure a data source.
Assign a DataSource with an empty store to the Chart dataSource property.
Set the sort property to date
.
Disable the paginate property to prevent data from partitioning.
Configure the Chart to support on-demand data loading.
Set the visualRangeUpdateMode property to keep
.
Specify a loadingIndicator.
Specify the initial visualRange.
Implement a function that respond to user pan operations and tracks visualRange changes. If a user changed the visual range, initiate a request for additional data.
Implement functions that load the data.
In this demo, Chart displays daily information. If a user pan the Chart left or right more than half a day, additional data starts to load. The onVisualRangeChanged
initiates this procedure.
The uploadDataByVisualRange
function analyzes the starting and ending points of the visual range and the bounds of already loaded data. If necessary, it calls the getDataFrame
function to obtain new data points. Finally, it reloads the DataSource and saves the current visual range.
The getDataFrame
Ajax request gets the new data frame from the server.