-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Should we need add a loading status/indicator on the chart?
Depending on the data, the chart can take a few seconds to appear the first time with a big number of elements, for small/standard time it's a matter of milliseconds (we still have to fix #109 to reduce the time for the first render)
There is also other factor that influence the loading time of a chart, independent of the chart implementation like any http request, data processing or everything else needed to get the right data and configuration to startup a chart.
I'm thinking of a simple flag on the Chart component or as a simple empty component that can be used in the following cases:
- we want to display a loading icon when we are waiting for the data to arrive (use case: dashboard)
- we want to keep displaying that loading icon when computing the geometries of the chart, before rendering
Two ideas:
// using a prop like ready to specify that the chart can be intialized
// in an empty state and start showing a loader
<Chart ready={false}>
</Chart>
// or
<Chart>
<NotReady />
</Chart>
// Then when you have your data, just remove that flag. We will maintain internally
// a ready flag to false until we are not ready to render, enabling the ready flag
// the loading will be removed from the chart element
<Chart>
<LineSeries ... />
</Chart>| Chart ready prop | geometries computed | loading indicator |
|---|---|---|
| ❌ | ❌ | ⏳ |
| ✅ | ❌ | ⏳ |
| ✅ | ✅ | 📊 |
What do you think? it's something that the chart needs to provide or we leave this to the UI using the chart?
If we implement that, we can easily align all the loading indicators on every code that use our library