Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.44 KB

modify_data.md

File metadata and controls

65 lines (53 loc) · 1.44 KB
title description
Modifying Data
There are two ways to update data in a chart: either in adding and removing individual points, or updating the existing data with an entirely new set of data points.

Modifying Data

There are two ways to update data in a chart: either in adding and removing individual points, or updating the existing data with an entirely new set of data points.

Updating individual data points

let label = 'Wed';
let valueFromEachDataset = [30];
let index = 10; // default for adding/removing values: last index

chart.addDataPoint(label, valueFromEachDataset); // by default adds at end
chart.addDataPoint(label, valueFromEachDataset, index);
let index = 10;
chart.removeDataPoint();
chart.removeDataPoint(index);

Updating full data

Another way is to simply update the entire data, including annotations, by passing the entire new data object to update.

chart.update(data);