diff --git a/web/client/components/charts/PlotlyChart.jsx b/web/client/components/charts/PlotlyChart.jsx index 2c2347bf8d..af11c8fe69 100644 --- a/web/client/components/charts/PlotlyChart.jsx +++ b/web/client/components/charts/PlotlyChart.jsx @@ -1,4 +1,5 @@ // customizable method: use your own `Plotly` object import createPlotlyComponent from 'react-plotly.js/factory'; import Plotly from 'plotly.js-cartesian-dist'; -export const Plot = createPlotlyComponent(Plotly); +const Plot = createPlotlyComponent(Plotly); +export default Plot; diff --git a/web/client/components/charts/WidgetChart.jsx b/web/client/components/charts/WidgetChart.jsx index 09ad4aefd2..8d9adf27da 100644 --- a/web/client/components/charts/WidgetChart.jsx +++ b/web/client/components/charts/WidgetChart.jsx @@ -6,11 +6,12 @@ * LICENSE file in the root directory of this source tree. */ -import React from 'react'; -import { Plot } from './PlotlyChart'; +import React, { Suspense } from 'react'; import { sameToneRangeColors } from '../../utils/ColorUtils'; import { parseExpression } from '../../utils/ExpressionUtils'; +import LoadingView from '../misc/LoadingView'; +const Plot = React.lazy(() => import('./PlotlyChart')); export const COLOR_DEFAULTS = { base: 190, @@ -196,11 +197,13 @@ export default function WidgetChart({ }) { const { data, layout, config } = toPlotly(props); return ( - + }> + + ); }