JavaScript Data Gaps Trading Chart - Editor

Normally, series types such as LineSeries, AreaSeries, etc. automatically connect data points to highlight the progression of trend values. In some specific use cases, this is not the ideal behavior. One such use case is trading data visualization, which is also the setting for this particular.

Trading data often contains frequent data gaps, meaning relatively large time intervals when there are no data samples available. These correspond to times when the market is "closed", evenings and weekends.

In LightningChart JS, data gaps can be specified by adding an extra data point with value of NaN (Not-A-Number).

The code of this example shows one way of automatically detecting gaps in data sets and adding the NaN data points in. By default it looks for 1 hour difference between two data points, but this can be easily modified.