public update(bar: SeriesDataItemTypeMap<Time>[TSeries], historicalUpdate?: boolean): void {
if (historicalUpdate !== undefined) {
this.lwcSeries.update(bar, historicalUpdate);
return;
}
const data = this.lwcSeries.data();
const lastBar = data[data.length - 1];
if (!lastBar || !this.isOlderBar(bar, lastBar)) {
this.lwcSeries.update(bar, false);
return;
}
const dataPointExists = data.some((item) => item.time === bar.time);
if (dataPointExists) {
this.lwcSeries.update(bar, true);
}
}