One of the starting points of the visualizations of vis.js is that they can deal with dynamic data, and allow manipulation of the data. To enable this, vis.js includes a flexible key/value based DataSet
and DataView
to handle unstructured JSON data.
By providing a DataSet
with data to the visualizations, they can subscribe on changes in the DataSet
and automatically reflect the changes in their view. Changes in the data can be caused by a server pushing updates to a client, or by other interactive components in the web application. Vice versa, data can be manipulated in one of the visualizations. For example a REST-client can listen for changes and automatically write changes to the server. Or changes can be propagated to other parts of the web application.
A DataSet
can be used to store JSON objects by id. Objects can be added, updated and removed from the DataSet, and one can subscribe to changes in the DataSet
.
The data in the DataSet
can be filtered and ordered, and fields (like
dates) can be converted to a specific type. Data can be normalized when
appending it to the DataSet
as well.
Go to the documentation of DataSet
A DataView
offers a filtered and/or formatted view on a DataSet.
One can subscribe to changes in a DataView
, and easily get filtered or
formatted data without having to specify filters and field types all
the time.