an>) </span>{
    chart.data.labels.push(label);
    chart.data.datasets.forEach((dataset) =&gt; {
        dataset.data.push(data);
    });
    chart.update();
}
</code></pre>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">removeData</span>(<span class="hljs-params">chart</span>) </span>{
    chart.data.labels.pop();
    chart.data.datasets.forEach((dataset) =&gt; {
        dataset.data.pop();
    });
    chart.update();
}
<