React Chart - Loading Indicator
When the Chart visualizes local data, loading is instant. But when the Chart is bound to a remote data source, loading may take a considerable amount of time. To keep the viewer's attention, the Chart can display a loading indicator.

To activate the loading indicator, assign true to the loadingIndicator.enabled property. When activated, the indicator will be displayed or hidden automatically as the chart's data is updated.
- import React from 'react';
- import Chart, {
- LoadingIndicator
- } from 'devextreme-react/chart';
- export default function App() {
- return (
- <Chart ... >
- <LoadingIndicator
- enabled={true}
- />
- </Chart>
- );
- }
If you need to show or hide the loading indicator at runtime, call the showLoadingIndicator() or hideLoadingIndicator() method.
- import React, { useCallback, useRef } from 'react';
- import Chart, { type ChartRef } from 'devextreme-react/chart';
- function App() {
- const chartRef = useRef<ChartRef>(null);
- const showLoadingIndicator = useCallback(() => {
- const chart = chartRef.current?.instance();
- chart?.showLoadingIndicator();
- }, []);
- const hideLoadingIndicator = useCallback(() => {
- const chart = chartRef.current?.instance();
- chart?.hideLoadingIndicator();
- }, []);
- return (
- <Chart ref={chartRef} ... >
- </Chart>
- );
- }
- export default App;