mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 08:28:35 +00:00
Feature: Loading state for charts
This commit is contained in:
parent
bfa11cd253
commit
18543112ff
2 changed files with 15 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { resolveReferences } from '@/_helpers/utils';
|
||||
import Plot from 'react-plotly.js';
|
||||
import Skeleton from 'react-loading-skeleton';
|
||||
|
||||
export const Chart = function Chart({
|
||||
id, width, height, component, onComponentClick, currentState
|
||||
|
|
@ -19,7 +20,8 @@ export const Chart = function Chart({
|
|||
|
||||
const computedStyles = {
|
||||
width,
|
||||
height
|
||||
height,
|
||||
backgroundColor: 'white'
|
||||
};
|
||||
|
||||
const dataProperty = component.definition.properties.data;
|
||||
|
|
@ -64,11 +66,17 @@ export const Chart = function Chart({
|
|||
style={computedStyles}
|
||||
onClick={() => onComponentClick(id, component)}
|
||||
>
|
||||
<Plot
|
||||
data={chartData}
|
||||
layout={layout}
|
||||
config={{displayModeBar: false}}
|
||||
/>
|
||||
{loadingState === true ?
|
||||
<div style={{ width: '100%' }} className="p-2">
|
||||
<Skeleton count={5} />
|
||||
</div>
|
||||
:
|
||||
<Plot
|
||||
data={chartData}
|
||||
layout={layout}
|
||||
config={{displayModeBar: false}}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ export const componentTypes = [
|
|||
definition: {
|
||||
properties: {
|
||||
title: { value: 'This title can be changed' },
|
||||
markerColor: { value: 'red' },
|
||||
markerColor: { value: '#CDE1F8' },
|
||||
showGridLines: { value: true },
|
||||
loadingState: { value: `{{false}}` },
|
||||
type: { value: `line` },
|
||||
|
|
|
|||
Loading…
Reference in a new issue