If the series.shift
option is not set to true, when the new data is added through addData()
, the chart automatically shifts as shown above. However, this could lead to problems when the amount of data increases. This problem can be addressed through the Live Update feature.
The Live Update feature allows the chart to show the adding of the new data when addData()
API is called according to the predetermined size.
- Set the
series.shift
option totrue
.
const options = {
series: {
shift: true
}
}
- Use the
addData
API to add data.
const chart = new LineChart({ el, data, options });
chart.addData(newData, newCategory);
The following is a list of charts compatible with Live Update.