Skip to main content
Version: 5.2.1

Separating data from series

Previously, the Series concept was responsible for both visualization configurations (like line styles, point colors, etc.) as well as managing the data that is visualized.

Starting with LightningChart JS v5.1.0 it is possible to create a separate DataSetXY object, which is not tied to any data visualization, style, axis or even chart. It is simply a container for data.

You can use the same data management methods on a DataSetXY as you can on a PointLineAreaSeries. Also, at any time you can set the data set of a PointLineAreaSeries:

const dataSet = new DataSetXY({ dataPattern: 'ProgressiveX' })
const series = ChartXY.addPointLineAreaSeries()
.setDataSet(dataSet)

This gives users the option of managing their data separate from series, which can be useful in several different scenarios:

  • Switching between visualization types. Whenever you need to change visualization type, just destroy the old series, create a new one and plug the data in. No expensive data loading needed.
  • Reusing same data set in multiple visualizations. You can create 1 data set, and display it in multiple charts and different series at the same time.
  • Switching between axis types (linear / logarithmic). It is currently not possible to move a series from an axis to another. However, now the recreation of a series is quite trivial compared to before, so you can create the series again and keep using the same data set.